Commit af99c187 authored by Geert Uytterhoeven's avatar Geert Uytterhoeven Committed by Greg Kroah-Hartman

serial: sirf: Introduce helper variable struct device_node *np

Signed-off-by: default avatarGeert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 182cdcb8
...@@ -1264,6 +1264,7 @@ MODULE_DEVICE_TABLE(of, sirfsoc_uart_ids); ...@@ -1264,6 +1264,7 @@ MODULE_DEVICE_TABLE(of, sirfsoc_uart_ids);
static int sirfsoc_uart_probe(struct platform_device *pdev) static int sirfsoc_uart_probe(struct platform_device *pdev)
{ {
struct device_node *np = pdev->dev.of_node;
struct sirfsoc_uart_port *sirfport; struct sirfsoc_uart_port *sirfport;
struct uart_port *port; struct uart_port *port;
struct resource *res; struct resource *res;
...@@ -1276,13 +1277,13 @@ static int sirfsoc_uart_probe(struct platform_device *pdev) ...@@ -1276,13 +1277,13 @@ static int sirfsoc_uart_probe(struct platform_device *pdev)
}; };
const struct of_device_id *match; const struct of_device_id *match;
match = of_match_node(sirfsoc_uart_ids, pdev->dev.of_node); match = of_match_node(sirfsoc_uart_ids, np);
sirfport = devm_kzalloc(&pdev->dev, sizeof(*sirfport), GFP_KERNEL); sirfport = devm_kzalloc(&pdev->dev, sizeof(*sirfport), GFP_KERNEL);
if (!sirfport) { if (!sirfport) {
ret = -ENOMEM; ret = -ENOMEM;
goto err; goto err;
} }
sirfport->port.line = of_alias_get_id(pdev->dev.of_node, "serial"); sirfport->port.line = of_alias_get_id(np, "serial");
sirf_ports[sirfport->port.line] = sirfport; sirf_ports[sirfport->port.line] = sirfport;
sirfport->port.iotype = UPIO_MEM; sirfport->port.iotype = UPIO_MEM;
sirfport->port.flags = UPF_BOOT_AUTOCONF; sirfport->port.flags = UPF_BOOT_AUTOCONF;
...@@ -1291,25 +1292,24 @@ static int sirfsoc_uart_probe(struct platform_device *pdev) ...@@ -1291,25 +1292,24 @@ static int sirfsoc_uart_probe(struct platform_device *pdev)
port->private_data = sirfport; port->private_data = sirfport;
sirfport->uart_reg = (struct sirfsoc_uart_register *)match->data; sirfport->uart_reg = (struct sirfsoc_uart_register *)match->data;
sirfport->hw_flow_ctrl = of_property_read_bool(pdev->dev.of_node, sirfport->hw_flow_ctrl =
"sirf,uart-has-rtscts"); of_property_read_bool(np, "sirf,uart-has-rtscts");
if (of_device_is_compatible(pdev->dev.of_node, "sirf,prima2-uart") || if (of_device_is_compatible(np, "sirf,prima2-uart") ||
of_device_is_compatible(pdev->dev.of_node, "sirf,atlas7-uart")) of_device_is_compatible(np, "sirf,atlas7-uart"))
sirfport->uart_reg->uart_type = SIRF_REAL_UART; sirfport->uart_reg->uart_type = SIRF_REAL_UART;
if (of_device_is_compatible(pdev->dev.of_node, if (of_device_is_compatible(np, "sirf,prima2-usp-uart") ||
"sirf,prima2-usp-uart") || of_device_is_compatible( of_device_is_compatible(np, "sirf,atlas7-usp-uart")) {
pdev->dev.of_node, "sirf,atlas7-usp-uart")) {
sirfport->uart_reg->uart_type = SIRF_USP_UART; sirfport->uart_reg->uart_type = SIRF_USP_UART;
if (!sirfport->hw_flow_ctrl) if (!sirfport->hw_flow_ctrl)
goto usp_no_flow_control; goto usp_no_flow_control;
if (of_find_property(pdev->dev.of_node, "cts-gpios", NULL)) if (of_find_property(np, "cts-gpios", NULL))
sirfport->cts_gpio = of_get_named_gpio( sirfport->cts_gpio =
pdev->dev.of_node, "cts-gpios", 0); of_get_named_gpio(np, "cts-gpios", 0);
else else
sirfport->cts_gpio = -1; sirfport->cts_gpio = -1;
if (of_find_property(pdev->dev.of_node, "rts-gpios", NULL)) if (of_find_property(np, "rts-gpios", NULL))
sirfport->rts_gpio = of_get_named_gpio( sirfport->rts_gpio =
pdev->dev.of_node, "rts-gpios", 0); of_get_named_gpio(np, "rts-gpios", 0);
else else
sirfport->rts_gpio = -1; sirfport->rts_gpio = -1;
...@@ -1336,13 +1336,11 @@ static int sirfsoc_uart_probe(struct platform_device *pdev) ...@@ -1336,13 +1336,11 @@ static int sirfsoc_uart_probe(struct platform_device *pdev)
gpio_direction_output(sirfport->rts_gpio, 1); gpio_direction_output(sirfport->rts_gpio, 1);
} }
usp_no_flow_control: usp_no_flow_control:
if (of_device_is_compatible(pdev->dev.of_node, "sirf,atlas7-uart") || if (of_device_is_compatible(np, "sirf,atlas7-uart") ||
of_device_is_compatible(pdev->dev.of_node, "sirf,atlas7-usp-uart")) of_device_is_compatible(np, "sirf,atlas7-usp-uart"))
sirfport->is_atlas7 = true; sirfport->is_atlas7 = true;
if (of_property_read_u32(pdev->dev.of_node, if (of_property_read_u32(np, "fifosize", &port->fifosize)) {
"fifosize",
&port->fifosize)) {
dev_err(&pdev->dev, dev_err(&pdev->dev,
"Unable to find fifosize in uart node.\n"); "Unable to find fifosize in uart node.\n");
ret = -EFAULT; ret = -EFAULT;
......
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