mbox series

[0/2] Move uart_register_driver call to device probe for pl010 and sh-sci

Message ID 20170324162634.8880-1-sjoerd.simons@collabora.co.uk
Headers show
Series Move uart_register_driver call to device probe for pl010 and sh-sci | expand

Message

Sjoerd Simons March 24, 2017, 4:26 p.m. UTC
When testing on a Renesas board with the PL010 serial driver enabled
serial output broke. Turns out the minor device numbers for both
drivers happen to overlap, causing whichever driver happened to be the
second one to register to fail.

The attached patches move the uart_register_driver call to probe time
for both drivers avoiding the issue.


Sjoerd Simons (2):
  serial: pl010: Move uart_register_driver call to device probe
  serial: sh-sci: Move uart_register_driver call to device probe

 drivers/tty/serial/amba-pl010.c | 27 +++++++++++++++++----------
 drivers/tty/serial/sh-sci.c     | 21 ++++++++++-----------
 2 files changed, 27 insertions(+), 21 deletions(-)

-- 
2.11.0

--
To unsubscribe from this list: send the line "unsubscribe linux-serial" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

Russell King (Oracle) March 24, 2017, 4:42 p.m. UTC | #1
On Fri, Mar 24, 2017 at 05:26:32PM +0100, Sjoerd Simons wrote:
> When testing on a Renesas board with the PL010 serial driver enabled

> serial output broke. Turns out the minor device numbers for both

> drivers happen to overlap, causing whichever driver happened to be the

> second one to register to fail.


How the **** has the SH serial driver ended up with overlapping device
numbers?

What happened to our maintained list of allocated major/minor device
numbers, which is supposed to stop crap like this happening?

-- 
RMK's Patch system: http://www.armlinux.org.uk/developer/patches/
FTTC broadband for 0.8mile line: currently at 9.6Mbps down 400kbps up
according to speedtest.net.
--
To unsubscribe from this list: send the line "unsubscribe linux-serial" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Geert Uytterhoeven March 26, 2017, 9:22 a.m. UTC | #2
Hi Russell, Sjoerd,

On Fri, Mar 24, 2017 at 5:42 PM, Russell King - ARM Linux
<linux@armlinux.org.uk> wrote:
> On Fri, Mar 24, 2017 at 05:26:32PM +0100, Sjoerd Simons wrote:

>> When testing on a Renesas board with the PL010 serial driver enabled

>> serial output broke. Turns out the minor device numbers for both

>> drivers happen to overlap, causing whichever driver happened to be the

>> second one to register to fail.

>

> How the **** has the SH serial driver ended up with overlapping device

> numbers?


Interesting...

> What happened to our maintained list of allocated major/minor device

> numbers, which is supposed to stop crap like this happening?


AMBA PL010 has been assigned major 204, minors 16..31,
SCI has been assigned major 204, minors 8..11.

Over the years, Renesas SoCs have been gaining more and more serial
ports, leading to

    #define SCI_NPORTS CONFIG_SERIAL_SH_SCI_NR_UARTS

with CONFIG_SERIAL_SH_SCI_NR_UARTS=20 in shmobile_defconfig and
multi_v7_defconfig (although the maximum value on any supported SoC is 18).

But once the value becomes 5 or more, it starts overflowing into the ttyFWx
and ttyAMx space.

How to solve this?
Time for the serial subsystem to switch to dynamic minors, and get rid of the
what-is-your-serial-port-called-again-on-this-platform
multi-million-euro question?

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds
--
To unsubscribe from this list: send the line "unsubscribe linux-serial" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Russell King (Oracle) March 26, 2017, 10:01 a.m. UTC | #3
On Sun, Mar 26, 2017 at 11:22:57AM +0200, Geert Uytterhoeven wrote:
> Time for the serial subsystem to switch to dynamic minors, and get rid of the

> what-is-your-serial-port-called-again-on-this-platform

> multi-million-euro question?


Dynamic device numbers are fine for those who use devtmpfs / udev, but I
would imagine that there are systems out there which don't, and if they
change, systems become inaccessible (the port becomes dead, even to
sysrq.)

-- 
RMK's Patch system: http://www.armlinux.org.uk/developer/patches/
FTTC broadband for 0.8mile line: currently at 9.6Mbps down 400kbps up
according to speedtest.net.
--
To unsubscribe from this list: send the line "unsubscribe linux-serial" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Greg Kroah-Hartman March 31, 2017, 1:27 p.m. UTC | #4
On Sun, Mar 26, 2017 at 11:22:57AM +0200, Geert Uytterhoeven wrote:
> Hi Russell, Sjoerd,

> 

> On Fri, Mar 24, 2017 at 5:42 PM, Russell King - ARM Linux

> <linux@armlinux.org.uk> wrote:

> > On Fri, Mar 24, 2017 at 05:26:32PM +0100, Sjoerd Simons wrote:

> >> When testing on a Renesas board with the PL010 serial driver enabled

> >> serial output broke. Turns out the minor device numbers for both

> >> drivers happen to overlap, causing whichever driver happened to be the

> >> second one to register to fail.

> >

> > How the **** has the SH serial driver ended up with overlapping device

> > numbers?

> 

> Interesting...

> 

> > What happened to our maintained list of allocated major/minor device

> > numbers, which is supposed to stop crap like this happening?

> 

> AMBA PL010 has been assigned major 204, minors 16..31,

> SCI has been assigned major 204, minors 8..11.

> 

> Over the years, Renesas SoCs have been gaining more and more serial

> ports, leading to

> 

>     #define SCI_NPORTS CONFIG_SERIAL_SH_SCI_NR_UARTS

> 

> with CONFIG_SERIAL_SH_SCI_NR_UARTS=20 in shmobile_defconfig and

> multi_v7_defconfig (although the maximum value on any supported SoC is 18).

> 

> But once the value becomes 5 or more, it starts overflowing into the ttyFWx

> and ttyAMx space.

> 

> How to solve this?

> Time for the serial subsystem to switch to dynamic minors, and get rid of the

> what-is-your-serial-port-called-again-on-this-platform

> multi-million-euro question?


Yes, please, we need to do that.  Let's provide a build option for it,
like USB has had for over a decade.  If it's enabled, it's all dynamic,
if not, the "old style" ones are used.  Then we don't accept any new
reservations, making new drivers use the dynamic number, and over a long
time, all should be good.

thanks,

greg k-h
--
To unsubscribe from this list: send the line "unsubscribe linux-serial" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html