summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--namedev.c5
-rw-r--r--test/udev-test.pl11
2 files changed, 14 insertions, 2 deletions
diff --git a/namedev.c b/namedev.c
index e474b48e57..de1b206180 100644
--- a/namedev.c
+++ b/namedev.c
@@ -399,7 +399,10 @@ static int do_callout(struct sysfs_class_device *class_dev, struct udevice *udev
if (dev->type != CALLOUT)
continue;
- if (sysfs_device) {
+ if (dev->bus[0] != '\0') {
+ /* as the user specified a bus, we must match it up */
+ if (!sysfs_device)
+ continue;
dbg("dev->bus='%s' sysfs_device->bus='%s'", dev->bus, sysfs_device->bus);
if (strcasecmp(dev->bus, sysfs_device->bus) != 0)
continue;
diff --git a/test/udev-test.pl b/test/udev-test.pl
index ea1d8611ef..9538cba2d1 100644
--- a/test/udev-test.pl
+++ b/test/udev-test.pl
@@ -215,7 +215,7 @@ CALLOUT, BUS="scsi", PROGRAM="/bin/echo -n node link1 link2", ID="node *", NAME=
EOF
},
{
- desc => "callout for device with no bus",
+ desc => "invalid callout for device with no bus",
subsys => "tty",
devpath => "class/tty/console",
expected => "TTY" ,
@@ -225,6 +225,15 @@ REPLACE, KERNEL="console", NAME="TTY"
EOF
},
{
+ desc => "valid callout for device with no bus",
+ subsys => "tty",
+ devpath => "class/tty/console",
+ expected => "foo" ,
+ conf => <<EOF
+CALLOUT, PROGRAM="/bin/echo -n foo", ID="foo", NAME="foo"
+EOF
+ },
+ {
desc => "devfs disk naming substitution",
subsys => "block",
devpath => "block/sda",