Skip to content

Commit

Permalink
[PATCH] Use driver_for_each_device() in drivers/pnp/driver.c instead …
Browse files Browse the repository at this point in the history
…of manually walking list.

Signed-off-by: Patrick Mochel <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

diff -Nru a/drivers/pnp/driver.c b/drivers/pnp/driver.c
  • Loading branch information
[email protected] authored and gregkh committed Jun 20, 2005
1 parent fae3cd0 commit 8d618af
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions drivers/pnp/driver.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand All @@ -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;
}
Expand Down

0 comments on commit 8d618af

Please sign in to comment.