summaryrefslogtreecommitdiffstats
path: root/cpukit/libdrvmgr
diff options
context:
space:
mode:
authorDaniel Hellstrom <daniel@gaisler.com>2015-04-13 12:58:37 +0200
committerDaniel Hellstrom <daniel@gaisler.com>2015-04-17 01:10:30 +0200
commit4c9c46df76a78b53ba8a47cdbb5b0e8c9d11bc6e (patch)
treeb80bb46ef0e4f8486257ec85c0a0af88eefcebd5 /cpukit/libdrvmgr
parentDRVMGR: renamed RES_EMPTY to DRVMGR_RES_EMPTY (diff)
downloadrtems-4c9c46df76a78b53ba8a47cdbb5b0e8c9d11bc6e.tar.bz2
DRVMGR: clean-up DRV_OPS_NUM
Diffstat (limited to 'cpukit/libdrvmgr')
-rw-r--r--cpukit/libdrvmgr/drvmgr.h2
-rw-r--r--cpukit/libdrvmgr/drvmgr_print.c5
2 files changed, 4 insertions, 3 deletions
diff --git a/cpukit/libdrvmgr/drvmgr.h b/cpukit/libdrvmgr/drvmgr.h
index 9e491f8dd5..ca52b3be1b 100644
--- a/cpukit/libdrvmgr/drvmgr.h
+++ b/cpukit/libdrvmgr/drvmgr.h
@@ -294,7 +294,7 @@ struct drvmgr_drv_ops {
int (*remove)(struct drvmgr_dev *); /*! Function called when device instance is to be removed */
int (*info)(struct drvmgr_dev *, void (*print)(void *p, char *str), void *p, int, char *argv[]);/*! Function called to request information about a device or driver */
};
-#define DRV_OPS_NUM (sizeof(struct drvmgr_drv_ops)/sizeof(void (*)(void)))
+#define DRVMGR_OPS_NUM(x) (sizeof(x)/sizeof(void (*)(void)))
/*! Device driver description */
struct drvmgr_drv {
diff --git a/cpukit/libdrvmgr/drvmgr_print.c b/cpukit/libdrvmgr/drvmgr_print.c
index aecf41c641..2b7a2e538e 100644
--- a/cpukit/libdrvmgr/drvmgr_print.c
+++ b/cpukit/libdrvmgr/drvmgr_print.c
@@ -334,7 +334,7 @@ void drvmgr_info_bus(struct drvmgr_bus *bus, unsigned int options)
}
}
-char *drv_ops_names[DRV_OPS_NUM] = {
+char *drv_ops_names[DRVMGR_OPS_NUM(struct drvmgr_drv_ops)] = {
"init[1]:",
"init[2]:",
"init[3]:",
@@ -355,7 +355,8 @@ void drvmgr_info_drv(struct drvmgr_drv *drv, unsigned int options)
printf(" NAME: %s\n", drv->name ? drv->name : "NO_NAME");
printf(" BUS TYPE: %d\n", drv->bus_type);
printf(" OPERATIONS:\n");
- for (i = 0, ppfunc = (fun_ptr *)&drv->ops->init[0]; i<DRV_OPS_NUM; i++)
+ for (i = 0, ppfunc = (fun_ptr *)&drv->ops->init[0];
+ i < DRVMGR_OPS_NUM(struct drvmgr_drv_ops); i++)
printf(" %s %p\n", drv_ops_names[i], ppfunc[i]);
printf(" NO. DEVICES: %d\n", drv->dev_cnt);