Changeset df747b9c in mainline for uspace/srv/drivers/root/root.c


Ignore:
Timestamp:
2010-04-23T11:30:25Z (14 years ago)
Author:
Lenka Trochtova <trochtova.lenka@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
5af21c5
Parents:
a78fa2a
Message:

added device states (usable, invalid, not present, not initialized); add_device driver callback method returns integer (errno) instead of bool

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/drivers/root/root.c

    ra78fa2a rdf747b9c  
    5252#define NAME "root"
    5353
    54 static bool root_add_device(device_t *dev);
     54static int root_add_device(device_t *dev);
    5555
    5656/** The root device driver's standard operations.
     
    6767};
    6868
    69 /** Create the device which represents the root of HW device tree.
     69/** Create the device which represents the root of HW device tree.
     70 *
    7071 * @param parent parent of the newly created device.
     72 * @return 0 on success, negative error number otherwise.
    7173 */
    72 static bool add_platform_child(device_t *parent) {
     74static int add_platform_child(device_t *parent) {
    7375        printf(NAME ": adding new child for platform device.\n");
    7476       
     77        int res = EOK;
    7578        device_t *platform = NULL;
    7679        match_id_t *match_id = NULL;   
     
    7881        // create new device
    7982        if (NULL == (platform = create_device())) {
     83                res = ENOMEM;
    8084                goto failure;
    8185        }       
     
    8690        // initialize match id list
    8791        if (NULL == (match_id = create_match_id())) {
     92                res = ENOMEM;
    8893                goto failure;
    8994        }
     
    95100       
    96101        // register child  device
    97         if (!child_device_register(platform, parent)) {
     102        res = child_device_register(platform, parent);
     103        if (EOK != res) {
    98104                goto failure;
    99105        }
    100106       
    101         return true;
     107        return res;
    102108       
    103109failure:
     
    111117        }
    112118       
    113         return false;   
     119        return res;     
    114120}
    115121
     
    117123 * @param dev the device which is root of the whole device tree (both of HW and pseudo devices).
    118124 */
    119 static bool root_add_device(device_t *dev)
     125static int root_add_device(device_t *dev)
    120126{
    121127        printf(NAME ": root_add_device, device handle = %d\n", dev->handle);
    122128       
    123129        // register root device's children     
    124         if (!add_platform_child(dev)) {
     130        int res = add_platform_child(dev);     
     131        if (EOK != res) {
    125132                printf(NAME ": failed to add child device for platform.\n");
    126                 return false;
    127133        }
    128134       
    129         return true;
     135        return res;
    130136}
    131137
Note: See TracChangeset for help on using the changeset viewer.