2.5.70 tty_register_driver
Subsystems (2)
There was a large patch applied in 2.5.70 to the tty layer that has broken registration of tty devices.
The tty drivers I maintain get a success return value from tty_register_driver() and dynamic major/minor device numbers are assigned, but it does not appear to actually create the char devices. (They do not show up in proc/devices).
I'm trying to dig through this and understand the purpose of the changes, but it might be
more informative if the person responsible for the patch would explain the purpose and what modification of tty drivers are necessary to work with the changes.
Signature · 2 lines
Paul Fulghum, [email protected] Microgate Corporation, http://www.microgate.com
Quoted 3 lines · Paul Fulghum
There was a large patch applied in 2.5.70 to
the tty layer that has broken registration of tty
devices.
Below is the broken code that was added in 2.5.70
to the tty_register_driver() function in drivers/char/tty_io.c (apparently submitted by Greg Kroah-Hartman <[email protected]>)
If a tty device uses dynamic major device numbers (driver->major set to zero), then the new code fails to honor the driver->minor_start value. Previously the driver->minor_start specified the starting device minor number for all calls to tty_register_driver() regardless of if major is dynamically allocated or staticly specified.
The result is the device minor numbers change for dynamically assigned major device numbers resulting in a loss of compatibility.
tty_register_driver() should be fixed
(along with alloc_chrdev_region) to once again honor the base minor number.
if (!driver->major) {
- error = register_chrdev_region(0, driver->minor_start,
- driver->num, driver->name, &tty_fops);
- if (error > 0)
- driver->major = error;
+ error = alloc_chrdev_region(&dev, driver->num,
+ (char*)driver->name);
+ if (!error) {
+ driver->major = MAJOR(dev);
+ driver->minor_start = MINOR(dev);
+ }
} else {
- error = get_range(driver);
+ dev = MKDEV(driver->major, driver->minor_start);
+ error = register_chrdev_region(dev, driver->num,
+ (char*)driver->name);
}
Signature · 2 lines
Paul Fulghum, [email protected] Microgate Corporation, http://www.microgate.com
PATCH 1/1 2.5.70 tty_register_driver
This patch corrects changes made in 2.5.70 to tty_register_device() which caused the device minor base specified by tty drivers using dynamically allocated device major number to be ignored.
I have posted to lkml and to the originator of the 2.5.70 patch, and have received no dissenting views.
Please apply.
drivers/char/tty_io.c +1 -1
@@ -2255,7 +2255,7 @@return 0 ;if (!driver->major) { - error =alloc_chrdev_region (&dev, driver->num, + error =alloc_chrdev_region (&dev, driver->minor_start, driver->num, (char *)driver->name);if (!error) { driver->major =MAJOR (dev);
include/linux/fs.h +1 -1
@@ -1059,7 +1059,7 @@extern void blk_run_queues (void );/* fs/char_dev.c */ -extern int alloc_chrdev_region (dev_t *,unsigned ,char *); +extern int alloc_chrdev_region (dev_t *,unsigned ,unsigned ,char *);extern int register_chrdev_region (dev_t ,unsigned ,char *);extern int register_chrdev (unsigned int ,const char *,struct file_operations *);
fs/char_dev.c +2 -2
@@ -177,10 +177,10 @@return PTR_ERR (cd); } -int alloc_chrdev_region (dev_t *dev,unsigned count,char *name) +int alloc_chrdev_region (dev_t *dev,unsigned baseminor,unsigned count,char *name) {struct char_device_struct *cd; - cd =__register_chrdev_region (0 ,0 , count, name); + cd =__register_chrdev_region (0 , baseminor, count, name);if (IS_ERR (cd))return PTR_ERR (cd); *dev =MKDEV (cd->major, cd->baseminor);
Signature · 2 lines
Paul Fulghum, [email protected] Microgate Corporation, http://www.microgate.com
Quoted 7 lines · Paul Fulghum
This patch corrects changes made in 2.5.70 to
tty_register_device()which caused the device minor base specified by tty drivers using dynamically allocated device major number to be ignored.I have posted to lkml and to the originator of the 2.5.70 patch, and have received no dissenting views.
Hm, I wasn't the originator of the 2.5.70 change in this area, that's Al Viro. I suggest you run this by him first.
thanks,
greg k-h
Quoted 10 lines · Greg KH
Quoted 2 lines · Paul Fulghum
I have posted to lkml and to the originator of the 2.5.70 patch, and have received no dissenting views.
Hm, I wasn't the originator of the 2.5.70 change in this area, that's Al Viro. I suggest you run this by him first.
thanks,
greg k-h
Sorry, in the 2.5.70 announcement by Linus, I saw some tty changes listed under your name.
It does look like Al Viro is responsible for
the changes in question.
Signature · 2 lines
Paul Fulghum, [email protected] Microgate Corporation, http://www.microgate.com