Changeset 1b367b4 in mainline


Ignore:
Timestamp:
2011-02-08T19:21:46Z (13 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
8b1e15ac
Parents:
ba38f72c
Message:

Small C-style fixes in devman client code.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/c/generic/devman.c

    rba38f72c r1b367b4  
    123123}
    124124
    125 static int devman_send_match_id(int phone, match_id_t *match_id) \
    126 {
    127         ipc_call_t answer;
    128         aid_t req = async_send_1(phone, DEVMAN_ADD_MATCH_ID, match_id->score, &answer);
    129         int retval = async_data_write_start(phone, match_id->id, str_size(match_id->id));
     125static int devman_send_match_id(int phone, match_id_t *match_id)
     126{
     127        ipc_call_t answer;
     128
     129        aid_t req = async_send_1(phone, DEVMAN_ADD_MATCH_ID, match_id->score,
     130            &answer);
     131        int retval = async_data_write_start(phone, match_id->id,
     132            str_size(match_id->id));
     133
    130134        async_wait_for(req, NULL);
    131135        return retval;
     
    133137
    134138
    135 static int devman_send_match_ids(int phone, match_id_list_t *match_ids) 
     139static int devman_send_match_ids(int phone, match_id_list_t *match_ids)
    136140{
    137141        link_t *link = match_ids->ids.next;
    138142        match_id_t *match_id = NULL;
    139143        int ret = EOK;
    140        
     144
    141145        while (link != &match_ids->ids) {
    142146                match_id = list_get_instance(link, match_id_t, link);
    143                 if (EOK != (ret = devman_send_match_id(phone, match_id)))
    144                 {
    145                         printf("Driver failed to send match id, error number = %d\n", ret);
    146                         return ret;                     
    147                 }
     147                ret = devman_send_match_id(phone, match_id);
     148                if (ret != EOK) {
     149                        printf("Driver failed to send match id, error %d\n",
     150                            ret);
     151                        return ret;
     152                }
     153
    148154                link = link->next;
    149155        }
    150         return ret;     
    151 }
    152 
    153 int devman_child_device_register(
    154         const char *name, match_id_list_t *match_ids, devman_handle_t parent_handle, devman_handle_t *handle)
    155 {               
     156
     157        return ret;
     158}
     159
     160int devman_child_device_register(const char *name, match_id_list_t *match_ids,
     161    devman_handle_t parent_handle, devman_handle_t *handle)
     162{
    156163        int phone = devman_get_phone(DEVMAN_DRIVER, IPC_FLAG_BLOCKING);
    157164       
     
    163170        int match_count = list_count(&match_ids->ids); 
    164171        ipc_call_t answer;
    165         aid_t req = async_send_2(phone, DEVMAN_ADD_CHILD_DEVICE, parent_handle, match_count, &answer);
     172        aid_t req = async_send_2(phone, DEVMAN_ADD_CHILD_DEVICE, parent_handle, match_count,
     173            &answer);
    166174
    167175        sysarg_t retval = async_data_write_start(phone, name, str_size(name));
     
    179187       
    180188        if (retval != EOK) {
    181                 if (handle != NULL) {
     189                if (handle != NULL)
    182190                        *handle = -1;
    183                 }
    184                 return retval;
    185         }       
     191
     192                return retval;
     193        }
    186194       
    187195        if (handle != NULL)
    188                 *handle = (int) IPC_GET_ARG1(answer);   
    189                
    190         return retval;
    191 }
    192 
    193 int devman_add_device_to_class(devman_handle_t devman_handle, const char *class_name)
     196                *handle = (int) IPC_GET_ARG1(answer);
     197               
     198        return retval;
     199}
     200
     201int devman_add_device_to_class(devman_handle_t devman_handle,
     202    const char *class_name)
    194203{
    195204        int phone = devman_get_phone(DEVMAN_DRIVER, IPC_FLAG_BLOCKING);
     
    200209        async_serialize_start();
    201210        ipc_call_t answer;
    202         aid_t req = async_send_1(phone, DEVMAN_ADD_DEVICE_TO_CLASS, devman_handle, &answer);
    203        
    204         sysarg_t retval = async_data_write_start(phone, class_name, str_size(class_name));
     211        aid_t req = async_send_1(phone, DEVMAN_ADD_DEVICE_TO_CLASS,
     212            devman_handle, &answer);
     213       
     214        sysarg_t retval = async_data_write_start(phone, class_name,
     215            str_size(class_name));
    205216        if (retval != EOK) {
    206217                async_wait_for(req, NULL);
     
    212223        async_serialize_end();
    213224       
    214         return retval; 
     225        return retval;
    215226}
    216227
     
    265276}
    266277
    267 int devman_device_get_handle(const char *pathname, devman_handle_t *handle, unsigned int flags)
     278int devman_device_get_handle(const char *pathname, devman_handle_t *handle,
     279    unsigned int flags)
    268280{
    269281        int phone = devman_get_phone(DEVMAN_CLIENT, flags);
     
    278290            &answer);
    279291       
    280         sysarg_t retval = async_data_write_start(phone, pathname, str_size(pathname));
     292        sysarg_t retval = async_data_write_start(phone, pathname,
     293            str_size(pathname));
    281294        if (retval != EOK) {
    282295                async_wait_for(req, NULL);
Note: See TracChangeset for help on using the changeset viewer.