Changeset b9ccc46 in mainline


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

Cstyle fixes in rootia32 driver.

File:
1 edited

Legend:

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

    r5291411 rb9ccc46  
    5656
    5757typedef struct rootia32_child_dev_data {
    58         hw_resource_list_t hw_resources;       
     58        hw_resource_list_t hw_resources;
    5959} rootia32_child_dev_data_t;
    6060
     
    6262static void root_ia32_init(void);
    6363
    64 /** The root device driver's standard operations.
    65  */
     64/** The root device driver's standard operations. */
    6665static driver_ops_t rootia32_ops = {
    6766        .add_device = &rootia32_add_device
    6867};
    6968
    70 /** The root device driver structure.
    71  */
     69/** The root device driver structure. */
    7270static driver_t rootia32_driver = {
    7371        .name = NAME,
     
    8078                .address = 0xCF8,
    8179                .size = 8,
    82                 .endianness = LITTLE_ENDIAN     
    83         }       
     80                .endianness = LITTLE_ENDIAN
     81        }
    8482};
    8583
    8684static rootia32_child_dev_data_t pci_data = {
    8785        .hw_resources = {
    88                 1, 
     86                1,
    8987                &pci_conf_regs
    9088        }
    9189};
    9290
    93 static hw_resource_list_t * rootia32_get_child_resources(device_t *dev)
    94 {
    95         rootia32_child_dev_data_t *data = (rootia32_child_dev_data_t *)dev->driver_data;
    96         if (NULL == data) {
     91static hw_resource_list_t *rootia32_get_child_resources(device_t *dev)
     92{
     93        rootia32_child_dev_data_t *data;
     94       
     95        data = (rootia32_child_dev_data_t *) dev->driver_data;
     96        if (NULL == data)
    9797                return NULL;
    98         }
     98       
    9999        return &data->hw_resources;
    100100}
    101101
    102 static bool rootia32_enable_child_interrupt(device_t *dev) 
    103 {
    104         // TODO
     102static bool rootia32_enable_child_interrupt(device_t *dev)
     103{
     104        /* TODO */
    105105       
    106106        return false;
     
    109109static resource_iface_t child_res_iface = {
    110110        &rootia32_get_child_resources,
    111         &rootia32_enable_child_interrupt       
    112 };
    113 
    114 // initialized in root_ia32_init() function
     111        &rootia32_enable_child_interrupt
     112};
     113
     114/* Initialized in root_ia32_init() function. */
    115115static device_ops_t rootia32_child_ops;
    116116
    117 static bool rootia32_add_child(
    118         device_t *parent, const char *name, const char *str_match_id,
    119         rootia32_child_dev_data_t *drv_data)
     117static bool
     118rootia32_add_child(device_t *parent, const char *name, const char *str_match_id,
     119    rootia32_child_dev_data_t *drv_data)
    120120{
    121121        printf(NAME ": adding new child device '%s'.\n", name);
    122122       
    123123        device_t *child = NULL;
    124         match_id_t *match_id = NULL;   
    125        
    126         // create new device
    127         if (NULL == (child = create_device())) {
     124        match_id_t *match_id = NULL;
     125       
     126        /* Create new device. */
     127        child = create_device();
     128        if (NULL == child)
    128129                goto failure;
    129         }
    130130       
    131131        child->name = name;
    132132        child->driver_data = drv_data;
    133133       
    134         // initialize match id list
    135         if (NULL == (match_id = create_match_id())) {
     134        /* Initialize match id list */
     135        match_id = create_match_id();
     136        if (NULL == match_id)
    136137                goto failure;
    137         }
     138       
    138139        match_id->id = str_match_id;
    139140        match_id->score = 100;
    140         add_match_id(&child->match_ids, match_id);     
    141        
    142         // set provided operations to the device
     141        add_match_id(&child->match_ids, match_id);
     142       
     143        /* Set provided operations to the device. */
    143144        child->ops = &rootia32_child_ops;
    144145       
    145         // register child  device
    146         if (EOK != child_device_register(child, parent)) {
     146        /* Register child device. */
     147        if (EOK != child_device_register(child, parent))
    147148                goto failure;
    148         }
    149149       
    150150        return true;
    151151       
    152152failure:
    153         if (NULL != match_id) {
     153        if (NULL != match_id)
    154154                match_id->id = NULL;
    155         }
    156155       
    157156        if (NULL != child) {
    158157                child->name = NULL;
    159                 delete_device(child);           
     158                delete_device(child);
    160159        }
    161160       
    162161        printf(NAME ": failed to add child device '%s'.\n", name);
    163162       
    164         return false;   
    165 }
    166 
    167 static bool rootia32_add_children(device_t *dev) 
     163        return false;
     164}
     165
     166static bool rootia32_add_children(device_t *dev)
    168167{
    169168        return rootia32_add_child(dev, "pci0", "intel_pci", &pci_data);
     
    171170
    172171/** Get the root device.
    173  *
    174  * @param dev the device which is root of the whole device tree (both of HW and pseudo devices).
    175  * @return 0 on success, negative error number otherwise.
    176  */
    177 static int rootia32_add_device(device_t *dev)
     172 *
     173 * @param dev           The device which is root of the whole device tree (both
     174 *                      of HW and pseudo devices).
     175 * @return              Zero on success, negative error number otherwise.
     176 */
     177static int rootia32_add_device(device_t *dev)
    178178{
    179179        printf(NAME ": rootia32_add_device, device handle = %d\n", dev->handle);
    180180       
    181         // register child devices       
     181        /* Register child devices. */
    182182        if (!rootia32_add_children(dev)) {
    183                 printf(NAME ": failed to add child devices for platform ia32.\n");
     183                printf(NAME ": failed to add child devices for platform "
     184                    "ia32.\n");
    184185        }
    185186       
     
    187188}
    188189
    189 static void root_ia32_init() {
     190static void root_ia32_init(void)
     191{
    190192        rootia32_child_ops.interfaces[HW_RES_DEV_IFACE] = &child_res_iface;
    191193}
     
    193195int main(int argc, char *argv[])
    194196{
    195         printf(NAME ": HelenOS rootia32 device driver\n");     
     197        printf(NAME ": HelenOS rootia32 device driver\n");
    196198        root_ia32_init();
    197199        return driver_main(&rootia32_driver);
     
    201203 * @}
    202204 */
    203  
Note: See TracChangeset for help on using the changeset viewer.