060-v5.1-serial-ar933x_uart-Fix-build-failure-with-disabled-c.patch 3.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. From 72ff51d8dd262d1fef25baedc2ac35116435be47 Mon Sep 17 00:00:00 2001
  2. From: =?UTF-8?q?Petr=20=C5=A0tetiar?= <[email protected]>
  3. Date: Wed, 6 Mar 2019 17:54:03 +0100
  4. Subject: [PATCH] serial: ar933x_uart: Fix build failure with disabled console
  5. MIME-Version: 1.0
  6. Content-Type: text/plain; charset=UTF-8
  7. Content-Transfer-Encoding: 8bit
  8. Andrey has reported on OpenWrt's bug tracking system[1], that he
  9. currently can't use ar93xx_uart as pure serial UART without console
  10. (CONFIG_SERIAL_8250_CONSOLE and CONFIG_SERIAL_AR933X_CONSOLE undefined),
  11. because compilation ends with following error:
  12. ar933x_uart.c: In function 'ar933x_uart_console_write':
  13. ar933x_uart.c:550:14: error: 'struct uart_port' has no
  14. member named 'sysrq'
  15. So this patch moves all the code related to console handling behind
  16. series of CONFIG_SERIAL_AR933X_CONSOLE ifdefs.
  17. 1. https://bugs.openwrt.org/index.php?do=details&task_id=2152
  18. Cc: Greg Kroah-Hartman <[email protected]>
  19. Cc: Jiri Slaby <[email protected]>
  20. Cc: Andrey Batyiev <[email protected]>
  21. Reported-by: Andrey Batyiev <[email protected]>
  22. Tested-by: Andrey Batyiev <[email protected]>
  23. Signed-off-by: Petr Štetiar <[email protected]>
  24. Signed-off-by: Greg Kroah-Hartman <[email protected]>
  25. ---
  26. drivers/tty/serial/ar933x_uart.c | 24 ++++++++----------------
  27. 1 file changed, 8 insertions(+), 16 deletions(-)
  28. --- a/drivers/tty/serial/ar933x_uart.c
  29. +++ b/drivers/tty/serial/ar933x_uart.c
  30. @@ -49,11 +49,6 @@ struct ar933x_uart_port {
  31. struct clk *clk;
  32. };
  33. -static inline bool ar933x_uart_console_enabled(void)
  34. -{
  35. - return IS_ENABLED(CONFIG_SERIAL_AR933X_CONSOLE);
  36. -}
  37. -
  38. static inline unsigned int ar933x_uart_read(struct ar933x_uart_port *up,
  39. int offset)
  40. {
  41. @@ -508,6 +503,7 @@ static const struct uart_ops ar933x_uart
  42. .verify_port = ar933x_uart_verify_port,
  43. };
  44. +#ifdef CONFIG_SERIAL_AR933X_CONSOLE
  45. static struct ar933x_uart_port *
  46. ar933x_console_ports[CONFIG_SERIAL_AR933X_NR_UARTS];
  47. @@ -604,14 +600,7 @@ static struct console ar933x_uart_consol
  48. .index = -1,
  49. .data = &ar933x_uart_driver,
  50. };
  51. -
  52. -static void ar933x_uart_add_console_port(struct ar933x_uart_port *up)
  53. -{
  54. - if (!ar933x_uart_console_enabled())
  55. - return;
  56. -
  57. - ar933x_console_ports[up->port.line] = up;
  58. -}
  59. +#endif /* CONFIG_SERIAL_AR933X_CONSOLE */
  60. static struct uart_driver ar933x_uart_driver = {
  61. .owner = THIS_MODULE,
  62. @@ -700,7 +689,9 @@ static int ar933x_uart_probe(struct plat
  63. baud = ar933x_uart_get_baud(port->uartclk, 0, AR933X_UART_MAX_STEP);
  64. up->max_baud = min_t(unsigned int, baud, AR933X_UART_MAX_BAUD);
  65. - ar933x_uart_add_console_port(up);
  66. +#ifdef CONFIG_SERIAL_AR933X_CONSOLE
  67. + ar933x_console_ports[up->port.line] = up;
  68. +#endif
  69. ret = uart_add_one_port(&ar933x_uart_driver, &up->port);
  70. if (ret)
  71. @@ -749,8 +740,9 @@ static int __init ar933x_uart_init(void)
  72. {
  73. int ret;
  74. - if (ar933x_uart_console_enabled())
  75. - ar933x_uart_driver.cons = &ar933x_uart_console;
  76. +#ifdef CONFIG_SERIAL_AR933X_CONSOLE
  77. + ar933x_uart_driver.cons = &ar933x_uart_console;
  78. +#endif
  79. ret = uart_register_driver(&ar933x_uart_driver);
  80. if (ret)