5
Rev | Line | |
---|
[e7fade3] | 1 | /* Iterate over one list of devices used internally by driver manager |
---|
| 2 | * |
---|
[65d1f35] | 3 | * COPYRIGHT (c) 2009 Cobham Gaisler AB. |
---|
[e7fade3] | 4 | * |
---|
| 5 | * The license and distribution terms for this file may be |
---|
| 6 | * found in the file LICENSE in this distribution or at |
---|
[0decc806] | 7 | * http://www.rtems.org/license/LICENSE. |
---|
[e7fade3] | 8 | */ |
---|
| 9 | |
---|
| 10 | #include <drvmgr/drvmgr.h> |
---|
| 11 | #include <drvmgr/drvmgr_list.h> |
---|
| 12 | #include "drvmgr_internal.h" |
---|
| 13 | |
---|
| 14 | int drvmgr_for_each_listdev( |
---|
| 15 | struct drvmgr_list *devlist, |
---|
| 16 | unsigned int state_set_mask, |
---|
| 17 | unsigned int state_clr_mask, |
---|
| 18 | int (*func)(struct drvmgr_dev *dev, void *arg), |
---|
| 19 | void *arg |
---|
| 20 | ) |
---|
| 21 | { |
---|
| 22 | struct drvmgr_dev *dev; |
---|
| 23 | int ret = 0; |
---|
| 24 | |
---|
| 25 | DRVMGR_LOCK_READ(); |
---|
| 26 | |
---|
| 27 | /* Get First Device */ |
---|
| 28 | dev = DEV_LIST_HEAD(devlist); |
---|
| 29 | while (dev) { |
---|
| 30 | if (((state_set_mask != 0) && ((dev->state & state_set_mask) == state_set_mask)) || |
---|
| 31 | ((state_clr_mask != 0) && ((dev->state & state_clr_mask) == 0)) || |
---|
| 32 | ((state_set_mask == 0) && (state_clr_mask == 0))) { |
---|
| 33 | ret = func(dev, arg); |
---|
| 34 | if (ret != 0) |
---|
| 35 | break; |
---|
| 36 | } |
---|
| 37 | dev = dev->next; |
---|
| 38 | } |
---|
| 39 | |
---|
| 40 | DRVMGR_UNLOCK(); |
---|
| 41 | |
---|
| 42 | return ret; |
---|
| 43 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.