[PATCH 32/42] DRVMGR: renamed private drv_mgr and its struct name

Daniel Hellstrom daniel at gaisler.com
Tue Apr 14 11:32:59 UTC 2015


---
 cpukit/libdrvmgr/drvmgr.c              |   26 +++++++++++++-------------
 cpukit/libdrvmgr/drvmgr_by_id.c        |    2 +-
 cpukit/libdrvmgr/drvmgr_by_name.c      |    2 +-
 cpukit/libdrvmgr/drvmgr_for_each_dev.c |    8 ++++----
 cpukit/libdrvmgr/drvmgr_internal.h     |    4 ++--
 cpukit/libdrvmgr/drvmgr_lock.c         |    6 +++---
 cpukit/libdrvmgr/drvmgr_print.c        |   12 ++++++------
 cpukit/libdrvmgr/drvmgr_translate.c    |    4 ++--
 cpukit/libdrvmgr/drvmgr_unregister.c   |    6 +++---
 9 files changed, 35 insertions(+), 35 deletions(-)

diff --git a/cpukit/libdrvmgr/drvmgr.c b/cpukit/libdrvmgr/drvmgr.c
index f032e4c..7e669b4 100644
--- a/cpukit/libdrvmgr/drvmgr.c
+++ b/cpukit/libdrvmgr/drvmgr.c
@@ -25,7 +25,7 @@
 #define DBG(x...)
 #endif
 
