File 0008-udev-path_id-skip-PCI-only-parents-for-block-devices.patch of Package udev

From 7fdd367e6d675d4546074c5dd35bf168d7c17339 Mon Sep 17 00:00:00 2001
From: Kay Sievers <kay@vrfy.org>
Date: Mon, 7 May 2012 18:47:58 +0200
Subject: [PATCH] udev: path_id - skip PCI-only-parents for block devices

Index: udev-182/src/udev-builtin-path_id.c
===================================================================
--- udev-182.orig/src/udev-builtin-path_id.c
+++ udev-182/src/udev-builtin-path_id.c
@@ -421,6 +421,7 @@ static int builtin_path_id(struct udev_d
 {
         struct udev_device *parent;
         char *path = NULL;
+        bool some_transport = false;
 
         /* S390 ccw bus */
         parent = udev_device_get_parent_with_subsystem_devtype(dev, "ccw", NULL);
@@ -441,10 +442,13 @@ static int builtin_path_id(struct udev_d
                         handle_scsi_tape(parent, &path);
                 } else if (strcmp(subsys, "scsi") == 0) {
                         parent = handle_scsi(parent, &path);
+                        some_transport = true;
                 } else if (strcmp(subsys, "cciss") == 0) {
                         parent = handle_cciss(parent, &path);
+                        some_transport = true;
                 } else if (strcmp(subsys, "usb") == 0) {
                         parent = handle_usb(parent, &path);
+                        some_transport = true;
                 } else if (strcmp(subsys, "serio") == 0) {
                         path_prepend(&path, "serio-%s", udev_device_get_sysnum(parent));
                         parent = skip_subsystem(parent, "serio");
@@ -467,6 +471,18 @@ static int builtin_path_id(struct udev_d
 
                 parent = udev_device_get_parent(parent);
         }
+
+        /*
+         * Do not return a single-parent-device-only for block
+         * devices, they might have entire buses behind it which
+         * do not get unique IDs only by using the parent device.
+         */
+        if (!some_transport && (strcmp(udev_device_get_subsystem(dev), "block") == 0)) {
+                free(path);
+                path = NULL;
+        }
+
+
 out:
         if (path != NULL) {
                 char tag[UTIL_NAME_SIZE];
openSUSE Build Service is sponsored by