Skip to contentSkip to conversation

pwm: Enable compile testing for some of drivers

PATCH In review Krzysztof Kozlowski 3 participants 3 messages Mar 3, 2020 – Mar 8, 2020 PWM

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 pwm: Enable compile testing for some of drivers

Some of the PWM drivers can be compile tested to increase build coverage.

The Meson PWM driver requires COMMON_CLK dependency.

---

Changes since v1:
1. Split "depends on OF" to separate entry in PWM_ATMEL and PWM_MXS.

---
 drivers/pwm/Kconfig | 47 ++++++++++++++++++++++++---------------------
 1 file changed, 25 insertions(+), 22 deletions(-)
drivers/pwm/Kconfig +25 -22
index 30190beeb6e9..70153bf11201 100644
@@ -44,7 +44,8 @@ config PWM_AB8500
 
 config PWM_ATMEL
 	tristate "Atmel PWM support"
-	depends on ARCH_AT91 && OF
+	depends on OF
+	depends on ARCH_AT91 || COMPILE_TEST
 	help
 	  Generic PWM framework driver for Atmel SoC.
 
@@ -100,7 +101,7 @@ config PWM_BCM_KONA
 
 config PWM_BCM2835
 	tristate "BCM2835 PWM support"
-	depends on ARCH_BCM2835 || ARCH_BRCMSTB
+	depends on ARCH_BCM2835 || ARCH_BRCMSTB || COMPILE_TEST
 	help
 	  PWM framework driver for BCM2835 controller (Raspberry Pi)
 
@@ -109,7 +110,7 @@ config PWM_BCM2835
 
 config PWM_BERLIN
 	tristate "Marvell Berlin PWM support"
-	depends on ARCH_BERLIN
+	depends on ARCH_BERLIN || COMPILE_TEST
 	help
 	  PWM framework driver for Marvell Berlin SoCs.
 
@@ -118,7 +119,7 @@ config PWM_BERLIN
 
 config PWM_BRCMSTB
 	tristate "Broadcom STB PWM support"
-	depends on ARCH_BRCMSTB || BMIPS_GENERIC
+	depends on ARCH_BRCMSTB || BMIPS_GENERIC || COMPILE_TEST
 	help
 	  Generic PWM framework driver for the Broadcom Set-top-Box
 	  SoCs (BCM7xxx).
@@ -152,7 +153,7 @@ config PWM_CROS_EC
 
 config PWM_EP93XX
 	tristate "Cirrus Logic EP93xx PWM support"
-	depends on ARCH_EP93XX
+	depends on ARCH_EP93XX || COMPILE_TEST
 	help
 	  Generic PWM framework driver for Cirrus Logic EP93xx.
 
@@ -195,7 +196,7 @@ config PWM_IMG
 
 config PWM_IMX1
 	tristate "i.MX1 PWM support"
-	depends on ARCH_MXC
+	depends on ARCH_MXC || COMPILE_TEST
 	help
 	  Generic PWM framework driver for i.MX1 and i.MX21
 
@@ -204,7 +205,7 @@ config PWM_IMX1
 
 config PWM_IMX27
 	tristate "i.MX27 PWM support"
-	depends on ARCH_MXC
+	depends on ARCH_MXC || COMPILE_TEST
 	help
 	  Generic PWM framework driver for i.MX27 and later i.MX SoCs.
 
@@ -244,7 +245,7 @@ config PWM_LP3943
 
 config PWM_LPC18XX_SCT
 	tristate "LPC18xx/43xx PWM/SCT support"
-	depends on ARCH_LPC18XX
+	depends on ARCH_LPC18XX || COMPILE_TEST
 	help
 	  Generic PWM framework driver for NXP LPC18xx PWM/SCT which
 	  supports 16 channels.
@@ -256,7 +257,7 @@ config PWM_LPC18XX_SCT
 
 config PWM_LPC32XX
 	tristate "LPC32XX PWM support"
-	depends on ARCH_LPC32XX
+	depends on ARCH_LPC32XX || COMPILE_TEST
 	help
 	  Generic PWM framework driver for LPC32XX. The LPC32XX SOC has two
 	  PWM controllers.
@@ -289,7 +290,8 @@ config PWM_LPSS_PLATFORM
 
 config PWM_MESON
 	tristate "Amlogic Meson PWM driver"
-	depends on ARCH_MESON
+	depends on ARCH_MESON || COMPILE_TEST
+	depends on COMMON_CLK
 	help
 	  The platform driver for Amlogic Meson PWM controller.
 
@@ -318,7 +320,8 @@ config PWM_MEDIATEK
 
 config PWM_MXS
 	tristate "Freescale MXS PWM support"
