Commit 14090ad1 authored by Michal Simek's avatar Michal Simek Committed by Greg Kroah-Hartman

serial: uartps: Move alias reading higher in probe()

This cosmetic change is done only for having next patch much easier to
read. Moving id setup higher in probe is not affecting any usage of this
driver and it also simplify error path.
Signed-off-by: default avatarMichal Simek <michal.simek@xilinx.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 46a460f0
...@@ -1416,6 +1416,16 @@ static int cdns_uart_probe(struct platform_device *pdev) ...@@ -1416,6 +1416,16 @@ static int cdns_uart_probe(struct platform_device *pdev)
if (!port) if (!port)
return -ENOMEM; return -ENOMEM;
/* Look for a serialN alias */
id = of_alias_get_id(pdev->dev.of_node, "serial");
if (id < 0)
id = 0;
if (id >= CDNS_UART_NR_PORTS) {
dev_err(&pdev->dev, "Cannot get uart_port structure\n");
return -ENODEV;
}
cdns_uart_data->cdns_uart_driver = &cdns_uart_uart_driver; cdns_uart_data->cdns_uart_driver = &cdns_uart_uart_driver;
match = of_match_node(cdns_uart_of_match, pdev->dev.of_node); match = of_match_node(cdns_uart_of_match, pdev->dev.of_node);
...@@ -1477,16 +1487,6 @@ static int cdns_uart_probe(struct platform_device *pdev) ...@@ -1477,16 +1487,6 @@ static int cdns_uart_probe(struct platform_device *pdev)
&cdns_uart_data->clk_rate_change_nb)) &cdns_uart_data->clk_rate_change_nb))
dev_warn(&pdev->dev, "Unable to register clock notifier.\n"); dev_warn(&pdev->dev, "Unable to register clock notifier.\n");
#endif #endif
/* Look for a serialN alias */
id = of_alias_get_id(pdev->dev.of_node, "serial");
if (id < 0)
id = 0;
if (id >= CDNS_UART_NR_PORTS) {
dev_err(&pdev->dev, "Cannot get uart_port structure\n");
rc = -ENODEV;
goto err_out_notif_unreg;
}
/* At this point, we've got an empty uart_port struct, initialize it */ /* At this point, we've got an empty uart_port struct, initialize it */
spin_lock_init(&port->lock); spin_lock_init(&port->lock);
...@@ -1545,7 +1545,6 @@ static int cdns_uart_probe(struct platform_device *pdev) ...@@ -1545,7 +1545,6 @@ static int cdns_uart_probe(struct platform_device *pdev)
pm_runtime_disable(&pdev->dev); pm_runtime_disable(&pdev->dev);
pm_runtime_set_suspended(&pdev->dev); pm_runtime_set_suspended(&pdev->dev);
pm_runtime_dont_use_autosuspend(&pdev->dev); pm_runtime_dont_use_autosuspend(&pdev->dev);
err_out_notif_unreg:
#ifdef CONFIG_COMMON_CLK #ifdef CONFIG_COMMON_CLK
clk_notifier_unregister(cdns_uart_data->uartclk, clk_notifier_unregister(cdns_uart_data->uartclk,
&cdns_uart_data->clk_rate_change_nb); &cdns_uart_data->clk_rate_change_nb);
......
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