Changeset d30e067 in mainline for uspace/srv/devman/drv_conn.c


Ignore:
Timestamp:
2025-03-02T20:02:33Z (5 months ago)
Author:
Miroslav Cimerman <mc@…>
Children:
8cdf360
Parents:
7debda3 (diff), 4285f384 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge 'upstream/master' into helenraid-para

File:
1 edited

Legend:

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

    r7debda3 rd30e067  
    11/*
    2  * Copyright (c) 2023 Jiri Svoboda
     2 * Copyright (c) 2025 Jiri Svoboda
    33 * Copyright (c) 2010 Lenka Trochtova
    44 * All rights reserved.
     
    453453        fun_busy_unlock(fun);
    454454        fun_del_ref(fun);
     455        async_answer_0(icall, EOK);
     456}
     457
     458/** Wait for function to become stable.
     459 *
     460 */
     461static void devman_drv_fun_wait_stable(ipc_call_t *icall, driver_t *drv)
     462{
     463        fun_node_t *fun;
     464        dev_node_t *dev;
     465
     466        fibril_rwlock_read_lock(&device_tree.rwlock);
     467
     468        fun = find_fun_node(&device_tree, ipc_get_arg1(icall));
     469        if (fun == NULL) {
     470                fibril_rwlock_read_unlock(&device_tree.rwlock);
     471                async_answer_0(icall, ENOENT);
     472                return;
     473        }
     474
     475        if (fun->child == NULL) {
     476                fibril_rwlock_read_unlock(&device_tree.rwlock);
     477                fun_del_ref(fun);
     478                async_answer_0(icall, EOK);
     479                return;
     480        }
     481
     482        dev = fun->child;
     483        dev_add_ref(dev);
     484
     485        fibril_rwlock_read_unlock(&device_tree.rwlock);
     486
     487        dev_wait_stable(dev);
     488        dev_del_ref(dev);
     489
    455490        async_answer_0(icall, EOK);
    456491}
     
    642677                        devman_drv_fun_offline(&call, driver);
    643678                        break;
     679                case DEVMAN_DRV_FUN_WAIT_STABLE:
     680                        devman_drv_fun_wait_stable(&call, driver);
     681                        break;
    644682                case DEVMAN_REMOVE_FUNCTION:
    645683                        devman_remove_function(&call);
Note: See TracChangeset for help on using the changeset viewer.