[PATCH] tty_io: Do not register NULL /dev entries on devfs

From: Marcelo Tosatti
Date: Fri Feb 27 2004 - 15:43:35 EST



Hi,

Faced this problem where "/dev/<NULL>x" entries got created while loading
the cyclades driver with devfs.

Several drivers do not set driver->devfs_name, so better skip registration
for those.

--- linux-2.6.3/drivers/char/tty_io.c.orig 2004-02-27 18:29:16.641482744 -0300
+++ linux-2.6.3/drivers/char/tty_io.c 2004-02-27 18:30:08.437608536 -0300
@@ -2099,7 +2099,8 @@
return;
}

- devfs_mk_cdev(dev, S_IFCHR | S_IRUSR | S_IWUSR,
+ if (driver->devfs_name)
+ devfs_mk_cdev(dev, S_IFCHR | S_IRUSR | S_IWUSR,
"%s%d", driver->devfs_name, index + driver->name_base);

/* we don't care about the ptys */
@@ -2121,7 +2122,8 @@
*/
void tty_unregister_device(struct tty_driver *driver, unsigned index)
{
- devfs_remove("%s%d", driver->devfs_name, index + driver->name_base);
+ if (driver->devfs_name)
+ devfs_remove("%s%d", driver->devfs_name, index + driver->name_base);
class_simple_device_remove(MKDEV(driver->major, driver->minor_start) + index);
}

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/