Changeset 8300c72 in mainline for uspace/srv/devman/drv_conn.c


Ignore:
Timestamp:
2025-03-03T22:58:05Z (13 hours ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
master
Children:
77a0119
Parents:
f35749e
Message:

Quiesce devices before proceeding with shutdown.

Only implemented for e1k, uhci and xhci.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/devman/drv_conn.c

    rf35749e r8300c72  
    444444
    445445        rc = fun_offline(fun);
     446        if (rc != EOK) {
     447                fun_busy_unlock(fun);
     448                fun_del_ref(fun);
     449                async_answer_0(icall, rc);
     450                return;
     451        }
     452
     453        fun_busy_unlock(fun);
     454        fun_del_ref(fun);
     455        async_answer_0(icall, EOK);
     456}
     457
     458/** Quiesce function by driver request.
     459 *
     460 */
     461static void devman_drv_fun_quiesce(ipc_call_t *icall, driver_t *drv)
     462{
     463        fun_node_t *fun;
     464        errno_t rc;
     465
     466        fun = find_fun_node(&device_tree, ipc_get_arg1(icall));
     467        if (fun == NULL) {
     468                async_answer_0(icall, ENOENT);
     469                return;
     470        }
     471
     472        fun_busy_lock(fun);
     473
     474        fibril_rwlock_write_lock(&device_tree.rwlock);
     475        if (fun->dev == NULL || fun->dev->drv != drv) {
     476                fun_busy_unlock(fun);
     477                fun_del_ref(fun);
     478                async_answer_0(icall, ENOENT);
     479                return;
     480        }
     481        fibril_rwlock_write_unlock(&device_tree.rwlock);
     482
     483        rc = fun_quiesce(fun);
    446484        if (rc != EOK) {
    447485                fun_busy_unlock(fun);
     
    677715                        devman_drv_fun_offline(&call, driver);
    678716                        break;
     717                case DEVMAN_DRV_FUN_QUIESCE:
     718                        devman_drv_fun_quiesce(&call, driver);
     719                        break;
    679720                case DEVMAN_DRV_FUN_WAIT_STABLE:
    680721                        devman_drv_fun_wait_stable(&call, driver);
Note: See TracChangeset for help on using the changeset viewer.