On Mon, Jan 27, 2025 at 04:29:24PM +0800, Yu-Chun Lin wrote: > On Sun, Jan 26, 2025 at 08:30:33PM +0100, Greg KH wrote: > > On Mon, Jan 27, 2025 at 12:31:15AM +0800, Yu-Chun Lin wrote: > > > As reported by the kernel test robot, the following warning occurs: > > > > > > >> 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. > > > > > > Reported-by: kernel test robot <lkp@xxxxxxxxx> > > > Closes: https://lore.kernel.org/oe-kbuild-all/202501260006.ecUsBidz-lkp@xxxxxxxxx/ > > > Signed-off-by: Yu-Chun Lin <eleanor15x@xxxxxxxxx> > > > --- > > > drivers/tty/serial/pic32_uart.c | 2 ++ > > > 1 file changed, 2 insertions(+) > > > > > > diff --git a/drivers/tty/serial/pic32_uart.c b/drivers/tty/serial/pic32_uart.c > > > index 14d50bd7f1bd..a228a55102c6 100644 > > > --- a/drivers/tty/serial/pic32_uart.c > > > +++ b/drivers/tty/serial/pic32_uart.c > > > @@ -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. > > So I should remove of_match_ptr and add the CONFIG_OF as 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