source: rtems/cpukit/libdrvmgr/drvmgr_by_id.c @ 7075fb11

Last change on this file since 7075fb11 was bb2f220, checked in by Daniel Hellstrom <daniel@…>, on Apr 13, 2015 at 8:49:47 AM

DRVMGR: renamed private drv_mgr and its struct name

  • Property mode set to 100644
File size: 737 bytes
Line 
1/* Find driver by driver-ID
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 <drvmgr/drvmgr.h>
11#include "drvmgr_internal.h"
12
13/* Get driver from driver name */
14struct drvmgr_drv *drvmgr_drv_by_id(uint64_t id)
15{
16        struct drvmgr *mgr = &drvmgr;
17        struct drvmgr_drv *drv = NULL;
18
19        /* NOTE: No locking is needed here since Driver list is supposed to be
20         *       initialized once during startup, we treat it as a static
21         *       read-only list
22         */
23
24        drv = DRV_LIST_HEAD(&mgr->drivers);
25        while (drv) {
26                if (drv->drv_id == id)
27                        break;
28                drv = drv->next;
29        }
30
31        return drv;
32}
Note: See TracBrowser for help on using the repository browser.