diff options
author | Tobias Klauser <tklauser@distanz.ch> | 2015-09-09 14:34:12 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2015-10-04 12:47:49 -0400 |
commit | d144aff1363a332e43be3cb431f6f8600a449cdc (patch) | |
tree | b378371f2babbd95da26e4002396bf011a4fb504 | |
parent | acccab429be7fd83987214c50cfde057ea71d118 (diff) |
serial: altera_uart: Use of_property_read_u32 instead of open-coding it
Use of_property_read_u32 instead of of_get_property with return value
checks and endianness conversion. Also remove the !CONFIG_OF
implementation of altera_uart_get_of_uartclk as of_property_read_u32
will return a non-zero value for !CONFIG_OF.
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r-- | drivers/tty/serial/altera_uart.c | 26 |
1 files changed, 2 insertions, 24 deletions
diff --git a/drivers/tty/serial/altera_uart.c b/drivers/tty/serial/altera_uart.c index fd87a6f574e3..61b607f2488e 100644 --- a/drivers/tty/serial/altera_uart.c +++ b/drivers/tty/serial/altera_uart.c | |||
@@ -508,29 +508,6 @@ static struct uart_driver altera_uart_driver = { | |||
508 | .cons = ALTERA_UART_CONSOLE, | 508 | .cons = ALTERA_UART_CONSOLE, |
509 | }; | 509 | }; |
510 | 510 | ||
511 | #ifdef CONFIG_OF | ||
512 | static int altera_uart_get_of_uartclk(struct platform_device *pdev, | ||
513 | struct uart_port *port) | ||
514 | { | ||
515 | int len; | ||
516 | const __be32 *clk; | ||
517 | |||
518 | clk = of_get_property(pdev->dev.of_node, "clock-frequency", &len); | ||
519 | if (!clk || len < sizeof(__be32)) | ||
520 | return -ENODEV; | ||
521 | |||
522 | port->uartclk = be32_to_cpup(clk); | ||
523 | |||
524 | return 0; | ||
525 | } | ||
526 | #else | ||
527 | static int altera_uart_get_of_uartclk(struct platform_device *pdev, | ||
528 | struct uart_port *port) | ||
529 | { | ||
530 | return -ENODEV; | ||
531 | } | ||
532 | #endif /* CONFIG_OF */ | ||
533 | |||
534 | static int altera_uart_probe(struct platform_device *pdev) | 511 | static int altera_uart_probe(struct platform_device *pdev) |
535 | { | 512 | { |
536 | struct altera_uart_platform_uart *platp = dev_get_platdata(&pdev->dev); | 513 | struct altera_uart_platform_uart *platp = dev_get_platdata(&pdev->dev); |
@@ -570,7 +547,8 @@ static int altera_uart_probe(struct platform_device *pdev) | |||
570 | if (platp) | 547 | if (platp) |
571 | port->uartclk = platp->uartclk; | 548 | port->uartclk = platp->uartclk; |
572 | else { | 549 | else { |
573 | ret = altera_uart_get_of_uartclk(pdev, port); | 550 | ret = of_property_read_u32(pdev->dev.of_node, "clock-frequency", |
551 | &port->uartclk); | ||
574 | if (ret) | 552 | if (ret) |
575 | return ret; | 553 | return ret; |
576 | } | 554 | } |