All of lore.kernel.org
 help / color / mirror / Atom feed
* [RFC] initial tty class support for 2.5.52
@ 2002-12-24  1:19 Greg KH
  0 siblings, 0 replies; only message in thread
From: Greg KH @ 2002-12-24  1:19 UTC (permalink / raw)
  To: linux-kernel, Patrick Mochel

Hi all,

Here's a small patch against 2.5.52 that adds the start of tty class
support to the kernel.  It also enables the usb-serial drivers to use
this class.  With this patch, the /sys/class/tty directory looks like
the following on my machine (with 1 4 port usb-to-serial device plugged
in):

/sys/class/tty/
|-- devices
|   |-- 12 -> ../../../devices/pci0/00:1e.0/01:0d.1/usb3/3-1/ttyUSB0
|   |-- 13 -> ../../../devices/pci0/00:1e.0/01:0d.1/usb3/3-1/ttyUSB1
|   |-- 14 -> ../../../devices/pci0/00:1e.0/01:0d.1/usb3/3-1/ttyUSB2
|   `-- 15 -> ../../../devices/pci0/00:1e.0/01:0d.1/usb3/3-1/ttyUSB3
`-- drivers
    |-- usb-serial:clie_3.5 -> ../../../bus/usb-serial/drivers/clie_3.5
    |-- usb-serial:edgeport_1 -> ../../../bus/usb-serial/drivers/edgeport_1
    |-- usb-serial:edgeport_2 -> ../../../bus/usb-serial/drivers/edgeport_2
    |-- usb-serial:edgeport_4 -> ../../../bus/usb-serial/drivers/edgeport_4
    |-- usb-serial:edgeport_8 -> ../../../bus/usb-serial/drivers/edgeport_8
    |-- usb-serial:generic -> ../../../bus/usb-serial/drivers/generic
    |-- usb-serial:visor -> ../../../bus/usb-serial/drivers/visor
    |-- usb-serial:whiteheat -> ../../../bus/usb-serial/drivers/whiteheat
    `-- usb-serial:whiteheatnofirm -> ../../../bus/usb-serial/drivers/whiteheatnofirm

If no one has any problems with the patch, I'll send it on to Linus in a
few days.

thanks,

greg k-h


diff -Nru a/drivers/char/tty_io.c b/drivers/char/tty_io.c
--- a/drivers/char/tty_io.c	Mon Dec 23 17:14:36 2002
+++ b/drivers/char/tty_io.c	Mon Dec 23 17:14:36 2002
@@ -90,6 +90,7 @@
 #include <linux/init.h>
 #include <linux/module.h>
 #include <linux/smp_lock.h>
+#include <linux/device.h>
 
 #include <asm/uaccess.h>
 #include <asm/system.h>
@@ -2261,12 +2262,19 @@
 extern int vty_init(void);
 #endif
 
+struct device_class tty_devclass = {
+	.name	= "tty",
+};
+EXPORT_SYMBOL(tty_devclass);
+
 /*
  * Ok, now we can initialize the rest of the tty devices and can count
  * on memory allocations, interrupts etc..
  */
 void __init tty_init(void)
 {
+	devclass_register(&tty_devclass);
+
 	/*
 	 * dev_tty_driver and dev_console_driver are actually magic
 	 * devices which get redirected at open time.  Nevertheless,
diff -Nru a/drivers/usb/serial/bus.c b/drivers/usb/serial/bus.c
--- a/drivers/usb/serial/bus.c	Mon Dec 23 17:14:36 2002
+++ b/drivers/usb/serial/bus.c	Mon Dec 23 17:14:36 2002
@@ -128,6 +128,7 @@
 	device->driver.bus = &usb_serial_bus_type;
 	device->driver.probe = usb_serial_device_probe;
 	device->driver.remove = usb_serial_device_remove;
+	device->driver.devclass = &tty_devclass;
 
 	retval = driver_register(&device->driver);
 
diff -Nru a/include/linux/tty_driver.h b/include/linux/tty_driver.h
--- a/include/linux/tty_driver.h	Mon Dec 23 17:14:36 2002
+++ b/include/linux/tty_driver.h	Mon Dec 23 17:14:36 2002
@@ -227,4 +227,6 @@
 #define SERIAL_TYPE_NORMAL	1
 #define SERIAL_TYPE_CALLOUT	2
 
+extern struct device_class tty_devclass;
+
 #endif /* #ifdef _LINUX_TTY_DRIVER_H */

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2002-12-24  1:15 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-12-24  1:19 [RFC] initial tty class support for 2.5.52 Greg KH

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.