-struct rtems_driver_manager drv_mgr = {
+struct drvmgr drvmgr = {
 	.level =		0,
 	.initializing_objs =	0,
 	.lock =                 0,
@@ -54,11 +54,11 @@ struct rtems_driver_manager drv_mgr = {
 };
 
 static int do_bus_init(
-	struct rtems_driver_manager *mgr,
+	struct drvmgr *mgr,
 	struct drvmgr_bus *bus,
 	int level);
 static int do_dev_init(
-	struct rtems_driver_manager *mgr,
+	struct drvmgr *mgr,
 	struct drvmgr_dev *dev,
 	int level);
 
@@ -66,7 +66,7 @@ static int do_dev_init(
 
 void _DRV_Manager_init_level(int level)
 {
-	struct rtems_driver_manager *mgr = &drv_mgr;
+	struct drvmgr *mgr = &drvmgr;
 
 	if (mgr->level >= level)
 		return;
@@ -85,7 +85,7 @@ void _DRV_Manager_initialization(void)
 {
 	struct drvmgr_drv_reg_func *drvreg;
 
-	/* drv_mgr is already initialized statically by compiler except
+	/* drvmgr is already initialized statically by compiler except
 	 * the lock
 	 */
 	DRVMGR_LOCK_INIT();
@@ -105,7 +105,7 @@ void _DRV_Manager_initialization(void)
  */
 void drvmgr_init_update(void)
 {
-	struct rtems_driver_manager *mgr = &drv_mgr;
+	struct drvmgr *mgr = &drvmgr;
 	struct drvmgr_bus *bus;
 	struct drvmgr_dev *dev;
 	int bus_might_been_registered;
@@ -183,7 +183,7 @@ out:
 
 /* Take bus into next level */
 static int do_bus_init(
-	struct rtems_driver_manager *mgr,
+	struct drvmgr *mgr,
 	struct drvmgr_bus *bus,
 	int level)
 {
@@ -242,7 +242,7 @@ inactivate_out:
 
 /* Take device to initialization level 1 */
 static int do_dev_init(
-	struct rtems_driver_manager *mgr,
+	struct drvmgr *mgr,
 	struct drvmgr_dev *dev,
 	int level)
 {
@@ -317,7 +317,7 @@ inactivate_out:
 /* Register Root device driver */
 int drvmgr_root_drv_register(struct drvmgr_drv *drv)
 {
-	struct rtems_driver_manager *mgr = &drv_mgr;
+	struct drvmgr *mgr = &drvmgr;
 	struct drvmgr_dev *root = &mgr->root_dev;
 
 	if (mgr->root_drv) {
@@ -346,7 +346,7 @@ int drvmgr_root_drv_register(struct drvmgr_drv *drv)
 /* Register a driver */
 int drvmgr_drv_register(struct drvmgr_drv *drv)
 {
-	struct rtems_driver_manager *mgr = &drv_mgr;
+	struct drvmgr *mgr = &drvmgr;
 
 	/* All drivers must have been registered before start of init, 
 	 * because the manager does not scan all existing devices to find
@@ -454,7 +454,7 @@ static void drvmgr_insert_dev_into_bus(
 static struct drvmgr_drv *drvmgr_dev_find_drv(
 		struct drvmgr_dev *dev)
 {
-	struct rtems_driver_manager *mgr = &drv_mgr;
+	struct drvmgr *mgr = &drvmgr;
 	struct drvmgr_drv *drv;
 
 	/* NOTE: No locking is needed here since Driver list is supposed to be
@@ -473,7 +473,7 @@ static struct drvmgr_drv *drvmgr_dev_find_drv(
 /* Register a device */
 int drvmgr_dev_register(struct drvmgr_dev *dev)
 {
-	struct rtems_driver_manager *mgr = &drv_mgr;
+	struct drvmgr *mgr = &drvmgr;
 	struct drvmgr_drv *drv;
 	struct drvmgr_bus *bus = dev->parent;
 	struct drvmgr_key *keys;
@@ -568,7 +568,7 @@ int drvmgr_dev_register(struct drvmgr_dev *dev)
 /* Register a bus */
 int drvmgr_bus_register(struct drvmgr_bus *bus)
 {
-	struct rtems_driver_manager *mgr = &drv_mgr;
+	struct drvmgr *mgr = &drvmgr;
 	struct drvmgr_bus *bus_up;
 
 	/* Get bus architecture depth - the distance from root bus */
diff --git a/cpukit/libdrvmgr/drvmgr_by_id.c b/cpukit/libdrvmgr/drvmgr_by_id.c
index e1bd4e8..84164e3 100644
--- a/cpukit/libdrvmgr/drvmgr_by_id.c
+++ b/cpukit/libdrvmgr/drvmgr_by_id.c
@@ -13,7 +13,7 @@
 /* Get driver from driver name */
 struct drvmgr_drv *drvmgr_drv_by_id(uint64_t id)
 {
-	struct rtems_driver_manager *mgr = &drv_mgr;
+	struct drvmgr *mgr = &drvmgr;
 	struct drvmgr_drv *drv = NULL;
 
 	/* NOTE: No locking is needed here since Driver list is supposed to be
diff --git a/cpukit/libdrvmgr/drvmgr_by_name.c b/cpukit/libdrvmgr/drvmgr_by_name.c
index ebf7750..b095589 100644
--- a/cpukit/libdrvmgr/drvmgr_by_name.c
+++ b/cpukit/libdrvmgr/drvmgr_by_name.c
@@ -14,7 +14,7 @@
 /* Get driver from driver name */
 struct drvmgr_drv *drvmgr_drv_by_name(const char *name)
 {
-	struct rtems_driver_manager *mgr = &drv_mgr;
+	struct drvmgr *mgr = &drvmgr;
 	struct drvmgr_drv *drv = NULL;
 
 	if (!name)
diff --git a/cpukit/libdrvmgr/drvmgr_for_each_dev.c b/cpukit/libdrvmgr/drvmgr_for_each_dev.c
index 2646507..a1c2899 100644
--- a/cpukit/libdrvmgr/drvmgr_for_each_dev.c
+++ b/cpukit/libdrvmgr/drvmgr_for_each_dev.c
@@ -24,7 +24,7 @@ static int drvmgr_for_each_dev_breadth(
 
 	pos = 0;
 	memset(&buses[0], 0, sizeof(buses));
-	buses[pos++] = drv_mgr.root_dev.bus; 	/* Get root bus */
+	buses[pos++] = drvmgr.root_dev.bus; 	/* Get root bus */
 
 	for (i = 0, bus = buses[0]; buses[i]; i++, bus = buses[i]) {
 		dev = bus->children;
@@ -52,7 +52,7 @@ static int drvmgr_for_each_dev_depth(
 	struct drvmgr_dev *dev;
 
 	/* Get first device */
-	dev = drv_mgr.root_dev.bus->children;
+	dev = drvmgr.root_dev.bus->children;
 
 	while (dev) {
 		ret = func(dev, arg);
@@ -65,7 +65,7 @@ next_dev:
 			if (dev->next_in_bus == NULL) {
 				/* Step up one level... back to parent bus */
 				dev = dev->parent->dev;
-				if (dev == &drv_mgr.root_dev)
+				if (dev == &drvmgr.root_dev)
 					break;
 				goto next_dev;
 			} else {
@@ -89,7 +89,7 @@ int drvmgr_for_each_dev(
 	DRVMGR_LOCK_READ();
 
 	/* Get Root Device */
-	if (drv_mgr.root_dev.bus->children != NULL) {
+	if (drvmgr.root_dev.bus->children != NULL) {
 		if (options & DRVMGR_FED_BF)
 			ret = drvmgr_for_each_dev_breadth(func, arg);
 		else
diff --git a/cpukit/libdrvmgr/drvmgr_internal.h b/cpukit/libdrvmgr/drvmgr_internal.h
index 6c4b24f..5061d92 100644
--- a/cpukit/libdrvmgr/drvmgr_internal.h
+++ b/cpukit/libdrvmgr/drvmgr_internal.h
@@ -10,7 +10,7 @@
 /*  Structure hold all information the driver manager needs to know of. Used
  *  internally by Driver Manager routines.
  */
-struct rtems_driver_manager {
+struct drvmgr {
 	int	level;
 	int	initializing_objs;
 
@@ -45,7 +45,7 @@ struct rtems_driver_manager {
 	struct drvmgr_list	devices_inactive;
 };
 
-extern struct rtems_driver_manager drv_mgr;
+extern struct drvmgr drvmgr;
 
 extern void _DRV_Manager_Lock(void);
 extern void _DRV_Manager_Unlock(void);
diff --git a/cpukit/libdrvmgr/drvmgr_lock.c b/cpukit/libdrvmgr/drvmgr_lock.c
index b5181c1..1961330 100644
--- a/cpukit/libdrvmgr/drvmgr_lock.c
+++ b/cpukit/libdrvmgr/drvmgr_lock.c
@@ -13,12 +13,12 @@
 
 void _DRV_Manager_Lock(void)
 {
-	rtems_semaphore_obtain(drv_mgr.lock, RTEMS_WAIT, RTEMS_NO_TIMEOUT);
+	rtems_semaphore_obtain(drvmgr.lock, RTEMS_WAIT, RTEMS_NO_TIMEOUT);
 }
 
 void _DRV_Manager_Unlock(void)
 {
-	rtems_semaphore_release(drv_mgr.lock);
+	rtems_semaphore_release(drvmgr.lock);
 }
 
 int _DRV_Manager_Init_Lock(void)
@@ -30,7 +30,7 @@ int _DRV_Manager_Init_Lock(void)
 		1,
 		RTEMS_DEFAULT_ATTRIBUTES,
 		0,
-		&drv_mgr.lock);
+		&drvmgr.lock);
 	if (rc != RTEMS_SUCCESSFUL)
 		return -1;
 	return 0;
diff --git a/cpukit/libdrvmgr/drvmgr_print.c b/cpukit/libdrvmgr/drvmgr_print.c
index 80c1e6b..206b9fe 100644
--- a/cpukit/libdrvmgr/drvmgr_print.c
+++ b/cpukit/libdrvmgr/drvmgr_print.c
@@ -39,7 +39,7 @@ static int print_dev_found(struct drvmgr_dev *dev, void *arg)
 
 void drvmgr_print_devs(unsigned int options)
 {
-	struct rtems_driver_manager *mgr = &drv_mgr;
+	struct drvmgr *mgr = &drvmgr;
 	char *parg;
 
 	/* Print Drivers */
@@ -104,7 +104,7 @@ void drvmgr_print_topo(void)
 /* Print the memory usage */
 void drvmgr_print_mem(void)
 {
-	struct rtems_driver_manager *mgr = &drv_mgr;
+	struct drvmgr *mgr = &drvmgr;
 	struct drvmgr_bus *bus;
 	struct drvmgr_dev *dev;
 	struct drvmgr_drv *drv;
@@ -180,7 +180,7 @@ void drvmgr_print_mem(void)
 /* Print the memory usage */
 void drvmgr_summary(void)
 {
-	struct rtems_driver_manager *mgr = &drv_mgr;
+	struct drvmgr *mgr = &drvmgr;
 	struct drvmgr_bus *bus;
 	struct drvmgr_dev *dev;
 	struct drvmgr_drv *drv;
@@ -420,7 +420,7 @@ void drvmgr_info_devs_on_bus(struct drvmgr_bus *bus, unsigned int options)
 
 void drvmgr_info_devs(unsigned int options)
 {
-	struct rtems_driver_manager *mgr = &drv_mgr;
+	struct drvmgr *mgr = &drvmgr;
 	struct drvmgr_dev *dev;
 
 	/* Print device information of all devices and their child devices */
@@ -431,7 +431,7 @@ void drvmgr_info_devs(unsigned int options)
 
 void drvmgr_info_drvs(unsigned int options)
 {
-	struct rtems_driver_manager *mgr = &drv_mgr;
+	struct drvmgr *mgr = &drvmgr;
 	struct drvmgr_drv *drv;
 
 	drv = DRV_LIST_HEAD(&mgr->drivers);
@@ -444,7 +444,7 @@ void drvmgr_info_drvs(unsigned int options)
 
 void drvmgr_info_buses(unsigned int options)
 {
-	struct rtems_driver_manager *mgr = &drv_mgr;
+	struct drvmgr *mgr = &drvmgr;
 	struct drvmgr_bus *bus;
 
 	bus = BUS_LIST_HEAD(&mgr->buses[DRVMGR_LEVEL_MAX]);
diff --git a/cpukit/libdrvmgr/drvmgr_translate.c b/cpukit/libdrvmgr/drvmgr_translate.c
index a512862..e12546a 100644
--- a/cpukit/libdrvmgr/drvmgr_translate.c
+++ b/cpukit/libdrvmgr/drvmgr_translate.c
@@ -137,11 +137,11 @@ unsigned int drvmgr_translate(
 
 	rev = (~options) & 1;
 	if ((options == CPUMEM_TO_DMA) || (options == DMAMEM_FROM_CPU)) {
-		from = drv_mgr.root_dev.bus;
+		from = drvmgr.root_dev.bus;
 		to = dev->parent;
 	} else { /* CPUMEM_FROM_DMA || DMAMEM_TO_CPU */
 		from = dev->parent;
-		to = drv_mgr.root_dev.bus;
+		to = drvmgr.root_dev.bus;
 	}
 
 	return drvmgr_translate_bus(from, to, rev, src_address, dst_address);
diff --git a/cpukit/libdrvmgr/drvmgr_unregister.c b/cpukit/libdrvmgr/drvmgr_unregister.c
index c243c0b..47ad3b7 100644
--- a/cpukit/libdrvmgr/drvmgr_unregister.c
+++ b/cpukit/libdrvmgr/drvmgr_unregister.c
@@ -42,7 +42,7 @@ int drvmgr_children_unregister(struct drvmgr_bus *bus)
  */
 int drvmgr_bus_unregister(struct drvmgr_bus *bus)
 {
-	struct rtems_driver_manager *mgr = &drv_mgr;
+	struct drvmgr *mgr = &drvmgr;
 	struct drvmgr_list *list;
 
 	if (bus->ops->remove == NULL)
@@ -78,7 +78,7 @@ int drvmgr_bus_unregister(struct drvmgr_bus *bus)
 /* Separate Driver and Device from each other */
 int drvmgr_dev_drv_separate(struct drvmgr_dev *dev)
 {
-	struct rtems_driver_manager *mgr = &drv_mgr;
+	struct drvmgr *mgr = &drvmgr;
 	struct drvmgr_dev *subdev, **pprev;
 	int rc;
 
@@ -149,7 +149,7 @@ int drvmgr_dev_drv_separate(struct drvmgr_dev *dev)
  */
 int drvmgr_dev_unregister(struct drvmgr_dev *dev)
 {
-	struct rtems_driver_manager *mgr = &drv_mgr;
+	struct drvmgr *mgr = &drvmgr;
 	struct drvmgr_dev *subdev, **pprev;
 	int err;
 
-- 
1.7.0.4




More information about the devel mailing list