summaryrefslogtreecommitdiffstats
path: root/drivers/pnp/driver.c
diff options
context:
space:
mode:
authormochel@digitalimplant.org <mochel@digitalimplant.org>2005-03-21 20:07:54 +0100
committerGreg Kroah-Hartman <gregkh@suse.de>2005-06-21 00:15:13 +0200
commit8d618afdd61ccaacbab4976a556c0ddcf36e2d8a (patch)
treeabe9d05aacee69b9b59375e867db295982222e65 /drivers/pnp/driver.c
parent[PATCH] Add driver_for_each_device(). (diff)
downloadlinux-8d618afdd61ccaacbab4976a556c0ddcf36e2d8a.tar.xz
linux-8d618afdd61ccaacbab4976a556c0ddcf36e2d8a.zip
[PATCH] Use driver_for_each_device() in drivers/pnp/driver.c instead of manually walking list.
Signed-off-by: Patrick Mochel <mochel@digitalimplant.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> diff -Nru a/drivers/pnp/driver.c b/drivers/pnp/driver.c
Diffstat (limited to 'drivers/pnp/driver.c')
-rw-r--r--drivers/pnp/driver.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/drivers/pnp/driver.c b/drivers/pnp/driver.c
index d64c1ca4fa76..1d037c2a82ac 100644
--- a/drivers/pnp/driver.c
+++ b/drivers/pnp/driver.c
@@ -160,10 +160,16 @@ struct bus_type pnp_bus_type = {
};
+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 @@ int pnp_register_driver(struct pnp_driver *drv)
/* 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;
}