source: rtems/cpukit/libdrvmgr/drvmgr_dev_by_name.c @ 0decc80

4.115
Last change on this file since 0decc80 was 0decc80, checked in by Daniel Hellstrom <daniel@…>, on Apr 9, 2015 at 2:09:13 PM

DRVMGR: updated license to rtems.org

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