mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* Re: [PATCH] tty_io: Do not register NULL /dev entries on devfs
  2004-02-27 21:36 [PATCH] tty_io: Do not register NULL /dev entries on devfs Marcelo Tosatti
@ 2004-02-27 20:48 ` Christoph Hellwig
  2004-02-27 22:22   ` [PATCH] Fix tty drivers which dont set tty_driver->devfs_name Marcelo Tosatti
  0 siblings, 1 reply; 3+ messages in thread
From: Christoph Hellwig @ 2004-02-27 20:48 UTC (permalink / raw)
  To: Marcelo Tosatti; +Cc: torvalds, Russell King, linux-kernel

On Fri, Feb 27, 2004 at 06:36:47PM -0300, Marcelo Tosatti wrote:
> 
> 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.

No, fix the drivers instead.


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH] tty_io: Do not register NULL /dev entries on devfs
@ 2004-02-27 21:36 Marcelo Tosatti
  2004-02-27 20:48 ` Christoph Hellwig
  0 siblings, 1 reply; 3+ messages in thread
From: Marcelo Tosatti @ 2004-02-27 21:36 UTC (permalink / raw)
  To: torvalds; +Cc: Russell King, linux-kernel


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);
 }


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH] Fix tty drivers which dont set tty_driver->devfs_name
  2004-02-27 20:48 ` Christoph Hellwig
