Commit ab262666 authored by Shubhrajyoti Datta's avatar Shubhrajyoti Datta Committed by Greg Kroah-Hartman

serial: uartps: Use the same dynamic major number for all ports

Let kernel to find out major number dynamically for the first device and
then reuse it for other instances.
This fixes the issue that each uart is registered with a
different major number.

After the patch:
crw-------    1 root     root      253,   0 Jun 10 08:31 /dev/ttyPS0
crw--w----    1 root     root      253,   1 Jan  1  1970 /dev/ttyPS1

Fixes: 024ca329 ("serial: uartps: Register own uart console and driver structures")
Signed-off-by: default avatarShubhrajyoti Datta <shubhrajyoti.datta@xilinx.com>
Signed-off-by: default avatarMichal Simek <michal.simek@xilinx.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 6bf4e42f
...@@ -30,13 +30,13 @@ ...@@ -30,13 +30,13 @@
#define CDNS_UART_TTY_NAME "ttyPS" #define CDNS_UART_TTY_NAME "ttyPS"
#define CDNS_UART_NAME "xuartps" #define CDNS_UART_NAME "xuartps"
#define CDNS_UART_MAJOR 0 /* use dynamic node allocation */
#define CDNS_UART_FIFO_SIZE 64 /* FIFO size */ #define CDNS_UART_FIFO_SIZE 64 /* FIFO size */
#define CDNS_UART_REGISTER_SPACE 0x1000 #define CDNS_UART_REGISTER_SPACE 0x1000
#define TX_TIMEOUT 500000 #define TX_TIMEOUT 500000
/* Rx Trigger level */ /* Rx Trigger level */
static int rx_trigger_level = 56; static int rx_trigger_level = 56;
static int uartps_major;
module_param(rx_trigger_level, uint, S_IRUGO); module_param(rx_trigger_level, uint, S_IRUGO);
MODULE_PARM_DESC(rx_trigger_level, "Rx trigger level, 1-63 bytes"); MODULE_PARM_DESC(rx_trigger_level, "Rx trigger level, 1-63 bytes");
...@@ -1522,7 +1522,7 @@ static int cdns_uart_probe(struct platform_device *pdev) ...@@ -1522,7 +1522,7 @@ static int cdns_uart_probe(struct platform_device *pdev)
cdns_uart_uart_driver->owner = THIS_MODULE; cdns_uart_uart_driver->owner = THIS_MODULE;
cdns_uart_uart_driver->driver_name = driver_name; cdns_uart_uart_driver->driver_name = driver_name;
cdns_uart_uart_driver->dev_name = CDNS_UART_TTY_NAME; cdns_uart_uart_driver->dev_name = CDNS_UART_TTY_NAME;
cdns_uart_uart_driver->major = CDNS_UART_MAJOR; cdns_uart_uart_driver->major = uartps_major;
cdns_uart_uart_driver->minor = cdns_uart_data->id; cdns_uart_uart_driver->minor = cdns_uart_data->id;
cdns_uart_uart_driver->nr = 1; cdns_uart_uart_driver->nr = 1;
...@@ -1551,6 +1551,7 @@ static int cdns_uart_probe(struct platform_device *pdev) ...@@ -1551,6 +1551,7 @@ static int cdns_uart_probe(struct platform_device *pdev)
goto err_out_id; goto err_out_id;
} }
uartps_major = cdns_uart_uart_driver->tty_driver->major;
cdns_uart_data->cdns_uart_driver = cdns_uart_uart_driver; cdns_uart_data->cdns_uart_driver = cdns_uart_uart_driver;
/* /*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment