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
 };
 
 
+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);
 
        /* 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;
 }