Skip to content

Commit

Permalink
Revert "serial: uartps: Move Port ID to device data structure"
Browse files Browse the repository at this point in the history
commit 492cc08 upstream.

This reverts commit bed25ac.

As Johan says, this driver needs a lot more work and these changes are
only going in the wrong direction:
  https://lkml.kernel.org/r/20190523091839.GC568@localhost

Reported-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Cc: stable <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/eb0ec98fecdca9b79c1a3ac0c30c668b6973b193.1585905873.git.michal.simek@xilinx.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Michal Simek authored and Greg Kroah-Hartman committed Apr 29, 2020
1 parent f1a2c64 commit ec37770
Showing 1 changed file with 9 additions and 11 deletions.
20 changes: 9 additions & 11 deletions drivers/tty/serial/xilinx_uartps.c
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,6 @@ MODULE_PARM_DESC(rx_timeout, "Rx timeout, 1-255");
* @pclk: APB clock
* @cdns_uart_driver: Pointer to UART driver
* @baud: Current baud rate
* @id: Port ID
* @clk_rate_change_nb: Notifier block for clock changes
* @quirks: Flags for RXBS support.
*/
Expand All @@ -199,7 +198,6 @@ struct cdns_uart {
struct clk *pclk;
struct uart_driver *cdns_uart_driver;
unsigned int baud;
int id;
struct notifier_block clk_rate_change_nb;
u32 quirks;
bool cts_override;
Expand Down Expand Up @@ -1424,7 +1422,7 @@ MODULE_DEVICE_TABLE(of, cdns_uart_of_match);
*/
static int cdns_uart_probe(struct platform_device *pdev)
{
int rc, irq;
int rc, id, irq;
struct uart_port *port;
struct resource *res;
struct cdns_uart *cdns_uart_data;
Expand All @@ -1450,26 +1448,26 @@ static int cdns_uart_probe(struct platform_device *pdev)
return -ENOMEM;

/* Look for a serialN alias */
cdns_uart_data->id = of_alias_get_id(pdev->dev.of_node, "serial");
if (cdns_uart_data->id < 0)
cdns_uart_data->id = 0;
id = of_alias_get_id(pdev->dev.of_node, "serial");
if (id < 0)
id = 0;

if (cdns_uart_data->id >= CDNS_UART_NR_PORTS) {
if (id >= CDNS_UART_NR_PORTS) {
dev_err(&pdev->dev, "Cannot get uart_port structure\n");
return -ENODEV;
}

/* There is a need to use unique driver name */
driver_name = devm_kasprintf(&pdev->dev, GFP_KERNEL, "%s%d",
CDNS_UART_NAME, cdns_uart_data->id);
CDNS_UART_NAME, id);
if (!driver_name)
return -ENOMEM;

cdns_uart_uart_driver->owner = THIS_MODULE;
cdns_uart_uart_driver->driver_name = driver_name;
cdns_uart_uart_driver->dev_name = CDNS_UART_TTY_NAME;
cdns_uart_uart_driver->major = CDNS_UART_MAJOR;
cdns_uart_uart_driver->minor = cdns_uart_data->id;
cdns_uart_uart_driver->minor = id;
cdns_uart_uart_driver->nr = 1;

#ifdef CONFIG_SERIAL_XILINX_PS_UART_CONSOLE
Expand All @@ -1480,7 +1478,7 @@ static int cdns_uart_probe(struct platform_device *pdev)

strncpy(cdns_uart_console->name, CDNS_UART_TTY_NAME,
sizeof(cdns_uart_console->name));
cdns_uart_console->index = cdns_uart_data->id;
cdns_uart_console->index = id;
cdns_uart_console->write = cdns_uart_console_write;
cdns_uart_console->device = uart_console_device;
cdns_uart_console->setup = cdns_uart_console_setup;
Expand All @@ -1502,7 +1500,7 @@ static int cdns_uart_probe(struct platform_device *pdev)
* registration because tty_driver structure is not filled.
* name_base is 0 by default.
*/
cdns_uart_uart_driver->tty_driver->name_base = cdns_uart_data->id;
cdns_uart_uart_driver->tty_driver->name_base = id;

match = of_match_node(cdns_uart_of_match, pdev->dev.of_node);
if (match && match->data) {
Expand Down

0 comments on commit ec37770

Please sign in to comment.