[PATCH] mdev: special rule to create iio devices

Linus Walleij linus.walleij at linaro.org
Wed Oct 21 09:06:15 UTC 2015


IIO devices do not appear under sys/class and thus need
a special hook to be created properly by mdev.

Busybox mdev is traversing /sys/class looking for ".../dev"
suffixes that are device nodes to create /dev device nodes,
but the device core maintainer (Greg) disapproves the use
of class devices, advocating busses.

Scanning all busses however, would result in a huge set of
duplicate devices that also have a class. So for every
bus that is not a class, we need a quirk like this to spawn
device nodes to userspace. IIO is the first example but there
will be more (thinking of GPIO here).

Cc: Greg Kroah-Hartman <gregkh at linuxfoundation.org>
Cc: Jonathan Cameron <jic23 at kernel.org>
Signed-off-by: Linus Walleij <linus.walleij at linaro.org>
---
This is a bit of an open question: is this kind of per-subsystem
quirk the way we should solve this? And what about device that
have no bus or class? Can mdev even handle that?

Should this all go into /etc/mdev.conf instead?

If anyone knows a better way for mdev: tell me.
---
 util-linux/mdev.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/util-linux/mdev.c b/util-linux/mdev.c
index 37fa56827520..418c11166f56 100644
--- a/util-linux/mdev.c
+++ b/util-linux/mdev.c
@@ -1082,6 +1082,9 @@ int mdev_main(int argc UNUSED_PARAM, char **argv)
 		recursive_action("/sys/class",
 			ACTION_RECURSE | ACTION_FOLLOWLINKS,
 			fileAction, dirAction, temp, 0);
+		recursive_action("/sys/bus/iio",
+			ACTION_RECURSE | ACTION_FOLLOWLINKS,
+			fileAction, dirAction, temp, 0);
 	} else {
 		char *fw;
 		char *seq;
-- 
2.4.3



More information about the busybox mailing list