linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [BUG] 2.5.70 tty_register_driver
@ 2003-05-28 16:09 Paul Fulghum
  2003-05-28 19:27 ` Paul Fulghum
  0 siblings, 1 reply; 5+ messages in thread
From: Paul Fulghum @ 2003-05-28 16:09 UTC (permalink / raw)
  To: linux-kernel


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.

-- 
Paul Fulghum, paulkf@microgate.com
Microgate Corporation, http://www.microgate.com



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

* Re: [BUG] 2.5.70 tty_register_driver
  2003-05-28 16:09 [BUG] 2.5.70 tty_register_driver Paul Fulghum
@ 2003-05-28 19:27 ` Paul Fulghum
  2003-05-29 14:27   ` [PATCH] " Paul Fulghum
  0 siblings, 1 reply; 5+ messages in thread
From: Paul Fulghum @ 2003-05-28 19:27 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman

On Wed, 2003-05-28 at 11:09, Paul Fulghum wrote:
> 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 <greg@kroah.com>)

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


-- 
Paul Fulghum, paulkf@microgate.com
Microgate Corporation, http://www.microgate.com



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

* [PATCH] 2.5.70 tty_register_driver
  2003-05-28 19:27 ` Paul Fulghum
@ 2003-05-29 14:27   ` Paul Fulghum
  2003-05-29 16:56     ` Greg KH
  0 siblings, 1 reply; 5+ messages in thread
From: Paul Fulghum @ 2003-05-29 14:27 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, torvalds

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.

--- linux-2.5.70/drivers/char/tty_io.c	2003-05-29 09:14:30.000000000 -0500
+++ linux-2.5.70-mg/drivers/char/tty_io.c	2003-05-29 08:24:41.000000000 -0500
@@ -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);
--- linux-2.5.70/include/linux/fs.h	2003-05-29 09:14:01.000000000 -0500
+++ linux-2.5.70-mg/include/linux/fs.h	2003-05-29 08:23:46.000000000 -0500
@@ -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 *);
--- linux-2.5.70/fs/char_dev.c	2003-05-29 09:14:18.000000000 -0500
+++ linux-2.5.70-mg/fs/char_dev.c	2003-05-29 08:24:25.000000000 -0500
@@ -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);




-- 
Paul Fulghum, paulkf@microgate.com
Microgate Corporation, http://www.microgate.com



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

* Re: [PATCH] 2.5.70 tty_register_driver
  2003-05-29 14:27   ` [PATCH] " Paul Fulghum
@ 2003-05-29 16:56     ` Greg KH
  2003-05-29 17:27       ` Paul Fulghum
  0 siblings, 1 reply; 5+ messages in thread
From: Greg KH @ 2003-05-29 16:56 UTC (permalink / raw)
  To: Paul Fulghum; +Cc: linux-kernel, torvalds

On Thu, May 29, 2003 at 09:27:28AM -0500, Paul Fulghum wrote:
> 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

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

* Re: [PATCH] 2.5.70 tty_register_driver
  2003-05-29 16:56     ` Greg KH
@ 2003-05-29 17:27       ` Paul Fulghum
  0 siblings, 0 replies; 5+ messages in thread
From: Paul Fulghum @ 2003-05-29 17:27 UTC (permalink / raw)
  To: Greg KH; +Cc: linux-kernel

On Thu, 2003-05-29 at 11:56, Greg KH wrote:
> On Thu, May 29, 2003 at 09:27:28AM -0500, Paul Fulghum wrote:
> > 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.

-- 
Paul Fulghum, paulkf@microgate.com
Microgate Corporation, http://www.microgate.com



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

end of thread, other threads:[~2003-05-29 17:13 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-05-28 16:09 [BUG] 2.5.70 tty_register_driver Paul Fulghum
2003-05-28 19:27 ` Paul Fulghum
2003-05-29 14:27   ` [PATCH] " Paul Fulghum
2003-05-29 16:56     ` Greg KH
2003-05-29 17:27       ` Paul Fulghum

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).