chiark / gitweb /
[PATCH] udev kill extra bus_id compares in match_id
authorpatmans@us.ibm.com <patmans@us.ibm.com>
Thu, 12 Feb 2004 09:24:54 +0000 (01:24 -0800)
committerGreg KH <gregkh@suse.de>
Wed, 27 Apr 2005 04:32:26 +0000 (21:32 -0700)
Kill the extra bus_id check in match_id. This is wrong, especially since
we check for rule matches with the parent devices on a given devices path.

For example, given a device path of:

/sys/devices/pci0000:01/0000:01:0c.0/host5/5:0:2:0

With this patch, the following rule will no longer match:

BUS="scsi", ID="host5", NAME="sd-bus_id-host5"

namedev.c

index 3e2182ae7b8f7c3678bc66f966409f3b8ae24476..59ec08c715e58bdc92a52f669ecc86b8845e6e1e 100644 (file)
--- a/namedev.c
+++ b/namedev.c
@@ -469,32 +469,19 @@ static int match_sysfs_pairs(struct config_device *dev, struct sysfs_class_devic
 static int match_id(struct config_device *dev, struct sysfs_class_device *class_dev, struct sysfs_device *sysfs_device)
 {
        char path[SYSFS_PATH_MAX];
-       int found;
        char *temp = NULL;
 
        /* we have to have a sysfs device for ID to work */
        if (!sysfs_device)
                return -ENODEV;
 
-       found = 0;
        strfieldcpy(path, sysfs_device->path);
        temp = strrchr(path, '/');
        dbg("search '%s' in '%s', path='%s'", dev->id, temp, path);
-       if (strstr(temp, dev->id) != NULL) {
-               found = 1;
-       } else {
-               *temp = 0x00;
-               temp = strrchr(path, '/');
-               dbg("search '%s' in '%s', path='%s'", dev->id, temp, path);
-               if (strstr(temp, dev->id) != NULL)
-                       found = 1;
-       }
-       if (!found) {
-               dbg("id doesn't match");
+       if (strstr(temp, dev->id) == NULL)
                return -ENODEV;
-       }
-
-       return 0;
+       else
+               return 0;
 }
 
 static int match_place(struct config_device *dev, struct sysfs_class_device *class_dev, struct sysfs_device *sysfs_device)