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

4.115
Last change on this file since eff69891 was 65d1f35, checked in by Daniel Hellstrom <daniel@…>, on 02/27/15 at 15:42:36

DRVMGR: updated copyright into one line only

  • Property mode set to 100644
File size: 835 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.com/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 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.