source: rtems/cpukit/libdrvmgr/drvmgr_by_name.c @ 30594a9

4.115
Last change on this file since 30594a9 was e7fade3, checked in by Daniel Hellstrom <daniel@…>, on 11/28/11 at 08:52:03

DRVMGR: added driver manager to cpukit/libdrvmgr

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