-	depends on ARCH_MXS && OF
+	depends on OF
+	depends on ARCH_MXS || COMPILE_TEST
 	select STMP_DEVICE
 	help
 	  Generic PWM framework driver for Freescale MXS.
@@ -357,7 +360,7 @@ config PWM_PUV3
 
 config PWM_PXA
 	tristate "PXA PWM support"
-	depends on ARCH_PXA
+	depends on ARCH_PXA || COMPILE_TEST
 	help
 	  Generic PWM framework driver for PXA.
 
@@ -388,14 +391,14 @@ config PWM_RENESAS_TPU
 
 config PWM_ROCKCHIP
 	tristate "Rockchip PWM support"
-	depends on ARCH_ROCKCHIP
+	depends on ARCH_ROCKCHIP || COMPILE_TEST
 	help
 	  Generic PWM framework driver for the PWM controller found on
 	  Rockchip SoCs.
 
 config PWM_SAMSUNG
 	tristate "Samsung PWM support"
-	depends on PLAT_SAMSUNG || ARCH_EXYNOS
+	depends on PLAT_SAMSUNG || ARCH_EXYNOS || COMPILE_TEST
 	help
 	  Generic PWM framework driver for Samsung.
 
@@ -415,7 +418,7 @@ config PWM_SIFIVE
 
 config PWM_SPEAR
 	tristate "STMicroelectronics SPEAr PWM support"
-	depends on PLAT_SPEAR
+	depends on PLAT_SPEAR || COMPILE_TEST
 	depends on OF
 	help
 	  Generic PWM framework driver for the PWM controller on ST
@@ -437,7 +440,7 @@ config PWM_SPRD
 
 config PWM_STI
 	tristate "STiH4xx PWM support"
-	depends on ARCH_STI
+	depends on ARCH_STI || COMPILE_TEST
 	depends on OF
 	help
 	  Generic PWM framework driver for STiH4xx SoCs.
@@ -447,7 +450,7 @@ config PWM_STI
 
 config PWM_STM32
 	tristate "STMicroelectronics STM32 PWM"
-	depends on MFD_STM32_TIMERS
+	depends on MFD_STM32_TIMERS || COMPILE_TEST
 	help
 	  Generic PWM framework driver for STM32 SoCs.
 
@@ -483,7 +486,7 @@ config PWM_SUN4I
 
 config PWM_TEGRA
 	tristate "NVIDIA Tegra PWM support"
-	depends on ARCH_TEGRA
+	depends on ARCH_TEGRA || COMPILE_TEST
 	help
 	  Generic PWM framework driver for the PWFM controller found on NVIDIA
 	  Tegra SoCs.
@@ -493,7 +496,7 @@ config PWM_TEGRA
 
 config PWM_TIECAP
 	tristate "ECAP PWM support"
-	depends on ARCH_OMAP2PLUS || ARCH_DAVINCI_DA8XX || ARCH_KEYSTONE || ARCH_K3
+	depends on ARCH_OMAP2PLUS || ARCH_DAVINCI_DA8XX || ARCH_KEYSTONE || ARCH_K3 || COMPILE_TEST
 	help
 	  PWM driver support for the ECAP APWM controller found on TI SOCs
 
@@ -502,7 +505,7 @@ config PWM_TIECAP
 
 config PWM_TIEHRPWM
 	tristate "EHRPWM PWM support"
-	depends on ARCH_OMAP2PLUS || ARCH_DAVINCI_DA8XX || ARCH_K3
+	depends on ARCH_OMAP2PLUS || ARCH_DAVINCI_DA8XX || ARCH_K3 || COMPILE_TEST
 	help
 	  PWM driver support for the EHRPWM controller found on TI SOCs
 
@@ -529,7 +532,7 @@ config PWM_TWL_LED
 
 config PWM_VT8500
 	tristate "vt8500 PWM support"
-	depends on ARCH_VT8500
+	depends on ARCH_VT8500 || COMPILE_TEST
 	help
 	  Generic PWM framework driver for vt8500.
 
@@ -538,7 +541,7 @@ config PWM_VT8500
 
 config PWM_ZX
 	tristate "ZTE ZX PWM support"
-	depends on ARCH_ZX
+	depends on ARCH_ZX || COMPILE_TEST
 	help
 	  Generic PWM framework driver for ZTE ZX family SoCs.
 
Signature · 1 line
2.17.1
Acked-by on v2 1/1
#1 lore raw

Hello,

Quoted 9 lines · Krzysztof Kozlowski

Some of the PWM drivers can be compile tested to increase build coverage.

The Meson PWM driver requires COMMON_CLK dependency.

