4.115
Line | |
---|
1 | /* Find driver by driver-name |
---|
2 | * |
---|
3 | * COPYRIGHT (c) 2011 Cobham Gaisler AB. |
---|
4 | * |
---|
5 | * The license and distribution terms for this file may be |
---|
6 | * found in the file LICENSE in this distribution or at |
---|
7 | * http://www.rtems.org/license/LICENSE. |
---|
8 | */ |
---|
9 | |
---|
10 | #include <string.h> |
---|
11 | #include <drvmgr/drvmgr.h> |
---|
12 | #include "drvmgr_internal.h" |
---|
13 | |
---|
14 | /* Get driver from driver name */ |
---|
15 | struct drvmgr_drv *drvmgr_drv_by_name(const char *name) |
---|
16 | { |
---|
17 | struct rtems_driver_manager *mgr = &drv_mgr; |
---|
18 | struct drvmgr_drv *drv = NULL; |
---|
19 | |
---|
20 | if (!name) |
---|
21 | return NULL; |
---|
22 | |
---|
23 | /* NOTE: No locking is needed here since Driver list is supposed to be |
---|
24 | * initialized once during startup, we treat it as a static |
---|
25 | * read-only list |
---|
26 | */ |
---|
27 | |
---|
28 | drv = DRV_LIST_HEAD(&mgr->drivers); |
---|
29 | while (drv) { |
---|
30 | if (drv->name && (strcmp(drv->name, name) == 0)) |
---|
31 | break; |
---|
32 | drv = drv->next; |
---|
33 | } |
---|
34 | |
---|
35 | return drv; |
---|
36 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.