mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] Fix serial_match_port() for dynamic major tty-device numbers
       [not found]                             ` <8CA914AC0F6817C-1684-368@webmail-nc03.sysops.aol.com>
@ 2008-06-21 22:45                               ` Guennadi Liakhovetski
  2008-06-24 22:22                                 ` Andrew Morton
  0 siblings, 1 reply; 3+ messages in thread
From: Guennadi Liakhovetski @ 2008-06-21 22:45 UTC (permalink / raw)
  To: vcgandhi1, linux-kernel; +Cc: linux-serial

As reported by Vipul Gandhi, the current serial_match_port() doesn't work 
for tty-devices using dynamic major number allocation. Fix it.

Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Tested-by: Vipul Gandhi <vcgandhi1@aol.com>

---

diff --git a/drivers/serial/serial_core.c b/drivers/serial/serial_core.c
index 0f5a179..593ae85 100644
--- a/drivers/serial/serial_core.c
+++ b/drivers/serial/serial_core.c
@@ -1949,7 +1949,9 @@ struct uart_match {
 static int serial_match_port(struct device *dev, void *data)
 {
 	struct uart_match *match = data;
-	dev_t devt = MKDEV(match->driver->major, match->driver->minor) + match->port->line;
+	struct tty_driver *tty_drv = match->driver->tty_driver;
+	dev_t devt = MKDEV(tty_drv->major, tty_drv->minor_start) +
+		match->port->line;
 
 	return dev->devt == devt; /* Actually, only one tty per port */
 }

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

* Re: [PATCH] Fix serial_match_port() for dynamic major tty-device numbers
  2008-06-21 22:45                               ` [PATCH] Fix serial_match_port() for dynamic major tty-device numbers Guennadi Liakhovetski
@ 2008-06-24 22:22                                 ` Andrew Morton
  2008-06-24 22:54                                   ` Guennadi Liakhovetski
  0 siblings, 1 reply; 3+ messages in thread
From: Andrew Morton @ 2008-06-24 22:22 UTC (permalink / raw)
  To: Guennadi Liakhovetski; +Cc: vcgandhi1, linux-kernel, linux-serial, Alan Cox

On Sun, 22 Jun 2008 00:45:25 +0200 (CEST)
Guennadi Liakhovetski <g.liakhovetski@gmx.de> wrote:

