[4/9] [RFC] Steps to fixing the driver model locking

From: Patrick Mochel
Date: Mon Mar 21 2005 - 16:44:41 EST



ChangeSet@xxxxxx, 2005-03-21 11:07:54-08:00, mochel@xxxxxxxxxxxxxxxxxx
[pnp] Use driver_for_each_device() in drivers/pnp/driver.c instead of manually walking list.



Signed-off-by: Patrick Mochel <mochel@xxxxxxxxxxxxxxxxxx>

diff -Nru a/drivers/pnp/driver.c b/drivers/pnp/driver.c
--- a/drivers/pnp/driver.c 2005-03-21 12:30:40 -08:00
+++ b/drivers/pnp/driver.c 2005-03-21 12:30:40 -08:00
@@ -160,10 +160,16 @@
};


+static int count_devices(struct device * dev, void * c)
+{
+ int * count = c;
+ (*count)++;
+ return 0;
+}
+
int pnp_register_driver(struct pnp_driver *drv)
{
int count;
- struct list_head *pos;

pnp_dbg("the driver '%s' has been registered", drv->name);

@@ -177,9 +183,7 @@
/* get the number of initial matches */
if (count >= 0){
count = 0;
- list_for_each(pos,&drv->driver.devices){
- count++;
- }
+ driver_for_each_device(&drv->driver, NULL, &count, count_devices);
}
return count;
}
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/