I wonder if this results in some autobuilder fallout, but even if it does I still think this is a good thing to do.

Thanks
Uwe

Signature · 2 lines
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | https://www.pengutronix.de/ |
#2 lore raw
In reply to Krzysztof Kozlowski
I love your patch! Perhaps something to improve:

Hi Krzysztof,

I love your patch! Perhaps something to improve:

[auto build test WARNING on pwm/for-next]
[also build test WARNING on v5.6-rc4 next-20200306]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system. BTW, we also suggest to use '--base' option to specify the base tree in git format-patch, please see https://stackoverflow.com/a/37406982]

url:    https://github.com/0day-ci/linux/commits/Krzysztof-Kozlowski/pwm-Enable-compile-testing-for-some-of-drivers/20200304-050211
base:   https://git.kernel.org/pub/scm/linux/kernel/git/thierry.reding/linux-pwm.git for-next

If you fix the issue, kindly add following tag

smatch warnings:
drivers/pwm/pwm-meson.c:139 meson_pwm_request() warn: inconsistent indenting

vim +139 drivers/pwm/pwm-meson.c

211ed630753d2f Neil Armstrong      2016-08-22  119  
211ed630753d2f Neil Armstrong      2016-08-22  120  static int meson_pwm_request(struct pwm_chip *chip, struct pwm_device *pwm)
211ed630753d2f Neil Armstrong      2016-08-22  121  {
1064c6bacedd70 Martin Blumenstingl 2019-06-12  122  	struct meson_pwm *meson = to_meson_pwm(chip);
1064c6bacedd70 Martin Blumenstingl 2019-06-12  123  	struct meson_pwm_channel *channel;
211ed630753d2f Neil Armstrong      2016-08-22  124  	struct device *dev = chip->dev;
211ed630753d2f Neil Armstrong      2016-08-22  125  	int err;
211ed630753d2f Neil Armstrong      2016-08-22  126  
1064c6bacedd70 Martin Blumenstingl 2019-06-12  127  	channel = pwm_get_chip_data(pwm);
1064c6bacedd70 Martin Blumenstingl 2019-06-12  128  	if (channel)
1064c6bacedd70 Martin Blumenstingl 2019-06-12  129  		return 0;
1064c6bacedd70 Martin Blumenstingl 2019-06-12  130  
1064c6bacedd70 Martin Blumenstingl 2019-06-12  131  	channel = &meson->channels[pwm->hwpwm];
211ed630753d2f Neil Armstrong      2016-08-22  132  
211ed630753d2f Neil Armstrong      2016-08-22  133  	if (channel->clk_parent) {
211ed630753d2f Neil Armstrong      2016-08-22  134  		err = clk_set_parent(channel->clk, channel->clk_parent);
211ed630753d2f Neil Armstrong      2016-08-22  135  		if (err < 0) {
211ed630753d2f Neil Armstrong      2016-08-22  136  			dev_err(dev, "failed to set parent %s for %s: %d\n",
211ed630753d2f Neil Armstrong      2016-08-22  137  				__clk_get_name(channel->clk_parent),
211ed630753d2f Neil Armstrong      2016-08-22  138  				__clk_get_name(channel->clk), err);
211ed630753d2f Neil Armstrong      2016-08-22 @139  				return err;
211ed630753d2f Neil Armstrong      2016-08-22  140  		}
211ed630753d2f Neil Armstrong      2016-08-22  141  	}
211ed630753d2f Neil Armstrong      2016-08-22  142  
211ed630753d2f Neil Armstrong      2016-08-22  143  	err = clk_prepare_enable(channel->clk);
211ed630753d2f Neil Armstrong      2016-08-22  144  	if (err < 0) {
211ed630753d2f Neil Armstrong      2016-08-22  145  		dev_err(dev, "failed to enable clock %s: %d\n",
211ed630753d2f Neil Armstrong      2016-08-22  146  			__clk_get_name(channel->clk), err);
211ed630753d2f Neil Armstrong      2016-08-22  147  		return err;
211ed630753d2f Neil Armstrong      2016-08-22  148  	}
211ed630753d2f Neil Armstrong      2016-08-22  149  
1064c6bacedd70 Martin Blumenstingl 2019-06-12  150  	return pwm_set_chip_data(pwm, channel);
211ed630753d2f Neil Armstrong      2016-08-22  151  }
211ed630753d2f Neil Armstrong      2016-08-22  152  

:::::: The code at line 139 was first introduced by commit
:::::: 211ed630753d2f0553ff642346e9995503bc240d pwm: Add support for Meson PWM Controller

:::::: TO: Neil Armstrong <[email protected]> :::::: CC: Thierry Reding <[email protected]>

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org