Staging: vme: Extend VME core probing for special matches
authorMartyn Welch <martyn.welch@gefanuc.com>
Thu, 6 Aug 2009 08:43:07 +0000 (09:43 +0100)
committerGreg Kroah-Hartman <gregkh@suse.de>
Tue, 15 Sep 2009 19:02:10 +0000 (12:02 -0700)
Add the ability to define all slots and current slot in the VME buses bind
table.

Signed-off-by: Martyn Welch <martyn.welch@gefanuc.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/staging/vme/vme.c
drivers/staging/vme/vme.h

index 8ee11925b19b38b2bc7c19329ce3257daad6fe08..d6ad12e3cb546493c9f0bb2b17f1585e8ea41fce 100644 (file)
@@ -1302,9 +1302,17 @@ static int vme_bus_match(struct device *dev, struct device_driver *drv)
        while((driver->bind_table[i].bus != 0) ||
                (driver->bind_table[i].slot != 0)) {
 
-               if ((bridge->num == driver->bind_table[i].bus) &&
-                       (num == driver->bind_table[i].slot))
-                       return 1;
+               if (bridge->num == driver->bind_table[i].bus) {
+                       if (num == driver->bind_table[i].slot)
+                               return 1;
+
+                       if (driver->bind_table[i].slot == VME_SLOT_ALL)
+                               return 1;
+
+                       if ((driver->bind_table[i].slot == VME_SLOT_CURRENT) &&
+                               (num == vme_slot_get(dev)))
+                               return 1;
+               }
                i++;
        }
 
index 5291782a71eb350c2cdf85adcafd0cf341f56252..a092138e3a7392b7f8f0460b5f9075cf1b624d80 100644 (file)
@@ -79,6 +79,9 @@ struct vme_resource {
 
 extern struct bus_type vme_bus_type;
 
+#define VME_SLOT_CURRENT       -1
+#define VME_SLOT_ALL           -2
+
 struct vme_device_id {
        int bus;
        int slot;