Re: [PATCH V2 01/10] tty: Fallback to use dynamic major number
From: Arnd Bergmann <arnd@arndb.de>
Date: 2014-11-27 14:33:58
Also in:
linux-mips, linux-serial
On Thursday 27 November 2014 13:50:01 Grant Likely wrote:
Should be sufficient. Basically, if the hardware doesn't exist, the driver shouldn't be trying to grab the minor numbers. Also, on hardware where both exists, there should be some sane fallback so that all UARTs get assigned numbers. On DT systems we can also use /aliases to ensure consistent assignment of numbers.
From what I can see, this is really the ISA compatibility code
in the 8250 driver, and we should be able to make that optional
or even move it into a separate glue driver.
Basically the serial8250_init function tries to do a lot of things
at once (skipping error handling):
serial8250_isa_init_ports();
ret = sunserial_register_minors(&serial8250_reg, UART_NR);
serial8250_reg.nr = UART_NR;
ret = uart_register_driver(&serial8250_reg);
ret = serial8250_pnp_init();
serial8250_isa_devs = platform_device_alloc("serial8250",
PLAT8250_DEV_LEGACY);
ret = platform_device_add(serial8250_isa_devs);
serial8250_register_ports(&serial8250_reg, &serial8250_isa_devs->dev);
ret = platform_driver_register(&serial8250_isa_driver);
The only thing we want from this is the uart_register_driver() call,
everything else is only needed together with the ISA support. The way
that uart_register_driver() works unfortunately implies that you know
the maximum number of ports at driver init time, which would need
to be changed if you want to share the numbers.
One idea I had a few years ago when we discussed this was to treat
the major 4 allocation differently so you could share it between all
sorts of drivers as an opt-in, but could have all unmodified continue
using their own device names and numbers.
Arnd