source: rtems/cpukit/libdrvmgr/drvmgr_dev_by_name.c @ a7e8996

5
Last change on this file since a7e8996 was a7e8996, checked in by Sebastian Huber <sebastian.huber@…>, on Dec 21, 2018 at 8:09:53 PM

drvmgr: Improve LP64 compatibility

  • Property mode set to 100644
File size: 729 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 intptr_t 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 (intptr_t)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.