]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/ieee1394/nodemgr.c
Driver Core: add ability for class_for_each_device to start in middle of list
[linux-2.6-omap-h63xx.git] / drivers / ieee1394 / nodemgr.c
index 511e4321c6b6220916a37b05c81d490bce9f4a47..47c0d85e0f32126bfdb65e92eb53e20242a0c7c4 100644 (file)
@@ -18,8 +18,8 @@
 #include <linux/moduleparam.h>
 #include <linux/mutex.h>
 #include <linux/freezer.h>
+#include <linux/semaphore.h>
 #include <asm/atomic.h>
-#include <asm/semaphore.h>
 
 #include "csr.h"
 #include "highlevel.h"
@@ -520,8 +520,11 @@ static ssize_t fw_show_drv_device_ids(struct device_driver *drv, char *buf)
        char *scratch = buf;
 
        driver = container_of(drv, struct hpsb_protocol_driver, driver);
+       id = driver->id_table;
+       if (!id)
+               return 0;
 
-       for (id = driver->id_table; id->match_flags != 0; id++) {
+       for (; id->match_flags != 0; id++) {
                int need_coma = 0;
 
                if (id->match_flags & IEEE1394_MATCH_VENDOR_ID) {
@@ -701,7 +704,11 @@ static int nodemgr_bus_match(struct device * dev, struct device_driver * drv)
                return 0;
 
        driver = container_of(drv, struct hpsb_protocol_driver, driver);
-       for (id = driver->id_table; id->match_flags != 0; id++) {
+       id = driver->id_table;
+       if (!id)
+               return 0;
+
+       for (; id->match_flags != 0; id++) {
                if ((id->match_flags & IEEE1394_MATCH_VENDOR_ID) &&
                    id->vendor_id != ud->vendor_id)
                        continue;
@@ -1446,7 +1453,8 @@ static void nodemgr_suspend_ne(struct node_entry *ne)
        ne->in_limbo = 1;
        WARN_ON(device_create_file(&ne->device, &dev_attr_ne_in_limbo));
 
-       class_for_each_device(&nodemgr_ud_class, ne, __nodemgr_driver_suspend);
+       class_for_each_device(&nodemgr_ud_class, NULL, ne,
+                             __nodemgr_driver_suspend);
 }
 
 
@@ -1455,7 +1463,8 @@ static void nodemgr_resume_ne(struct node_entry *ne)
        ne->in_limbo = 0;
        device_remove_file(&ne->device, &dev_attr_ne_in_limbo);
 
-       class_for_each_device(&nodemgr_ud_class, ne, __nodemgr_driver_resume);
+       class_for_each_device(&nodemgr_ud_class, NULL, ne,
+                             __nodemgr_driver_resume);
        HPSB_DEBUG("Node resumed: ID:BUS[" NODE_BUS_FMT "]  GUID[%016Lx]",
                   NODE_BUS_ARGS(ne->host, ne->nodeid), (unsigned long long)ne->guid);
 }
@@ -1491,7 +1500,8 @@ static int __nodemgr_update_pdrv(struct device *dev, void *data)
 
 static void nodemgr_update_pdrv(struct node_entry *ne)
 {
-       class_for_each_device(&nodemgr_ud_class, ne, __nodemgr_update_pdrv);
+       class_for_each_device(&nodemgr_ud_class, NULL, ne,
+                             __nodemgr_update_pdrv);
 }
 
 
@@ -1584,7 +1594,8 @@ static void nodemgr_node_probe(struct host_info *hi, int generation)
         * while probes are time-consuming. (Well, those probes need some
         * improvement...) */
 
-       class_for_each_device(&nodemgr_ne_class, &param, __nodemgr_node_probe);
+       class_for_each_device(&nodemgr_ne_class, NULL, &param,
+                             __nodemgr_node_probe);
 
        /* If we had a bus reset while we were scanning the bus, it is
         * possible that we did not probe all nodes.  In that case, we
@@ -1819,7 +1830,7 @@ int nodemgr_for_each_host(void *data, int (*cb)(struct hpsb_host *, void *))
 
        hip.cb = cb;
        hip.data = data;
-       error = class_for_each_device(&hpsb_host_class, &hip,
+       error = class_for_each_device(&hpsb_host_class, NULL, &hip,
                                      __nodemgr_for_each_host);
 
        return error;