@ 2004-02-27 22:22   ` Marcelo Tosatti
  0 siblings, 0 replies; 3+ messages in thread
From: Marcelo Tosatti @ 2004-02-27 22:22 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: torvalds, Russell King, linux-kernel


> No, fix the drivers instead.

Agreed.

The following patches fixes tty drivers which dont set devfs_name. Not
doing so will cause the tty layer to create "/dev/<NULL>x" entries when
devfs is being used.

I used "drivername/" in isicom and pcxe because the letter used to
identify them are already used by other drivers.

Please apply.


diff -Nur linux-2.6.3.orig/drivers/char/cyclades.c linux-2.6.3-devfs/drivers/char/cyclades.c
--- linux-2.6.3.orig/drivers/char/cyclades.c	2004-02-24 17:51:48.000000000 -0300
+++ linux-2.6.3-devfs/drivers/char/cyclades.c	2004-02-27 19:12:22.812325016 -0300
@@ -5452,6 +5452,7 @@
     cy_serial_driver->owner = THIS_MODULE;
     cy_serial_driver->driver_name = "cyclades";
     cy_serial_driver->name = "ttyC";
+    cy_serial_driver->devfs_name = "tts/C";
     cy_serial_driver->major = CYCLADES_MAJOR;
     cy_serial_driver->minor_start = 0;
     cy_serial_driver->type = TTY_DRIVER_TYPE_SERIAL;
diff -Nur linux-2.6.3.orig/drivers/char/epca.c linux-2.6.3-devfs/drivers/char/epca.c
--- linux-2.6.3.orig/drivers/char/epca.c	2004-02-24 17:51:49.000000000 -0300
+++ linux-2.6.3-devfs/drivers/char/epca.c	2004-02-27 19:02:04.632302664 -0300
@@ -1644,6 +1644,7 @@

 	pc_driver->owner = THIS_MODULE;
 	pc_driver->name = "ttyD";
+	pc_driver->devfs_name = "tts/D";
 	pc_driver->major = DIGI_MAJOR;
 	pc_driver->minor_start = 0;
 	pc_driver->type = TTY_DRIVER_TYPE_SERIAL;
diff -Nur linux-2.6.3.orig/drivers/char/esp.c linux-2.6.3-devfs/drivers/char/esp.c
--- linux-2.6.3.orig/drivers/char/esp.c	2004-02-24 17:51:48.000000000 -0300
+++ linux-2.6.3-devfs/drivers/char/esp.c	2004-02-27 19:02:54.077785808 -0300
@@ -2498,6 +2498,7 @@

 	esp_driver->owner = THIS_MODULE;
 	esp_driver->name = "ttyP";
+	esp_driver->devfs_name = "tts/P";
 	esp_driver->major = ESP_IN_MAJOR;
 	esp_driver->minor_start = 0;
 	esp_driver->type = TTY_DRIVER_TYPE_SERIAL;
diff -Nur linux-2.6.3.orig/drivers/char/isicom.c linux-2.6.3-devfs/drivers/char/isicom.c
--- linux-2.6.3.orig/drivers/char/isicom.c	2004-02-24 17:51:48.000000000 -0300
+++ linux-2.6.3-devfs/drivers/char/isicom.c	2004-02-27 19:05:07.553494416 -0300
@@ -1653,6 +1653,7 @@

 	isicom_normal->owner	= THIS_MODULE;
 	isicom_normal->name 	= "ttyM";
+	isicom_normal->devfs_name = "isicom/";
 	isicom_normal->major	= ISICOM_NMAJOR;
 	isicom_normal->minor_start	= 0;
 	isicom_normal->type	= TTY_DRIVER_TYPE_SERIAL;
diff -Nur linux-2.6.3.orig/drivers/char/moxa.c linux-2.6.3-devfs/drivers/char/moxa.c
--- linux-2.6.3.orig/drivers/char/moxa.c	2004-02-24 17:51:49.000000000 -0300
+++ linux-2.6.3-devfs/drivers/char/moxa.c	2004-02-27 19:05:55.203250552 -0300
@@ -304,6 +304,7 @@
 	init_MUTEX(&moxaBuffSem);
 	moxaDriver->owner = THIS_MODULE;
 	moxaDriver->name = "ttya";
+	moxaDriver->devfs_name = "tts/a";
 	moxaDriver->major = ttymajor;
 	moxaDriver->minor_start = 0;
 	moxaDriver->type = TTY_DRIVER_TYPE_SERIAL;
diff -Nur linux-2.6.3.orig/drivers/char/pcxx.c linux-2.6.3-devfs/drivers/char/pcxx.c
--- linux-2.6.3.orig/drivers/char/pcxx.c	2004-02-24 17:51:49.000000000 -0300
+++ linux-2.6.3-devfs/drivers/char/pcxx.c	2004-02-27 19:09:55.318747448 -0300
@@ -1145,6 +1145,7 @@

 	pcxe_driver->owner = THIS_MODULE;
 	pcxe_driver->name = "ttyD";
+	pcxe_driver->devfs_name = "pcxe/";
 	pcxe_driver->major = DIGI_MAJOR;
 	pcxe_driver->minor_start = 0;
 	pcxe_driver->type = TTY_DRIVER_TYPE_SERIAL;
diff -Nur linux-2.6.3.orig/drivers/char/riscom8.c linux-2.6.3-devfs/drivers/char/riscom8.c
--- linux-2.6.3.orig/drivers/char/riscom8.c	2004-02-24 17:51:49.000000000 -0300
+++ linux-2.6.3-devfs/drivers/char/riscom8.c	2004-02-27 19:11:24.860135088 -0300
@@ -1696,6 +1696,7 @@
 	memset(IRQ_to_board, 0, sizeof(IRQ_to_board));
 	riscom_driver->owner = THIS_MODULE;
 	riscom_driver->name = "ttyL";
+	riscom_driver->devfs_name = "tts/L";
 	riscom_driver->major = RISCOM8_NORMAL_MAJOR;
 	riscom_driver->type = TTY_DRIVER_TYPE_SERIAL;
 	riscom_driver->subtype = SERIAL_TYPE_NORMAL;


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2004-02-27 21:36 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-02-27 21:36 [PATCH] tty_io: Do not register NULL /dev entries on devfs Marcelo Tosatti
2004-02-27 20:48 ` Christoph Hellwig
2004-02-27 22:22   ` [PATCH] Fix tty drivers which dont set tty_driver->devfs_name Marcelo Tosatti

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®