daandemeyer / rpms / systemd

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