From 4c9c46df76a78b53ba8a47cdbb5b0e8c9d11bc6e Mon Sep 17 00:00:00 2001 From: Daniel Hellstrom Date: Mon, 13 Apr 2015 12:58:37 +0200 Subject: DRVMGR: clean-up DRV_OPS_NUM --- cpukit/libdrvmgr/drvmgr.h | 2 +- cpukit/libdrvmgr/drvmgr_print.c | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) (limited to 'cpukit/libdrvmgr') 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]; iops->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); -- cgit v1.2.3