Changeset 5159ae9 in mainline for uspace/lib/drv/include/driver.h


Ignore:
Timestamp:
2010-05-29T08:37:38Z (15 years ago)
Author:
Lenka Trochtova <trochtova.lenka@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
ce89036b
Parents:
692c40cb
Message:

Rename 'device_class' structure to a more appropriate 'device_ops'. The device_class structure has nothing in common with the device classes introduced by the previous commit and it evolved to just a set of callback functions.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/drv/include/driver.h

    r692c40cb r5159ae9  
    8080// device class
    8181
    82 /** Devices belonging to the same class should implement the same set of interfaces.*/
    83 typedef struct device_class {
    84         /** Unique identification of the class. */
    85         int id;
     82/** Devices operations. */
     83typedef struct device_ops {
    8684        /** Optional callback function called when a client is connecting to the device. */
    8785        int (*open)(device_t *dev);
     
    9391         * by any of the standard interfaces, the default handler is used.*/
    9492        remote_handler_t *default_handler;
    95 } device_class_t;
     93} device_ops_t;
    9694
    9795
     
    112110        /** The device driver's data associated with this device.*/
    113111        void *driver_data;
    114         /** Device class consist of class id and table of interfaces supported by the device.*/
    115         device_class_t *class;
     112        /** The implementation of operations provided by this device.*/
     113        device_ops_t *ops;
    116114        /** Pointer to the previous and next device in the list of devices handled by the driver */
    117115        link_t link;
     
    168166{
    169167        assert(is_valid_iface_idx(idx));       
    170         if (NULL == dev->class) {
     168        if (NULL == dev->ops) {
    171169                return NULL;
    172170        }
    173         return dev->class->interfaces[idx];     
     171        return dev->ops->interfaces[idx];       
    174172}
    175173
     
    280278static inline remote_handler_t * device_get_default_handler(device_t *dev)
    281279{
    282         if (NULL == dev->class) {
     280        if (NULL == dev->ops) {
    283281                return NULL;
    284282        }
    285283       
    286         return dev->class->default_handler;     
     284        return dev->ops->default_handler;       
    287285}
    288286
Note: See TracChangeset for help on using the changeset viewer.