diff mbox series

[7/7] serial: allow COMPILE_TEST for some drivers

Message ID 20220421101708.5640-8-jslaby@suse.cz
State New
Headers show
Series None | expand

Commit Message

Jiri Slaby April 21, 2022, 10:17 a.m. UTC
Some more serial drivers can be compile-tested under certain
circumstances (when building a specific architecture). So allow for
that.

This reduces the need of zillion mach/subarch-specific configs. And
since the 0day bot has only allmodconfig's for some archs, this
increases build coverage there too.

Note that cpm needs a minor update in the header, so that it drags in
at least some defines (CPM2 ones).

Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/tty/serial/Kconfig             | 6 +++---
 drivers/tty/serial/cpm_uart/cpm_uart.h | 2 ++
 2 files changed, 5 insertions(+), 3 deletions(-)

Comments

Randy Dunlap March 30, 2023, 7:28 p.m. UTC | #1
Hi Jiri,

On 4/21/22 03:17, Jiri Slaby wrote:
> Some more serial drivers can be compile-tested under certain
> circumstances (when building a specific architecture). So allow for
> that.
> 
> This reduces the need of zillion mach/subarch-specific configs. And
> since the 0day bot has only allmodconfig's for some archs, this
> increases build coverage there too.
> 
> Note that cpm needs a minor update in the header, so that it drags in
> at least some defines (CPM2 ones).
> 
> Signed-off-by: Jiri Slaby <jslaby@suse.cz>
> ---
>  drivers/tty/serial/Kconfig             | 6 +++---
>  drivers/tty/serial/cpm_uart/cpm_uart.h | 2 ++
>  2 files changed, 5 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/tty/serial/Kconfig b/drivers/tty/serial/Kconfig
> index 20cb103972fa..2d3eed53b43e 100644
> --- a/drivers/tty/serial/Kconfig
> +++ b/drivers/tty/serial/Kconfig
> @@ -782,7 +782,7 @@ config SERIAL_PMACZILOG_CONSOLE
>  
>  config SERIAL_CPM
>  	tristate "CPM SCC/SMC serial port support"
> -	depends on CPM2 || CPM1
> +	depends on CPM2 || CPM1 || (PPC32 && COMPILE_TEST)


This patch (now commit e3e7b13bffae) causes build errors
when neither CPM1 nor CPM2 is set but PPC32=y and COMPILE_TEST=y:

ERROR: modpost: "cpm_uart_freebuf" [drivers/tty/serial/cpm_uart/cpm_uart.ko] undefined!
ERROR: modpost: "cpm_uart_allocbuf" [drivers/tty/serial/cpm_uart/cpm_uart.ko] undefined!
ERROR: modpost: "cpm_line_cr_cmd" [drivers/tty/serial/cpm_uart/cpm_uart.ko] undefined!
ERROR: modpost: "__cpm2_setbrg" [drivers/tty/serial/cpm_uart/cpm_uart.ko] undefined!
ERROR: modpost: "cpm_uart_unmap_pram" [drivers/tty/serial/cpm_uart/cpm_uart.ko] undefined!
ERROR: modpost: "cpm_uart_map_pram" [drivers/tty/serial/cpm_uart/cpm_uart.ko] undefined!

>  	select SERIAL_CORE
>  	help
>  	  This driver supports the SCC and SMC serial ports on Motorola 
> @@ -806,7 +806,7 @@ config SERIAL_CPM_CONSOLE
>  
>  config SERIAL_PIC32
>  	tristate "Microchip PIC32 serial support"
> -	depends on MACH_PIC32
> +	depends on MACH_PIC32 || (MIPS && COMPILE_TEST)
>  	select SERIAL_CORE
>  	help
>  	  If you have a PIC32, this driver supports the serial ports.
> @@ -1246,7 +1246,7 @@ config SERIAL_XILINX_PS_UART_CONSOLE
>  
>  config SERIAL_AR933X
>  	tristate "AR933X serial port support"
> -	depends on HAVE_CLK && ATH79
> +	depends on (HAVE_CLK && ATH79) || (MIPS && COMPILE_TEST)
>  	select SERIAL_CORE
>  	select SERIAL_MCTRL_GPIO if GPIOLIB
>  	help
> diff --git a/drivers/tty/serial/cpm_uart/cpm_uart.h b/drivers/tty/serial/cpm_uart/cpm_uart.h
> index 6113b953ce25..8c582779cf22 100644
> --- a/drivers/tty/serial/cpm_uart/cpm_uart.h
> +++ b/drivers/tty/serial/cpm_uart/cpm_uart.h
> @@ -19,6 +19,8 @@ struct gpio_desc;
>  #include "cpm_uart_cpm2.h"
>  #elif defined(CONFIG_CPM1)
>  #include "cpm_uart_cpm1.h"
> +#elif defined(CONFIG_COMPILE_TEST)
> +#include "cpm_uart_cpm2.h"
>  #endif
>  
>  #define SERIAL_CPM_MAJOR	204
diff mbox series

Patch

diff --git a/drivers/tty/serial/Kconfig b/drivers/tty/serial/Kconfig
index 20cb103972fa..2d3eed53b43e 100644
--- a/drivers/tty/serial/Kconfig
+++ b/drivers/tty/serial/Kconfig
@@ -782,7 +782,7 @@  config SERIAL_PMACZILOG_CONSOLE
 
 config SERIAL_CPM
 	tristate "CPM SCC/SMC serial port support"
-	depends on CPM2 || CPM1
+	depends on CPM2 || CPM1 || (PPC32 && COMPILE_TEST)
 	select SERIAL_CORE
 	help
 	  This driver supports the SCC and SMC serial ports on Motorola 
@@ -806,7 +806,7 @@  config SERIAL_CPM_CONSOLE
 
 config SERIAL_PIC32
 	tristate "Microchip PIC32 serial support"
-	depends on MACH_PIC32
+	depends on MACH_PIC32 || (MIPS && COMPILE_TEST)
 	select SERIAL_CORE
 	help
 	  If you have a PIC32, this driver supports the serial ports.
@@ -1246,7 +1246,7 @@  config SERIAL_XILINX_PS_UART_CONSOLE
 
 config SERIAL_AR933X
 	tristate "AR933X serial port support"
-	depends on HAVE_CLK && ATH79
+	depends on (HAVE_CLK && ATH79) || (MIPS && COMPILE_TEST)
 	select SERIAL_CORE
 	select SERIAL_MCTRL_GPIO if GPIOLIB
 	help
diff --git a/drivers/tty/serial/cpm_uart/cpm_uart.h b/drivers/tty/serial/cpm_uart/cpm_uart.h
index 6113b953ce25..8c582779cf22 100644
--- a/drivers/tty/serial/cpm_uart/cpm_uart.h
+++ b/drivers/tty/serial/cpm_uart/cpm_uart.h
@@ -19,6 +19,8 @@  struct gpio_desc;
 #include "cpm_uart_cpm2.h"
 #elif defined(CONFIG_CPM1)
 #include "cpm_uart_cpm1.h"
+#elif defined(CONFIG_COMPILE_TEST)
+#include "cpm_uart_cpm2.h"
 #endif
 
 #define SERIAL_CPM_MAJOR	204