> As reported by Vipul Gandhi, the current serial_match_port() doesn't work 
> for tty-devices using dynamic major number allocation. Fix it.
> 
> Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
> Tested-by: Vipul Gandhi <vcgandhi1@aol.com>
> 
> ---
> 
> diff --git a/drivers/serial/serial_core.c b/drivers/serial/serial_core.c
> index 0f5a179..593ae85 100644
> --- a/drivers/serial/serial_core.c
> +++ b/drivers/serial/serial_core.c
> @@ -1949,7 +1949,9 @@ struct uart_match {
>  static int serial_match_port(struct device *dev, void *data)
>  {
>  	struct uart_match *match = data;
> -	dev_t devt = MKDEV(match->driver->major, match->driver->minor) + match->port->line;
> +	struct tty_driver *tty_drv = match->driver->tty_driver;
> +	dev_t devt = MKDEV(tty_drv->major, tty_drv->minor_start) +
> +		match->port->line;
>  
>  	return dev->devt == devt; /* Actually, only one tty per port */

Well that sounds bad.  We need to work out whether this fix is needed
in 2.6.25 and possibly eariler.

What are the consequences of this error?

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

* Re: [PATCH] Fix serial_match_port() for dynamic major tty-device numbers
  2008-06-24 22:22                                 ` Andrew Morton
@ 2008-06-24 22:54                                   ` Guennadi Liakhovetski
  0 siblings, 0 replies; 3+ messages in thread
From: Guennadi Liakhovetski @ 2008-06-24 22:54 UTC (permalink / raw)
  To: Andrew Morton; +Cc: vcgandhi1, linux-kernel, linux-serial, Alan Cox

On Tue, 24 Jun 2008, Andrew Morton wrote:

> On Sun, 22 Jun 2008 00:45:25 +0200 (CEST)
> Guennadi Liakhovetski <g.liakhovetski@gmx.de> wrote:
> 
> > As reported by Vipul Gandhi, the current serial_match_port() doesn't work 
> > for tty-devices using dynamic major number allocation. Fix it.
> > 
> > Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
> > Tested-by: Vipul Gandhi <vcgandhi1@aol.com>
> > 
> > ---
> > 
> > diff --git a/drivers/serial/serial_core.c b/drivers/serial/serial_core.c
> > index 0f5a179..593ae85 100644
> > --- a/drivers/serial/serial_core.c
> > +++ b/drivers/serial/serial_core.c
> > @@ -1949,7 +1949,9 @@ struct uart_match {
> >  static int serial_match_port(struct device *dev, void *data)
> >  {
> >  	struct uart_match *match = data;
> > -	dev_t devt = MKDEV(match->driver->major, match->driver->minor) + match->port->line;
> > +	struct tty_driver *tty_drv = match->driver->tty_driver;
> > +	dev_t devt = MKDEV(tty_drv->major, tty_drv->minor_start) +
> > +		match->port->line;
> >  
> >  	return dev->devt == devt; /* Actually, only one tty per port */
> 
> Well that sounds bad.  We need to work out whether this fix is needed
> in 2.6.25 and possibly eariler.

Not earlier, this code is only there since 2.6.25.

> What are the consequences of this error?

It Oopses, if you suspend a serial port with _dynamic_ major number. ATM, 
I think, there's only the drivers/serial/jsm/jsm_driver.c driver, that 
does it in-tree.

Thanks
Guennadi
---
Guennadi Liakhovetski, Ph.D.
Freelance Open-Source Software Developer

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

end of thread, other threads:[~2008-06-24 22:54 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <8CA6D5E4DEA920C-1128-2973@webmail-nb07.sysops.aol.com>
     [not found] ` <Pine.LNX.4.64.0804160046460.6851@axis700.grange>
     [not found]   ` <8CA6D67D9E313CC-1128-35BB@webmail-nb07.sysops.aol.com>
     [not found]     ` <8CA6D6D112DB4D4-1128-38B0@webmail-nb07.sysops.aol.com>
     [not found]       ` <Pine.LNX.4.64.0804170103040.7335@axis700.grange>
     [not found]         ` <8CA6E48B50204C0-15A8-47D0@webmail-nb06.sysops.aol.com>
     [not found]           ` <Pine.LNX.4.64.0804171657320.6716@axis700.grange>
     [not found]             ` <8CA6EC102F70775-15A8-8B4A@webmail-nb06.sysops.aol.com>
     [not found]               ` <Pine.LNX.4.64.0804171915180.6716@axis700.grange>
     [not found]                 ` <8CA6EF5BC26E069-12A0-1888@webmail-nc13.sysops.aol.com>
     [not found]                   ` <Pine.LNX.4.64.0804181700300.5725@axis700.grange>
     [not found]                     ` <8CA6FF4B03B281A-E10-2E1C@webmail-nf05.sim.aol.com>
     [not found]                       ` <Pine.LNX.4.64.0804231108170.5160@axis700.grange>
     [not found]                         ` <8CA73B83C791846-148-41B9@webmail-nb17.sysops.aol.com>
     [not found]                           ` <Pine.LNX.4.64.0804241557340.5283@axis700.grange>
     [not found]                             ` <8CA914AC0F6817C-1684-368@webmail-nc03.sysops.aol.com>
2008-06-21 22:45                               ` [PATCH] Fix serial_match_port() for dynamic major tty-device numbers Guennadi Liakhovetski
2008-06-24 22:22                                 ` Andrew Morton
2008-06-24 22:54                                   ` Guennadi Liakhovetski

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®