2023-11-16 07:30:05

by Manikanta Guntupalli

[permalink] [raw]
Subject: [PATCH V3 0/2] Use dynamic allocation for major number when uart ports > 4

Update ttyUL major number allocation details in documentation.
Use dynamic allocation for major number when uart ports > 4.
---
Changes for V2:
Introduce 1/2 patch.
Update driver to use either static or dynamic major allocation.
Update commit description.
Update description of SERIAL_UARTLITE_NR_UARTS in Kconfig.
Changes for V3:
Fix typo.
Move description to above of ttyUL.
Remove parentheses.

Manikanta Guntupalli (2):
Documentation: devices.txt: Update ttyUL major number allocation
details
serial: uartlite: Use dynamic allocation for major number when uart
ports > 4

Documentation/admin-guide/devices.txt | 3 +++
drivers/tty/serial/Kconfig | 2 ++
drivers/tty/serial/uartlite.c | 5 +++++
3 files changed, 10 insertions(+)

--
2.25.1


2023-11-16 07:30:48

by Manikanta Guntupalli

[permalink] [raw]
Subject: [PATCH V3 2/2] serial: uartlite: Use dynamic allocation for major number when uart ports > 4

Device number 204 has a range of minors on major number.
uart_register_driver is failing due to lack of minor numbers
when more number of uart ports used. So, to avoid minor number
limitation on 204 major number use dynamic major allocation
when more than 4 uart ports used otherwise use static major
allocation.

https://docs.kernel.org/arch/arm/sa1100/serial_uart.html

Signed-off-by: Manikanta Guntupalli <[email protected]>
---
Changes for V2:
Update logic to use either static or dynamic major allocation.
Update commit description.
Update description of SERIAL_UARTLITE_NR_UARTS in Kconfig.
Changes for V3:
Fix typo.
Remove parentheses.
---
drivers/tty/serial/Kconfig | 2 ++
drivers/tty/serial/uartlite.c | 5 +++++
2 files changed, 7 insertions(+)

diff --git a/drivers/tty/serial/Kconfig b/drivers/tty/serial/Kconfig
index 732c893c8d16..c3c82b740078 100644
--- a/drivers/tty/serial/Kconfig
+++ b/drivers/tty/serial/Kconfig
@@ -532,6 +532,8 @@ config SERIAL_UARTLITE_NR_UARTS
help
Set this to the number of uartlites in your system, or the number
you think you might implement.
+ If maximum number of uartlite serial ports are more than 4, then driver uses
+ dynamic allocation instead of static allocation for major number.

config SERIAL_SUNCORE
bool
diff --git a/drivers/tty/serial/uartlite.c b/drivers/tty/serial/uartlite.c
index 404c14acafa5..66d751edcf45 100644
--- a/drivers/tty/serial/uartlite.c
+++ b/drivers/tty/serial/uartlite.c
@@ -24,8 +24,13 @@
#include <linux/pm_runtime.h>

#define ULITE_NAME "ttyUL"
+#if CONFIG_SERIAL_UARTLITE_NR_UARTS > 4
+#define ULITE_MAJOR 0 /* use dynamic node allocation */
+#define ULITE_MINOR 0
+#else
#define ULITE_MAJOR 204
#define ULITE_MINOR 187
+#endif
#define ULITE_NR_UARTS CONFIG_SERIAL_UARTLITE_NR_UARTS

/* ---------------------------------------------------------------------
--
2.25.1

2023-11-16 10:35:23

by Hugo Villeneuve

[permalink] [raw]
Subject: Re: [PATCH V3 2/2] serial: uartlite: Use dynamic allocation for major number when uart ports > 4

On Thu, 16 Nov 2023 12:59:15 +0530
Manikanta Guntupalli <[email protected]> wrote:

Hi,

> Device number 204 has a range of minors on major number.
> uart_register_driver is failing due to lack of minor numbers
> when more number of uart ports used. So, to avoid minor number
> limitation on 204 major number use dynamic major allocation
> when more than 4 uart ports used otherwise use static major
> allocation.
>
> https://docs.kernel.org/arch/arm/sa1100/serial_uart.html
>
> Signed-off-by: Manikanta Guntupalli <[email protected]>
> ---
> Changes for V2:
> Update logic to use either static or dynamic major allocation.
> Update commit description.
> Update description of SERIAL_UARTLITE_NR_UARTS in Kconfig.
> Changes for V3:
> Fix typo.
> Remove parentheses.
> ---
> drivers/tty/serial/Kconfig | 2 ++
> drivers/tty/serial/uartlite.c | 5 +++++
> 2 files changed, 7 insertions(+)
>
> diff --git a/drivers/tty/serial/Kconfig b/drivers/tty/serial/Kconfig
> index 732c893c8d16..c3c82b740078 100644
> --- a/drivers/tty/serial/Kconfig
> +++ b/drivers/tty/serial/Kconfig
> @@ -532,6 +532,8 @@ config SERIAL_UARTLITE_NR_UARTS
> help
> Set this to the number of uartlites in your system, or the number
> you think you might implement.
> + If maximum number of uartlite serial ports are more than 4, then driver uses

"are more" -> "is more"

"then driver" -> "the driver" (or "then the driver")

Hugo.

> + dynamic allocation instead of static allocation for major number.
>
> config SERIAL_SUNCORE
> bool
> diff --git a/drivers/tty/serial/uartlite.c b/drivers/tty/serial/uartlite.c
> index 404c14acafa5..66d751edcf45 100644
> --- a/drivers/tty/serial/uartlite.c
> +++ b/drivers/tty/serial/uartlite.c
> @@ -24,8 +24,13 @@
> #include <linux/pm_runtime.h>
>
> #define ULITE_NAME "ttyUL"
> +#if CONFIG_SERIAL_UARTLITE_NR_UARTS > 4
> +#define ULITE_MAJOR 0 /* use dynamic node allocation */
> +#define ULITE_MINOR 0
> +#else
> #define ULITE_MAJOR 204
> #define ULITE_MINOR 187
> +#endif
> #define ULITE_NR_UARTS CONFIG_SERIAL_UARTLITE_NR_UARTS
>
> /* ---------------------------------------------------------------------
> --
> 2.25.1
>


--
Hugo Villeneuve <[email protected]>