source: rtems/cpukit/libdrvmgr/drvmgr_dev_by_name.c @ 5823bae8

4.115
Last change on this file since 5823bae8 was e7fade3, checked in by Daniel Hellstrom <daniel@…>, on Nov 28, 2011 at 8:52:03 AM

DRVMGR: added driver manager to cpukit/libdrvmgr

  • Property mode set to 100644
File size: 723 bytes
Line 
1/* Find device by device 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
12#include <string.h>
13#include <drvmgr/drvmgr.h>
14#include "drvmgr_internal.h"
15
16static int dev_name_compare(struct drvmgr_dev *dev, void *arg)
17{
18        const char *name = arg;
19
20        if (dev->name && (strcmp(dev->name, name) == 0))
21                return (int)dev;
22        else
23                return 0;
24}
25
26/* Get device by device name or bus name */
27struct drvmgr_dev *drvmgr_dev_by_name(const char *name)
28{
29        if (!name)
30                return NULL;
31
32        return (struct drvmgr_dev *)
33                drvmgr_for_each_dev(dev_name_compare, (void *)name, 0);
34}
Note: See TracBrowser for help on using the repository browser.