Skip to contentSkip to conversation

TTY changes for 2.5.70

PATCH In review Greg KH 1 participant 3 messages Jun 5, 2003 1 message not in the archive Char and misc drivers

lore
Share & tools
lore

Greg KH

author
#0 lore raw

PATCH 1/1 TTY changes for 2.5.70

Here are some TTY changesets for the latest 2.5.70 bk tree. They do the following:
- update the Rocketport driver to the latest version.
- fix the race condition with the tty_class devices that was pointed out by Al Viro.

Please pull from:

        bk://kernel.bkbits.net/gregkh/linux/tty-2.5

Patches will be posted as a followup to lkml.

thanks,

greg k-h

 include/linux/rocket.h    |   55 
 Documentation/00-INDEX    |    2 
 Documentation/rocket.txt  |   87 +
 MAINTAINERS               |    6 
 drivers/char/Kconfig      |   13 
 drivers/char/rocket.c     | 3344 ++++++++++++++++++++++++++++------------------
 drivers/char/rocket.h     |  131 +
 drivers/char/rocket_int.h |  968 +++++++------
 drivers/char/tty_io.c     |   30 
 drivers/pci/pci.ids       |   33 
 include/linux/pci_ids.h   |   11 
 11 files changed, 2897 insertions(+), 1783 deletions(-)

-----

<kurt.robideau:comtrol.com>:
o Rocketport driver against 2.5.70-bk7

Greg Kroah-Hartman:
o TTY: release function should be set in the class, not the class_device
o TTY: add a release function for tty_class devices

A message that is not in the archive (sent off-list or not yet received): [email protected]

author
#2 lore raw

ChangeSet 1.1314, 2003/06/05 14:21:57-07:00, [email protected]

TTY: add a release function for tty_class devices.

This fixes a race with looking at files in /sys/class/tty/ and removing a tty device.

 drivers/char/tty_io.c |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletion(-)
drivers/char/tty_io.c +7 -1
diff -Nru a/drivers/char/tty_io.c b/drivers/char/tty_io.c
@@ -2114,6 +2114,12 @@
 }
 static CLASS_DEVICE_ATTR(dev, S_IRUGO, show_dev, NULL);
 
+static void release_tty_dev(struct class_device *class_dev)
+{
+	struct tty_dev *tty_dev = to_tty_dev(class_dev);
+	kfree(tty_dev);
+}
+
 static void tty_add_class_device(char *name, dev_t dev, struct device *device)
 {
 	struct tty_dev *tty_dev = NULL;
@@ -2134,6 +2140,7 @@
 
 	tty_dev->class_dev.dev = device;
 	tty_dev->class_dev.class = &tty_class;
+	tty_dev->class_dev.release = &release_tty_dev;
 	snprintf(tty_dev->class_dev.class_id, BUS_ID_SIZE, "%s", temp);
 	retval = class_device_register(&tty_dev->class_dev);
 	if (retval)
@@ -2167,7 +2174,6 @@
 		list_del(&tty_dev->node);
 		spin_unlock(&tty_dev_list_lock);
 		class_device_unregister(&tty_dev->class_dev);
-		kfree(tty_dev);
 	} else {
 		spin_unlock(&tty_dev_list_lock);
 	}
author
#3 lore raw

ChangeSet 1.1315, 2003/06/05 15:19:41-07:00, [email protected]

TTY: release function should be set in the class, not the class_device.

 drivers/char/tty_io.c |   22 +++++++++++-----------
 1 files changed, 11 insertions(+), 11 deletions(-)
drivers/char/tty_io.c +11 -11
diff -Nru a/drivers/char/tty_io.c b/drivers/char/tty_io.c
@@ -2093,10 +2093,6 @@
 # define tty_unregister_devfs(driver, index)	do { } while (0)
 #endif /* CONFIG_DEVFS_FS */
 
-static struct class tty_class = {
-	.name	= "tty",
-};
-
 struct tty_dev {
 	struct list_head node;
 	dev_t dev;
@@ -2104,6 +2100,17 @@
 };
 #define to_tty_dev(d) container_of(d, struct tty_dev, class_dev)
 
+static void release_tty_dev(struct class_device *class_dev)
+{
+	struct tty_dev *tty_dev = to_tty_dev(class_dev);
+	kfree(tty_dev);
+}
+
+static struct class tty_class = {
+	.name		= "tty",
+	.release	= &release_tty_dev,
+};
+
 static LIST_HEAD(tty_dev_list);
 static spinlock_t tty_dev_list_lock = SPIN_LOCK_UNLOCKED;
 
@@ -2114,12 +2121,6 @@
 }
 static CLASS_DEVICE_ATTR(dev, S_IRUGO, show_dev, NULL);
 
-static void release_tty_dev(struct class_device *class_dev)
-{
-	struct tty_dev *tty_dev = to_tty_dev(class_dev);
-	kfree(tty_dev);
-}
-
 static void tty_add_class_device(char *name, dev_t dev, struct device *device)
 {
 	struct tty_dev *tty_dev = NULL;
@@ -2140,7 +2141,6 @@
 
 	tty_dev->class_dev.dev = device;
 	tty_dev->class_dev.class = &tty_class;
-	tty_dev->class_dev.release = &release_tty_dev;
 	snprintf(tty_dev->class_dev.class_id, BUS_ID_SIZE, "%s", temp);
 	retval = class_device_register(&tty_dev->class_dev);
 	if (retval)