Changeset 80a96d2 in mainline for uspace/lib/drv/generic/driver.c


Ignore:
Timestamp:
2011-09-05T21:26:47Z (13 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
b33870b
Parents:
16cc9a6
Message:

DDF support for surprise removal.

File:
1 edited

Legend:

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

    r16cc9a6 r80a96d2  
    333333}
    334334
     335static void driver_dev_gone(ipc_callid_t iid, ipc_call_t *icall)
     336{
     337        devman_handle_t devh;
     338        ddf_dev_t *dev;
     339        int rc;
     340       
     341        devh = IPC_GET_ARG1(*icall);
     342       
     343        fibril_mutex_lock(&devices_mutex);
     344        dev = driver_get_device(devh);
     345        if (dev != NULL)
     346                dev_add_ref(dev);
     347        fibril_mutex_unlock(&devices_mutex);
     348       
     349        if (dev == NULL) {
     350                async_answer_0(iid, ENOENT);
     351                return;
     352        }
     353       
     354        if (driver->driver_ops->dev_gone != NULL)
     355                rc = driver->driver_ops->dev_gone(dev);
     356        else
     357                rc = ENOTSUP;
     358       
     359        if (rc == EOK)
     360                dev_del_ref(dev);
     361       
     362        async_answer_0(iid, (sysarg_t) rc);
     363}
     364
    335365static void driver_fun_online(ipc_callid_t iid, ipc_call_t *icall)
    336366{
     
    423453                case DRIVER_DEV_REMOVE:
    424454                        driver_dev_remove(callid, &call);
     455                        break;
     456                case DRIVER_DEV_GONE:
     457                        driver_dev_gone(callid, &call);
    425458                        break;
    426459                case DRIVER_FUN_ONLINE:
Note: See TracChangeset for help on using the changeset viewer.