chiark / gitweb /
[PATCH] klibc: remove SCCS directories from the temporary klibc install
[elogind.git] / udev_rules.c
index 551c06131b43843d1ee4bf69f69c9736d169e500..3dc77855da29359f38b354236d92901c9d547877 100644 (file)
@@ -498,21 +498,6 @@ static int compare_sysfs_attribute(struct sysfs_class_device *class_dev, struct
        return 0;
 }
 
-static int match_id(struct udev_rule *rule, struct sysfs_device *sysfs_device)
-{
-       char path[PATH_SIZE];
-       char *temp;
-
-       strlcpy(path, sysfs_device->path, sizeof(path));
-       temp = strrchr(path, '/');
-       temp++;
-       dbg("search '%s' in '%s', path='%s'", rule->id, temp, path);
-       if (strcmp_pattern(rule->id, temp) != 0)
-               return -ENODEV;
-
-       return 0;
-}
-
 static int match_rule(struct udevice *udev, struct udev_rule *rule,
                      struct sysfs_class_device *class_dev, struct sysfs_device *sysfs_device)
 {
@@ -579,7 +564,7 @@ static int match_rule(struct udevice *udev, struct udev_rule *rule,
                if (rule->driver[0] != '\0') {
                        if (sysfs_device == NULL) {
                                dbg("device has no sysfs_device");
-                               goto try_parent;
+                               goto exit;
                        }
                        dbg("check for " KEY_DRIVER " rule->driver='%s' sysfs_device->driver_name='%s'",
                            rule->driver, sysfs_device->driver_name);
@@ -599,7 +584,7 @@ static int match_rule(struct udevice *udev, struct udev_rule *rule,
                if (rule->bus[0] != '\0') {
                        if (sysfs_device == NULL) {
                                dbg("device has no sysfs_device");
-                               goto try_parent;
+                               goto exit;
                        }
                        dbg("check for " KEY_BUS " rule->bus='%s' sysfs_device->bus='%s'",
                            rule->bus, sysfs_device->bus);
@@ -619,10 +604,10 @@ static int match_rule(struct udevice *udev, struct udev_rule *rule,
                if (rule->id[0] != '\0') {
                        if (sysfs_device == NULL) {
                                dbg("device has no sysfs_device");
-                               goto try_parent;
+                               goto exit;
                        }
                        dbg("check " KEY_ID);
-                       if (match_id(rule, sysfs_device) != 0) {
+                       if (strcmp_pattern(rule->id, sysfs_device->bus_id) != 0) {
                                dbg(KEY_ID " is not matching");
                                if (rule->id_operation != KEY_OP_NOMATCH)
                                        goto try_parent;
@@ -663,8 +648,8 @@ try_parent:
                sysfs_device = sysfs_get_device_parent(sysfs_device);
                if (sysfs_device == NULL)
                        goto exit;
-               dbg("sysfs_device->path='%s'", sysfs_device->path);
-               dbg("sysfs_device->bus_id='%s'", sysfs_device->bus_id);
+               dbg("look at sysfs_device->path='%s'", sysfs_device->path);
+               dbg("look at sysfs_device->bus_id='%s'", sysfs_device->bus_id);
        }
 
        /* execute external program */