serial: uartlite: Use dynamic allocation for major number when uart ports > 4
authorManikanta Guntupalli <manikanta.guntupalli@amd.com>
Thu, 16 Nov 2023 13:40:03 +0000 (19:10 +0530)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 25 Nov 2023 07:23:16 +0000 (07:23 +0000)
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>
Link: https://lore.kernel.org/r/20231116134003.3762725-3-manikanta.guntupalli@amd.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/tty/serial/Kconfig
drivers/tty/serial/uartlite.c

index 732c893c8d161815b476bf815ee689c92e3f25a9..8b1f5756002f815cd03d43f8d2ebb64e73e65750 100644 (file)
@@ -532,6 +532,9 @@ 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 is more than 4, then the
+         driver uses dynamic allocation instead of static allocation for major
+         number.
 
 config SERIAL_SUNCORE
        bool
index f9c69f543a26c73e684e7676de124b89ecad4d1d..10ba41b7be9944fcc93fc12969b7f06e48abc0da 100644 (file)
 #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
 
 /* ---------------------------------------------------------------------