linux-serial.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH V2 0/2] Use dynamic allocation for major number when uart ports > 4
@ 2023-11-14  9:33 Manikanta Guntupalli
  2023-11-14  9:33 ` [PATCH V2 1/2] Documentation: devices.txt: Update ttyUL major number allocation details Manikanta Guntupalli
  2023-11-14  9:33 ` [PATCH V2 2/2] serial: uartlite: Use dynamic allocation for major number when uart ports > 4 Manikanta Guntupalli
  0 siblings, 2 replies; 5+ messages in thread
From: Manikanta Guntupalli @ 2023-11-14  9:33 UTC (permalink / raw)
  To: git, michal.simek, jacmet, gregkh, jirislaby, linux-serial,
	linux-kernel, corbet, christophe.leroy, rdunlap, airlied, ogabbay,
	linux-doc
  Cc: radhey.shyam.pandey, srinivas.goud, shubhrajyoti.datta,
	manion05gk, Manikanta Guntupalli

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.

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 | 4 ++++
 drivers/tty/serial/Kconfig            | 2 ++
 drivers/tty/serial/uartlite.c         | 5 +++++
 3 files changed, 11 insertions(+)

-- 
2.25.1


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

* [PATCH V2 1/2] Documentation: devices.txt: Update ttyUL major number allocation details
  2023-11-14  9:33 [PATCH V2 0/2] Use dynamic allocation for major number when uart ports > 4 Manikanta Guntupalli
@ 2023-11-14  9:33 ` Manikanta Guntupalli
  2023-11-14  9:49   ` Jiri Slaby
  2023-11-14  9:33 ` [PATCH V2 2/2] serial: uartlite: Use dynamic allocation for major number when uart ports > 4 Manikanta Guntupalli
  1 sibling, 1 reply; 5+ messages in thread
From: Manikanta Guntupalli @ 2023-11-14  9:33 UTC (permalink / raw)
  To: git, michal.simek, jacmet, gregkh, jirislaby, linux-serial,
	linux-kernel, corbet, christophe.leroy, rdunlap, airlied, ogabbay,
	linux-doc
  Cc: radhey.shyam.pandey, srinivas.goud, shubhrajyoti.datta,
	manion05gk, Manikanta Guntupalli

Describe when uartlite driver uses static/dynamic allocation for major
number based on maximum number of uartlite serial ports.

Signed-off-by: Manikanta Guntupalli <manikanta.guntupalli@amd.com>
---
Changes for V2:
This patch introduced in V2.
---
 Documentation/admin-guide/devices.txt | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/Documentation/admin-guide/devices.txt b/Documentation/admin-guide/devices.txt
index 839054923530..d2f2c9f436db 100644
--- a/Documentation/admin-guide/devices.txt
+++ b/Documentation/admin-guide/devices.txt
@@ -2707,6 +2707,10 @@
 		 187 = /dev/ttyUL0		Xilinx uartlite - port 0
 		    ...
 		 190 = /dev/ttyUL3		Xilinx uartlite - port 3
+
+		 If maximum number of uartlite serial ports more than 4, then driver uses
+		 dynamic allocation instead of static allocation for major number.
+
 		 191 = /dev/xvc0		Xen virtual console - port 0
 		 192 = /dev/ttyPZ0		pmac_zilog - port 0
 		    ...
-- 
2.25.1


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

* [PATCH V2 2/2] serial: uartlite: Use dynamic allocation for major number when uart ports > 4
  2023-11-14  9:33 [PATCH V2 0/2] Use dynamic allocation for major number when uart ports > 4 Manikanta Guntupalli
  2023-11-14  9:33 ` [PATCH V2 1/2] Documentation: devices.txt: Update ttyUL major number allocation details Manikanta Guntupalli
@ 2023-11-14  9:33 ` Manikanta Guntupalli
  2023-11-14  9:48   ` Jiri Slaby
  1 sibling, 1 reply; 5+ messages in thread
From: Manikanta Guntupalli @ 2023-11-14  9:33 UTC (permalink / raw)
  To: git, michal.simek, jacmet, gregkh, jirislaby, linux-serial,
	linux-kernel, corbet, christophe.leroy, rdunlap, airlied, ogabbay,
	linux-doc
  Cc: radhey.shyam.pandey, srinivas.goud, shubhrajyoti.datta,
	manion05gk, Manikanta Guntupalli

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 <manikanta.guntupalli@amd.com>
---
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.
---
 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..368c63066a86 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 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..517f1f34143d 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


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

