ryantimwilson / rpms / systemd

Forked from rpms/systemd a month ago
Clone
9fc0f6
From 8e98bfcd1771a460ccf99fa7df7d46cac2e1754a Mon Sep 17 00:00:00 2001
9fc0f6
From: Tom Gundersen <teg@jklm.no>
9fc0f6
Date: Sat, 26 Oct 2013 12:22:04 +0200
9fc0f6
Subject: [PATCH] udev-builtin: path_id - add support for bcma bus
9fc0f6
9fc0f6
This matches the bcma support in the network device naming.
9fc0f6
9fc0f6
Eventually wa want to make sure ID_PATH is equivalent to ID_NET_NAME_PATH,
9fc0f6
so we never need to match on the latter.
9fc0f6
---
9fc0f6
 src/udev/udev-builtin-path_id.c | 16 ++++++++++++++++
9fc0f6
 1 file changed, 16 insertions(+)
9fc0f6
9fc0f6
diff --git a/src/udev/udev-builtin-path_id.c b/src/udev/udev-builtin-path_id.c
9fc0f6
index 0659967..763f3c3 100644
9fc0f6
--- a/src/udev/udev-builtin-path_id.c
9fc0f6
+++ b/src/udev/udev-builtin-path_id.c
9fc0f6
@@ -452,6 +452,19 @@ static struct udev_device *handle_usb(struct udev_device *parent, char **path)
9fc0f6
         return parent;
9fc0f6
 }
9fc0f6
 
9fc0f6
+static struct udev_device *handle_bcma(struct udev_device *parent, char **path)
9fc0f6
+{
9fc0f6
+        const char *sysname;
9fc0f6
+        unsigned int core;
9fc0f6
+
9fc0f6
+        sysname = udev_device_get_sysname(parent);
9fc0f6
+        if (sscanf(sysname, "bcma%*u:%u", &core) != 1)
9fc0f6
+                return NULL;
9fc0f6
+
9fc0f6
+        path_prepend(path, "bcma-%u", core);
9fc0f6
+        return parent;
9fc0f6
+}
9fc0f6
+
9fc0f6
 static struct udev_device *handle_ccw(struct udev_device *parent, struct udev_device *dev, char **path)
9fc0f6
 {
9fc0f6
         struct udev_device *scsi_dev;
9fc0f6
@@ -509,6 +522,9 @@ static int builtin_path_id(struct udev_device *dev, int argc, char *argv[], bool
9fc0f6
                 } else if (streq(subsys, "usb")) {
9fc0f6
                         parent = handle_usb(parent, &path);
9fc0f6
                         some_transport = true;
9fc0f6
+                } else if (streq(subsys, "bcma")) {
9fc0f6
+                        parent = handle_bcma(parent, &path);
9fc0f6
+                        some_transport = true;
9fc0f6
                 } else if (streq(subsys, "serio")) {
9fc0f6
                         path_prepend(&path, "serio-%s", udev_device_get_sysnum(parent));
9fc0f6
                         parent = skip_subsystem(parent, "serio");