diff options
author | mochel@digitalimplant.org <mochel@digitalimplant.org> | 2005-03-21 14:07:54 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2005-06-20 18:15:13 -0400 |
commit | 8d618afdd61ccaacbab4976a556c0ddcf36e2d8a (patch) | |
tree | abe9d05aacee69b9b59375e867db295982222e65 /drivers | |
parent | fae3cd00255e3e51ffd59fedb1bdb91ec96be395 (diff) |
[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')
-rw-r--r-- | drivers/pnp/driver.c | 12 |
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 = { | |||
160 | }; | 160 | }; |
161 | 161 | ||
162 | 162 | ||
163 | static int count_devices(struct device * dev, void * c) | ||
164 | { | ||
165 | int * count = c; | ||
166 | (*count)++; | ||
167 | return 0; | ||
168 | } | ||
169 | |||
163 | int pnp_register_driver(struct pnp_driver *drv) | 170 | int pnp_register_driver(struct pnp_driver *drv) |
164 | { | 171 | { |
165 | int count; | 172 | int count; |
166 | struct list_head *pos; | ||
167 | 173 | ||
168 | pnp_dbg("the driver '%s' has been registered", drv->name); | 174 | pnp_dbg("the driver '%s' has been registered", drv->name); |
169 | 175 | ||
@@ -177,9 +183,7 @@ int pnp_register_driver(struct pnp_driver *drv) | |||
177 | /* get the number of initial matches */ | 183 | /* get the number of initial matches */ |
178 | if (count >= 0){ | 184 | if (count >= 0){ |
179 | count = 0; | 185 | count = 0; |
180 | list_for_each(pos,&drv->driver.devices){ | 186 | driver_for_each_device(&drv->driver, NULL, &count, count_devices); |
181 | count++; | ||
182 | } | ||
183 | } | 187 | } |
184 | return count; | 188 | return count; |
185 | } | 189 | } |