Changeset 5291411 in mainline


Ignore:
Timestamp:
2010-10-23T13:01:34Z (14 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
b9ccc46
Parents:
663f41c4
Message:

Cstyle fixes in the root driver.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/root/root.c

    r663f41c4 r5291411  
    5454static int root_add_device(device_t *dev);
    5555
    56 /** The root device driver's standard operations.
    57  */
     56/** The root device driver's standard operations. */
    5857static driver_ops_t root_ops = {
    5958        .add_device = &root_add_device
    6059};
    6160
    62 /** The root device driver structure.
    63  */
     61/** The root device driver structure. */
    6462static driver_t root_driver = {
    6563        .name = NAME,
     
    6866
    6967/** Create the device which represents the root of HW device tree.
    70  * 
    71  * @param parent parent of the newly created device.
     68 *
     69 * @param parent        Parent of the newly created device.
    7270 * @return 0 on success, negative error number otherwise.
    7371 */
    74 static int add_platform_child(device_t *parent) {
     72static int add_platform_child(device_t *parent)
     73{
    7574        printf(NAME ": adding new child for platform device.\n");
    7675       
    7776        int res = EOK;
    7877        device_t *platform = NULL;
    79         match_id_t *match_id = NULL;   
     78        match_id_t *match_id = NULL;
    8079       
    81         // create new device
    82         if (NULL == (platform = create_device())) {
     80        /* Create new device. */
     81        platform = create_device();
     82        if (NULL == platform) {
    8383                res = ENOMEM;
    8484                goto failure;
     
    8888        printf(NAME ": the new device's name is %s.\n", platform->name);
    8989       
    90         // initialize match id list
    91         if (NULL == (match_id = create_match_id())) {
     90        /* Initialize match id list. */
     91        match_id = create_match_id();
     92        if (NULL == match_id) {
    9293                res = ENOMEM;
    9394                goto failure;
    9495        }
    9596       
    96         // TODO - replace this with some better solution (sysinfo ?)
     97        /* TODO - replace this with some better solution (sysinfo ?) */
    9798        match_id->id = STRING(UARCH);
    9899        match_id->score = 100;
    99         add_match_id(&platform->match_ids, match_id);   
     100        add_match_id(&platform->match_ids, match_id);
    100101       
    101         // register child  device
     102        /* Register child device. */
    102103        res = child_device_register(platform, parent);
    103         if (EOK != res) {
     104        if (EOK != res)
    104105                goto failure;
    105         }
    106106       
    107107        return res;
    108108       
    109109failure:
    110         if (NULL != match_id) {
     110        if (NULL != match_id)
    111111                match_id->id = NULL;
    112         }
    113112       
    114113        if (NULL != platform) {
    115114                platform->name = NULL;
    116                 delete_device(platform);               
     115                delete_device(platform);
    117116        }
    118117       
    119         return res;     
     118        return res;
    120119}
    121120
    122121/** Get the root device.
    123  * @param dev the device which is root of the whole device tree (both of HW and pseudo devices).
     122 *
     123 * @param dev           The device which is root of the whole device tree (both
     124 *                      of HW and pseudo devices).
    124125 */
    125 static int root_add_device(device_t *dev) 
     126static int root_add_device(device_t *dev)
    126127{
    127128        printf(NAME ": root_add_device, device handle = %d\n", dev->handle);
    128129       
    129         // register root device's children     
    130         int res = add_platform_child(dev);     
    131         if (EOK != res) {
     130        /* Register root device's children. */
     131        int res = add_platform_child(dev);
     132        if (EOK != res)
    132133                printf(NAME ": failed to add child device for platform.\n");
    133         }
    134134       
    135135        return res;
     
    138138int main(int argc, char *argv[])
    139139{
    140         printf(NAME ": HelenOS root device driver\n"); 
     140        printf(NAME ": HelenOS root device driver\n");
    141141        return driver_main(&root_driver);
    142142}
     
    145145 * @}
    146146 */
    147  
     147
Note: See TracChangeset for help on using the changeset viewer.