[PATCH] Use driver_for_each_device() in drivers/pnp/driver.c instead of manually walking list.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



[PATCH] Use driver_for_each_device() in drivers/pnp/driver.c instead 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

---
commit 8d618afdd61ccaacbab4976a556c0ddcf36e2d8a
tree abe9d05aacee69b9b59375e867db295982222e65
parent fae3cd00255e3e51ffd59fedb1bdb91ec96be395
author [email protected] <[email protected]> Mon, 21 Mar 2005 11:07:54 -0800
committer Greg Kroah-Hartman <[email protected]> Mon, 20 Jun 2005 15:15:13 -0700

 drivers/pnp/driver.c |   12 ++++++++----
 1 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/drivers/pnp/driver.c b/drivers/pnp/driver.c
--- 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_drive
 	/* 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 [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux