chiark / gitweb /
[PATCH] If a CALLOUT rule has a BUS id, then we must check to see if the device is...
authorgreg@kroah.com <greg@kroah.com>
Thu, 25 Dec 2003 08:05:28 +0000 (00:05 -0800)
committerGreg KH <gregkh@suse.de>
Wed, 27 Apr 2005 04:13:11 +0000 (21:13 -0700)
Thanks to Martin Schlemmer <azarah@nosferatu.za.org> for pointing this out.

namedev.c
test/udev-test.pl

index e474b48e57fbb973221e50b68b13cb3f6e671c0f..de1b20618022f8f48820fca1c01691b2c08167e2 100644 (file)
--- 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;
index ea1d8611efa6f377966c87d30dd7657d62e9d11e..9538cba2d10d6bc28afdd6090ff66899ec3ff789 100644 (file)
@@ -215,13 +215,22 @@ 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" ,
                conf     => <<EOF
 CALLOUT, BUS="scsi", PROGRAM="/bin/echo -n foo", ID="foo", NAME="foo"
 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
        },
        {