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