* Re: [PATCH V2 2/2] serial: uartlite: Use dynamic allocation for major number when uart ports > 4
  2023-11-14  9:33 ` [PATCH V2 2/2] serial: uartlite: Use dynamic allocation for major number when uart ports > 4 Manikanta Guntupalli
@ 2023-11-14  9:48   ` Jiri Slaby
  0 siblings, 0 replies; 5+ messages in thread
From: Jiri Slaby @ 2023-11-14  9:48 UTC (permalink / raw)
  To: Manikanta Guntupalli, git, michal.simek, jacmet, gregkh,
	linux-serial, linux-kernel, corbet, christophe.leroy, rdunlap,
	airlied, ogabbay, linux-doc
  Cc: radhey.shyam.pandey, srinivas.goud, shubhrajyoti.datta,
	manion05gk

On 14. 11. 23, 10:33, Manikanta Guntupalli wrote:
> 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 <manikanta.guntupalli@amd.com>
> ---
> 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.
> ---
>   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..368c63066a86 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 more than 4,

A verb is missing. The same in patch 1/2.

> 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..517f1f34143d 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)

The parentheses are unneeded, right?

> +#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
>   
>   /* ---------------------------------------------------------------------

-- 
js
suse labs


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

* Re: [PATCH V2 1/2] Documentation: devices.txt: Update ttyUL major number allocation details
  2023-11-14  9:33 ` [PATCH V2 1/2] Documentation: devices.txt: Update ttyUL major number allocation details Manikanta Guntupalli
@ 2023-11-14  9:49   ` Jiri Slaby
  0 siblings, 0 replies; 5+ messages in thread
From: Jiri Slaby @ 2023-11-14  9:49 UTC (permalink / raw)
  To: Manikanta Guntupalli, git, michal.simek, jacmet, gregkh,
	linux-serial, linux-kernel, corbet, christophe.leroy, rdunlap,
	airlied, ogabbay, linux-doc
  Cc: radhey.shyam.pandey, srinivas.goud, shubhrajyoti.datta,
	manion05gk

On 14. 11. 23, 10:33, Manikanta Guntupalli wrote:
> Describe when uartlite driver uses static/dynamic allocation for major
> number based on maximum number of uartlite serial ports.
> 
> Signed-off-by: Manikanta Guntupalli <manikanta.guntupalli@amd.com>
> ---
> Changes for V2:
> This patch introduced in V2.
> ---
>   Documentation/admin-guide/devices.txt | 4 ++++
>   1 file changed, 4 insertions(+)
> 
> diff --git a/Documentation/admin-guide/devices.txt b/Documentation/admin-guide/devices.txt
> index 839054923530..d2f2c9f436db 100644
> --- a/Documentation/admin-guide/devices.txt
> +++ b/Documentation/admin-guide/devices.txt
> @@ -2707,6 +2707,10 @@
>   		 187 = /dev/ttyUL0		Xilinx uartlite - port 0
>   		    ...
>   		 190 = /dev/ttyUL3		Xilinx uartlite - port 3
> +
> +		 If maximum number of uartlite serial ports more than 4, then driver uses
> +		 dynamic allocation instead of static allocation for major number.

I am not sure about the placement of this comment. This looks like it 
holds for xvc below.

>   		 191 = /dev/xvc0		Xen virtual console - port 0
>   		 192 = /dev/ttyPZ0		pmac_zilog - port 0
>   		    ...

-- 
js
suse labs


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

end of thread, other threads:[~2023-11-14  9:49 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-11-14  9:33 [PATCH V2 0/2] Use dynamic allocation for major number when uart ports > 4 Manikanta Guntupalli
2023-11-14  9:33 ` [PATCH V2 1/2] Documentation: devices.txt: Update ttyUL major number allocation details Manikanta Guntupalli
2023-11-14  9:49   ` Jiri Slaby
2023-11-14  9:33 ` [PATCH V2 2/2] serial: uartlite: Use dynamic allocation for major number when uart ports > 4 Manikanta Guntupalli
2023-11-14  9:48   ` Jiri Slaby

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).