source: rtems/cpukit/libdrvmgr/drvmgr_by_name.c @ c130387

5
Last change on this file since c130387 was bb2f220, checked in by Daniel Hellstrom <daniel@…>, on 04/13/15 at 08:49:47

DRVMGR: renamed private drv_mgr and its struct name

  • Property mode set to 100644
File size: 820 bytes
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 */
15struct drvmgr_drv *drvmgr_drv_by_name(const char *name)
16{
17        struct drvmgr *mgr = &drvmgr;
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.