Changeset d35ac1d in mainline


Ignore:
Timestamp:
2011-01-09T19:52:08Z (13 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
36f2b3e
Parents:
8871dba
Message:

Rename iface to ops in driver.c

Location:
uspace/lib/drv
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/drv/generic/driver.c

    r8871dba rd35ac1d  
    140140}
    141141
    142 static device_t * driver_get_device(link_t *devices, devman_handle_t handle)
     142static device_t *driver_get_device(link_t *devices, devman_handle_t handle)
    143143{
    144144        device_t *dev = NULL;
     
    164164        int res = EOK;
    165165       
    166         devman_handle_t dev_handle =  IPC_GET_ARG1(*icall);
     166        devman_handle_t dev_handle = IPC_GET_ARG1(*icall);
    167167        devman_handle_t parent_dev_handle = IPC_GET_ARG2(*icall);
    168    
     168       
    169169        device_t *dev = create_device();
    170170        dev->handle = dev_handle;
     
    177177       
    178178        res = driver->driver_ops->add_device(dev);
    179         if (0 == res) {
     179        if (res == 0) {
    180180                printf("%s: new device with handle=%" PRIun " was added.\n",
    181181                    driver->name, dev_handle);
     
    246246                ret = (*dev->ops->open)(dev);
    247247       
    248         ipc_answer_0(iid, ret); 
     248        ipc_answer_0(iid, ret);
    249249        if (EOK != ret)
    250250                return;
     
    258258               
    259259                switch  (method) {
    260                 case IPC_M_PHONE_HUNGUP:               
     260                case IPC_M_PHONE_HUNGUP:
    261261                        /* close the device */
    262262                        if (NULL != dev->ops && NULL != dev->ops->close)
     
    264264                        ipc_answer_0(callid, EOK);
    265265                        return;
    266                 default:               
     266                default:
    267267                        /* convert ipc interface id to interface index */
    268268                       
     
    289289                        /* calling one of the device's interfaces */
    290290                       
    291                         /* get the device interface structure */
    292                         void *iface = device_get_iface(dev, iface_idx);
    293                         if (NULL == iface) {
     291                        /* Get the interface ops structure. */
     292                        void *ops = device_get_ops(dev, iface_idx);
     293                        if (ops == NULL) {
    294294                                printf("%s: driver_connection_gen error - ",
    295295                                    driver->name);
     
    304304                         * handling ("remote interface").
    305305                         */
    306                         remote_iface_t* rem_iface = get_remote_iface(iface_idx);
     306                        remote_iface_t *rem_iface = get_remote_iface(iface_idx);
    307307                        assert(NULL != rem_iface);
    308308
     
    325325                         * associated with the device by its driver.
    326326                         */
    327                         (*iface_method_ptr)(dev, iface, callid, &call);
     327                        (*iface_method_ptr)(dev, ops, callid, &call);
    328328                        break;
    329329                }
     
    377377        if (EOK == res)
    378378                return res;
    379         remove_from_devices_list(child);       
     379        remove_from_devices_list(child);
    380380        return res;
    381381}
  • uspace/lib/drv/generic/remote_char_dev.c

    r8871dba rd35ac1d  
    6969 *
    7070 * @param dev           The device from which the data are read.
    71  * @param iface         The local interface structure.
     71 * @param ops           The local ops structure.
    7272 */
    7373static void
    74 remote_char_read(device_t *dev, void *iface, ipc_callid_t callid,
     74remote_char_read(device_t *dev, void *ops, ipc_callid_t callid,
    7575    ipc_call_t *call)
    7676{
    77         char_dev_ops_t *char_iface = (char_dev_ops_t *) iface;
     77        char_dev_ops_t *char_dev_ops = (char_dev_ops_t *) ops;
    7878        ipc_callid_t cid;
    7979       
     
    8585        }
    8686       
    87         if (!char_iface->read) {
     87        if (!char_dev_ops->read) {
    8888                async_data_read_finalize(cid, NULL, 0);
    8989                ipc_answer_0(callid, ENOTSUP);
     
    9595       
    9696        char buf[MAX_CHAR_RW_COUNT];
    97         int ret = (*char_iface->read)(dev, buf, len);
     97        int ret = (*char_dev_ops->read)(dev, buf, len);
    9898       
    9999        if (ret < 0) {
     
    116116 *
    117117 * @param dev           The device to which the data are written.
    118  * @param iface         The local interface structure.
     118 * @param ops           The local ops structure.
    119119 */
    120120static void
    121 remote_char_write(device_t *dev, void *iface, ipc_callid_t callid,
     121remote_char_write(device_t *dev, void *ops, ipc_callid_t callid,
    122122    ipc_call_t *call)
    123123{
    124         char_dev_ops_t *char_iface = (char_dev_ops_t *) iface;
     124        char_dev_ops_t *char_dev_ops = (char_dev_ops_t *) ops;
    125125        ipc_callid_t cid;
    126126        size_t len;
     
    132132        }
    133133       
    134         if (!char_iface->write) {
     134        if (!char_dev_ops->write) {
    135135                async_data_write_finalize(cid, NULL, 0);
    136136                ipc_answer_0(callid, ENOTSUP);
     
    145145        async_data_write_finalize(cid, buf, len);
    146146       
    147         int ret = (*char_iface->write)(dev, buf, len);
     147        int ret = (*char_dev_ops->write)(dev, buf, len);
    148148        if (ret < 0) {
    149149                /* Some error occured. */
  • uspace/lib/drv/generic/remote_hw_res.c

    r8871dba rd35ac1d  
    5656};
    5757
    58 static void remote_res_enable_interrupt(device_t *dev, void *iface,
     58static void remote_res_enable_interrupt(device_t *dev, void *ops,
    5959    ipc_callid_t callid, ipc_call_t *call)
    6060{
    61         hw_res_ops_t *ires = (hw_res_ops_t *) iface;
     61        hw_res_ops_t *hw_res_ops = (hw_res_ops_t *) ops;
    6262       
    63         if (NULL == ires->enable_interrupt)
     63        if (hw_res_ops->enable_interrupt == NULL)
    6464                ipc_answer_0(callid, ENOTSUP);
    65         else if (ires->enable_interrupt(dev))
     65        else if (hw_res_ops->enable_interrupt(dev))
    6666                ipc_answer_0(callid, EOK);
    6767        else
     
    6969}
    7070
    71 static void remote_res_get_resource_list(device_t *dev, void *iface,
     71static void remote_res_get_resource_list(device_t *dev, void *ops,
    7272    ipc_callid_t callid, ipc_call_t *call)
    7373{
    74         hw_res_ops_t *ires = (hw_res_ops_t *) iface;
    75         if (NULL == ires->get_resource_list) {
     74        hw_res_ops_t *hw_res_ops = (hw_res_ops_t *) ops;
     75
     76        if (hw_res_ops->get_resource_list == NULL) {
    7677                ipc_answer_0(callid, ENOTSUP);
    7778                return;
    7879        }
    7980       
    80         hw_resource_list_t *hw_resources = ires->get_resource_list(dev);
     81        hw_resource_list_t *hw_resources = hw_res_ops->get_resource_list(dev);
    8182        if (NULL == hw_resources){
    8283                ipc_answer_0(callid, ENOENT);
  • uspace/lib/drv/include/driver.h

    r8871dba rd35ac1d  
    188188}
    189189
    190 static inline void *device_get_iface(device_t *dev, dev_inferface_idx_t idx)
     190static inline void *device_get_ops(device_t *dev, dev_inferface_idx_t idx)
    191191{
    192192        assert(is_valid_iface_idx(idx));
    193         if (NULL == dev->ops)
     193        if (dev->ops == NULL)
    194194                return NULL;
    195195        return dev->ops->interfaces[idx];
Note: See TracChangeset for help on using the changeset viewer.