History

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.

Tobias Klauser committed 11 years ago

Commit d144aff1 parent acccab41 file · +2 −24Browse files

Unified · Split

drivers/tty/serial/altera_uart.c+2−24
@@ -508,29 +508,6 @@ static struct uart_driver altera_uart_driver = { · 507 unmodified lines
508508 .cons = ALTERA_UART_CONSOLE,
509509 };
510510
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−
534511 static int altera_uart_probe(struct platform_device *pdev)
535512 {
536513 struct altera_uart_platform_uart *platp = dev_get_platdata(&pdev->dev);
@@ -570,7 +547,8 @@ static int altera_uart_probe(struct platform_device *pdev) · 33 unmodified lines
570547 if (platp)
571548 port->uartclk = platp->uartclk;
572549 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);
574552 if (ret)
575553 return ret;
576554 }

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t