serial: pic32: Fix build warning when CONFIG_OF is disabled
PATCH 1/1 serial: pic32: Fix build warning when CONFIG_OF is disabled
As reported by the kernel test robot, the following warning occurs:
Quoted 1 line
Quoted 1 line
drivers/tty/serial/pic32_uart.c:904:34: warning: 'pic32_serial_dt_ids' defined but not used [-Wunused-const-variable=]
904 | static const struct of_device_id pic32_serial_dt_ids[] = {
| ^~~~~~~~~~~~~~~~~~~The 'pic32_serial_dt_ids' array is only used when CONFIG_OF is enabled. Wrapping its definition and 'MODULE_DEVICE_TABLE' in '#ifdef CONFIG_OF' prevents a compiler warning when OF is disabled.
--- drivers/tty/serial/pic32_uart.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/tty/serial/pic32_uart.c +2 -0
@@ -948,11 +948,13 @@ static void pic32_uart_remove(struct platform_device *pdev) pic32_sports[sport->idx] =NULL ; } +#ifdef CONFIG_OF static const struct of_device_id pic32_serial_dt_ids[] = { { .compatible ="microchip,pic32mzda-uart" }, {/* sentinel */ } };MODULE_DEVICE_TABLE (of, pic32_serial_dt_ids); +#endif static struct platform_driver pic32_uart_platform_driver = { .probe = pic32_uart_probe,
Signature · 1 line
2.43.0
Greg KH
maintainerQuoted 22 lines · Yu-Chun Lin
As reported by the kernel test robot, the following warning occurs:
Quoted 1 line
Quoted 1 line
drivers/tty/serial/pic32_uart.c:904:34: warning: 'pic32_serial_dt_ids' defined but not used [-Wunused-const-variable=]904 | static const struct of_device_id pic32_serial_dt_ids[] = { | ^~~~~~~~~~~~~~~~~~~The '
pic32_serial_dt_ids' array is only used whenCONFIG_OFis enabled. Wrapping its definition and 'MODULE_DEVICE_TABLE' in '#ifdefCONFIG_OF' prevents a compiler warning when OF is disabled.Reported-by kernel test robot <[email protected]>Signed-off-by Yu-Chun Lin <[email protected]>--- drivers/tty/serial/pic32_uart.c | 2 ++ 1 file changed, 2 insertions(+)drivers/tty/serial/pic32_uart.c +0
-0
drivers/tty/serial/pic32_uart.c static void pic32_uart_remove(struct platform_device *pdev) · line 957
Quoted 10 lines
drivers/tty/serial/pic32_uart.c +2
-0@@ -948,11 +948,13 @@ static void pic32_uart_remove(struct platform_device *pdev) pic32_sports[sport->idx] =NULL ; } +#ifdef CONFIG_OF static const struct of_device_id pic32_serial_dt_ids[] = { { .compatible ="microchip,pic32mzda-uart" }, {/* sentinel */ } };MODULE_DEVICE_TABLE (of, pic32_serial_dt_ids); +#endif
That should not be needed, no other bus requires this, please fix up the use of the OF macros instead.
thanks,
greg k-h
Quoted 26 lines · Greg KH
Quoted 25 lines · Yu-Chun Lin
As reported by the kernel test robot, the following warning occurs:
Quoted 1 line
Quoted 1 line
drivers/tty/serial/pic32_uart.c:904:34: warning: 'pic32_serial_dt_ids' defined but not used [-Wunused-const-variable=]904 | static const struct of_device_id pic32_serial_dt_ids[] = { | ^~~~~~~~~~~~~~~~~~~The '
pic32_serial_dt_ids' array is only used whenCONFIG_OFis enabled. Wrapping its definition and 'MODULE_DEVICE_TABLE' in '#ifdefCONFIG_OF' prevents a compiler warning when OF is disabled.Reported-by kernel test robot <[email protected]>Signed-off-by Yu-Chun Lin <[email protected]>--- drivers/tty/serial/pic32_uart.c | 2 ++ 1 file changed, 2 insertions(+)drivers/tty/serial/pic32_uart.c +0
-0@@ -948,11 +948,13 @@ static void pic32_uart_remove(struct platform_device *pdev) pic32_sports[sport->idx] =NULL ; }
Quoted 10 lines
drivers/tty/serial/pic32_uart.c static void pic32_uart_remove(struct platform_device *pdev) · line 957
Quoted 7 lines
drivers/tty/serial/pic32_uart.c +2
-0+#ifdef CONFIG_OF static const struct of_device_id pic32_serial_dt_ids[] = { { .compatible ="microchip,pic32mzda-uart" }, {/* sentinel */ } };MODULE_DEVICE_TABLE (of, pic32_serial_dt_ids); +#endif That should not be needed, no other bus requires this, please fix up the use of the OF macros instead.
So I should remove of_match_ptr and add the CONFIG_OF as a dependency for the configuration. Correct?
Yu-Chun Lin
Greg KH
maintainerQuoted 38 lines · Yu-Chun Lin
Quoted 26 lines · Greg KH
Quoted 25 lines · Yu-Chun Lin
As reported by the kernel test robot, the following warning occurs:
Quoted 1 line
Quoted 1 line
drivers/tty/serial/pic32_uart.c:904:34: warning: 'pic32_serial_dt_ids' defined but not used [-Wunused-const-variable=]904 | static const struct of_device_id pic32_serial_dt_ids[] = { | ^~~~~~~~~~~~~~~~~~~The '
pic32_serial_dt_ids' array is only used whenCONFIG_OFis enabled. Wrapping its definition and 'MODULE_DEVICE_TABLE' in '#ifdefCONFIG_OF' prevents a compiler warning when OF is disabled.Reported-by kernel test robot <[email protected]>Signed-off-by Yu-Chun Lin <[email protected]>--- drivers/tty/serial/pic32_uart.c | 2 ++ 1 file changed, 2 insertions(+)drivers/tty/serial/pic32_uart.c +0
-0@@ -948,11 +948,13 @@ static void pic32_uart_remove(struct platform_device *pdev) pic32_sports[sport->idx] =NULL ; }Quoted 10 lines
drivers/tty/serial/pic32_uart.c static void pic32_uart_remove(struct platform_device *pdev) · line 957
Quoted 7 lines
drivers/tty/serial/pic32_uart.c +2
-0+#ifdef CONFIG_OF static const struct of_device_id pic32_serial_dt_ids[] = { { .compatible ="microchip,pic32mzda-uart" }, {/* sentinel */ } };MODULE_DEVICE_TABLE (of, pic32_serial_dt_ids); +#endif That should not be needed, no other bus requires this, please fix up the use of the OF macros instead.
Quoted 2 lines
So I should remove
of_match_ptrand add theCONFIG_OFas a dependency for the configuration. Correct?
I don't know, but putting #ifdef in .c files is not the correct solution at all.
thanks,
greg k-h
Quoted 5 lines · Greg KH
Quoted 2 lines
So I should remove
of_match_ptrand add theCONFIG_OFas a dependency for the configuration. Correct?I don't know, but putting #ifdef in .c files is not the correct solution at all.
I fixed the build warning this way because I saw it was done the same way in these three files:
drivers/tty/serial/samsung_tty.cdrivers/tty/serial/mps2-uart.cdrivers/tty/serial/altera_jtaguart.c
Or maybe we can add __maybe_unused to avoid the warning?
Yu-Chun Lin
Greg KH
maintainerQuoted 7 lines · Yu-Chun Lin
Quoted 5 lines · Greg KH
Quoted 2 lines
So I should remove
of_match_ptrand add theCONFIG_OFas a dependency for the configuration. Correct?I don't know, but putting #ifdef in .c files is not the correct solution at all.
Quoted 6 lines
I fixed the build warning this way because I saw it was done the same way in these three files:
drivers/tty/serial/samsung_tty.cdrivers/tty/serial/mps2-uart.cdrivers/tty/serial/altera_jtaguart.c
Those too should be fixed properly.
Quoted 1 line
Or maybe we can add
__maybe_unusedto avoid the warning?
No, again, no other bus has this issue, please fix the macros properly.
thanks,
greg k-h