linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] Fix STM32 PWM capture build with COMPILE_TEST
@ 2018-05-18 15:24 Fabrice Gasnier
  2018-05-18 15:24 ` [PATCH 1/2] mfd: stm32-timers: fix pwm-stm32 linker issue " Fabrice Gasnier
  2018-05-18 15:24 ` [PATCH 2/2] pwm: stm32: initialize raw local variables Fabrice Gasnier
  0 siblings, 2 replies; 8+ messages in thread
From: Fabrice Gasnier @ 2018-05-18 15:24 UTC (permalink / raw)
  To: lee.jones, thierry.reding
  Cc: rdunlap, sfr, gerald.baeza, alexandre.torgue, mcoquelin.stm32,
	linux-next, linux-arm-kernel, linux-kernel, linux-pwm

Build issue has been identified when COMPILE_TEST=y and MFD_STM32_TIMERS=n:
https://lkml.org/lkml/2018/5/17/825
- First patch introduces a stub routine in mfd header file
- Sub-sequent patch solves warning in pwm-stm32 with these configs

Fabrice Gasnier (2):
  mfd: stm32-timers: fix pwm-stm32 linker issue with COMPILE_TEST
  pwm: stm32: initialize raw local variables

 drivers/pwm/pwm-stm32.c          |  2 +-
 include/linux/mfd/stm32-timers.h | 12 ++++++++++++
 2 files changed, 13 insertions(+), 1 deletion(-)

-- 
1.9.1

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH 1/2] mfd: stm32-timers: fix pwm-stm32 linker issue with COMPILE_TEST
  2018-05-18 15:24 [PATCH 0/2] Fix STM32 PWM capture build with COMPILE_TEST Fabrice Gasnier
@ 2018-05-18 15:24 ` Fabrice Gasnier
  2018-05-18 16:56   ` Randy Dunlap
  2018-06-04  6:13   ` Lee Jones
  2018-05-18 15:24 ` [PATCH 2/2] pwm: stm32: initialize raw local variables Fabrice Gasnier
  1 sibling, 2 replies; 8+ messages in thread
From: Fabrice Gasnier @ 2018-05-18 15:24 UTC (permalink / raw)
  To: lee.jones, thierry.reding
  Cc: rdunlap, sfr, gerald.baeza, alexandre.torgue, mcoquelin.stm32,
	linux-next, linux-arm-kernel, linux-kernel, linux-pwm

This is seen when COMPILE_TEST=y and MFD_STM32_TIMERS=n.
drivers/pwm/pwm-stm32.o: In function 'stm32_pwm_raw_capture':
pwm-stm32.c:... undefined reference to 'stm32_timers_dma_burst_read'
Fixes: 0c6609805b63 ("mfd: stm32-timers: Add support for DMAs")

Signed-off-by: Fabrice Gasnier <fabrice.gasnier@st.com>
---
 include/linux/mfd/stm32-timers.h | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/include/linux/mfd/stm32-timers.h b/include/linux/mfd/stm32-timers.h
index 9da1d7e..067d146 100644
--- a/include/linux/mfd/stm32-timers.h
+++ b/include/linux/mfd/stm32-timers.h
@@ -124,8 +124,20 @@ struct stm32_timers {
 	struct stm32_timers_dma dma; /* Only to be used by the parent */
 };
 
+#if IS_REACHABLE(CONFIG_MFD_STM32_TIMERS)
 int stm32_timers_dma_burst_read(struct device *dev, u32 *buf,
 				enum stm32_timers_dmas id, u32 reg,
 				unsigned int num_reg, unsigned int bursts,
 				unsigned long tmo_ms);
+#else
+static inline int stm32_timers_dma_burst_read(struct device *dev, u32 *buf,
+					      enum stm32_timers_dmas id,
+					      u32 reg,
+					      unsigned int num_reg,
+					      unsigned int bursts,
+					      unsigned long tmo_ms)
+{
+	return -ENODEV;
+}
+#endif
 #endif
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 2/2] pwm: stm32: initialize raw local variables
  2018-05-18 15:24 [PATCH 0/2] Fix STM32 PWM capture build with COMPILE_TEST Fabrice Gasnier
  2018-05-18 15:24 ` [PATCH 1/2] mfd: stm32-timers: fix pwm-stm32 linker issue " Fabrice Gasnier
@ 2018-05-18 15:24 ` Fabrice Gasnier
  2018-05-18 16:56   ` Randy Dunlap
                     ` (2 more replies)
  1 sibling, 3 replies; 8+ messages in thread
From: Fabrice Gasnier @ 2018-05-18 15:24 UTC (permalink / raw)
  To: lee.jones, thierry.reding
  Cc: rdunlap, sfr, gerald.baeza, alexandre.torgue, mcoquelin.stm32,
	linux-next, linux-arm-kernel, linux-kernel, linux-pwm

This removes build warning when COMPILE_TEST=y and MFD_STM32_TIMERS=n
in drivers/pwm/pwm-stm32.c. In function 'stm32_pwm_capture' 'raw_prd' and
'raw_dty' may be used uninitialized in this function
[-Wmaybe-uninitialized]

Signed-off-by: Fabrice Gasnier <fabrice.gasnier@st.com>
---
 drivers/pwm/pwm-stm32.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/pwm/pwm-stm32.c b/drivers/pwm/pwm-stm32.c
index 60bfc07..09383c6 100644
--- a/drivers/pwm/pwm-stm32.c
+++ b/drivers/pwm/pwm-stm32.c
@@ -170,7 +170,7 @@ static int stm32_pwm_capture(struct pwm_chip *chip, struct pwm_device *pwm,
 	unsigned long long prd, div, dty;
 	unsigned long rate;
 	unsigned int psc = 0, icpsc, scale;
-	u32 raw_prd, raw_dty;
+	u32 raw_prd = 0, raw_dty = 0;
 	int ret = 0;
 
 	mutex_lock(&priv->lock);
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH 2/2] pwm: stm32: initialize raw local variables
  2018-05-18 15:24 ` [PATCH 2/2] pwm: stm32: initialize raw local variables Fabrice Gasnier
@ 2018-05-18 16:56   ` Randy Dunlap
  2018-05-18 22:05   ` Thierry Reding
  2018-06-04  6:12   ` Lee Jones
  2 siblings, 0 replies; 8+ messages in thread
From: Randy Dunlap @ 2018-05-18 16:56 UTC (permalink / raw)
  To: Fabrice Gasnier, lee.jones, thierry.reding
  Cc: sfr, gerald.baeza, alexandre.torgue, mcoquelin.stm32, linux-next,
	linux-arm-kernel, linux-kernel, linux-pwm

On 05/18/2018 08:24 AM, Fabrice Gasnier wrote:
> This removes build warning when COMPILE_TEST=y and MFD_STM32_TIMERS=n
> in drivers/pwm/pwm-stm32.c. In function 'stm32_pwm_capture' 'raw_prd' and
> 'raw_dty' may be used uninitialized in this function
> [-Wmaybe-uninitialized]
> 
> Signed-off-by: Fabrice Gasnier <fabrice.gasnier@st.com>

Tested-by: Randy Dunlap <rdunlap@infradead.org>

Thanks.

> ---
>  drivers/pwm/pwm-stm32.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/pwm/pwm-stm32.c b/drivers/pwm/pwm-stm32.c
> index 60bfc07..09383c6 100644
> --- a/drivers/pwm/pwm-stm32.c
> +++ b/drivers/pwm/pwm-stm32.c
> @@ -170,7 +170,7 @@ static int stm32_pwm_capture(struct pwm_chip *chip, struct pwm_device *pwm,
>  	unsigned long long prd, div, dty;
>  	unsigned long rate;
>  	unsigned int psc = 0, icpsc, scale;
> -	u32 raw_prd, raw_dty;
> +	u32 raw_prd = 0, raw_dty = 0;
>  	int ret = 0;
>  
>  	mutex_lock(&priv->lock);
> 


-- 
~Randy

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 1/2] mfd: stm32-timers: fix pwm-stm32 linker issue with COMPILE_TEST
  2018-05-18 15:24 ` [PATCH 1/2] mfd: stm32-timers: fix pwm-stm32 linker issue " Fabrice Gasnier
@ 2018-05-18 16:56   ` Randy Dunlap
  2018-06-04  6:13   ` Lee Jones
  1 sibling, 0 replies; 8+ messages in thread
From: Randy Dunlap @ 2018-05-18 16:56 UTC (permalink / raw)
  To: Fabrice Gasnier, lee.jones, thierry.reding
  Cc: sfr, gerald.baeza, alexandre.torgue, mcoquelin.stm32, linux-next,
	linux-arm-kernel, linux-kernel, linux-pwm

On 05/18/2018 08:24 AM, Fabrice Gasnier wrote:
> This is seen when COMPILE_TEST=y and MFD_STM32_TIMERS=n.
> drivers/pwm/pwm-stm32.o: In function 'stm32_pwm_raw_capture':
> pwm-stm32.c:... undefined reference to 'stm32_timers_dma_burst_read'
> Fixes: 0c6609805b63 ("mfd: stm32-timers: Add support for DMAs")
> 
> Signed-off-by: Fabrice Gasnier <fabrice.gasnier@st.com>

Reported-by: Randy Dunlap <rdunlap@infradead.org>
Tested-by: Randy Dunlap <rdunlap@infradead.org>

Thanks.

> ---
>  include/linux/mfd/stm32-timers.h | 12 ++++++++++++
>  1 file changed, 12 insertions(+)
> 
> diff --git a/include/linux/mfd/stm32-timers.h b/include/linux/mfd/stm32-timers.h
> index 9da1d7e..067d146 100644
> --- a/include/linux/mfd/stm32-timers.h
> +++ b/include/linux/mfd/stm32-timers.h
> @@ -124,8 +124,20 @@ struct stm32_timers {
>  	struct stm32_timers_dma dma; /* Only to be used by the parent */
>  };
>  
> +#if IS_REACHABLE(CONFIG_MFD_STM32_TIMERS)
>  int stm32_timers_dma_burst_read(struct device *dev, u32 *buf,
>  				enum stm32_timers_dmas id, u32 reg,
>  				unsigned int num_reg, unsigned int bursts,
>  				unsigned long tmo_ms);
> +#else
> +static inline int stm32_timers_dma_burst_read(struct device *dev, u32 *buf,
> +					      enum stm32_timers_dmas id,
> +					      u32 reg,
> +					      unsigned int num_reg,
> +					      unsigned int bursts,
> +					      unsigned long tmo_ms)
> +{
> +	return -ENODEV;
> +}
> +#endif
>  #endif
> 


-- 
~Randy

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 2/2] pwm: stm32: initialize raw local variables
  2018-05-18 15:24 ` [PATCH 2/2] pwm: stm32: initialize raw local variables Fabrice Gasnier
  2018-05-18 16:56   ` Randy Dunlap
@ 2018-05-18 22:05   ` Thierry Reding
  2018-06-04  6:12   ` Lee Jones
  2 siblings, 0 replies; 8+ messages in thread
From: Thierry Reding @ 2018-05-18 22:05 UTC (permalink / raw)
  To: Fabrice Gasnier
  Cc: lee.jones, rdunlap, sfr, gerald.baeza, alexandre.torgue,
	mcoquelin.stm32, linux-next, linux-arm-kernel, linux-kernel,
	linux-pwm

[-- Attachment #1: Type: text/plain, Size: 639 bytes --]

On Fri, May 18, 2018 at 05:24:04PM +0200, Fabrice Gasnier wrote:
> This removes build warning when COMPILE_TEST=y and MFD_STM32_TIMERS=n
> in drivers/pwm/pwm-stm32.c. In function 'stm32_pwm_capture' 'raw_prd' and
> 'raw_dty' may be used uninitialized in this function
> [-Wmaybe-uninitialized]
> 
> Signed-off-by: Fabrice Gasnier <fabrice.gasnier@st.com>
> ---
>  drivers/pwm/pwm-stm32.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Hi Lee,

I assume you'll pick this up into your branch where you applied the
initial patches along with 1/2 in this series?

Acked-by: Thierry Reding <thierry.reding@gmail.com>

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 2/2] pwm: stm32: initialize raw local variables
  2018-05-18 15:24 ` [PATCH 2/2] pwm: stm32: initialize raw local variables Fabrice Gasnier
  2018-05-18 16:56   ` Randy Dunlap
  2018-05-18 22:05   ` Thierry Reding
@ 2018-06-04  6:12   ` Lee Jones
  2 siblings, 0 replies; 8+ messages in thread
From: Lee Jones @ 2018-06-04  6:12 UTC (permalink / raw)
  To: Fabrice Gasnier
  Cc: thierry.reding, rdunlap, sfr, gerald.baeza, alexandre.torgue,
	mcoquelin.stm32, linux-next, linux-arm-kernel, linux-kernel,
	linux-pwm

On Fri, 18 May 2018, Fabrice Gasnier wrote:

> This removes build warning when COMPILE_TEST=y and MFD_STM32_TIMERS=n
> in drivers/pwm/pwm-stm32.c. In function 'stm32_pwm_capture' 'raw_prd' and
> 'raw_dty' may be used uninitialized in this function
> [-Wmaybe-uninitialized]
> 
> Signed-off-by: Fabrice Gasnier <fabrice.gasnier@st.com>
> ---
>  drivers/pwm/pwm-stm32.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Applied, thanks.

-- 
Lee Jones [李琼斯]
Linaro Services Technical Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 1/2] mfd: stm32-timers: fix pwm-stm32 linker issue with COMPILE_TEST
  2018-05-18 15:24 ` [PATCH 1/2] mfd: stm32-timers: fix pwm-stm32 linker issue " Fabrice Gasnier
  2018-05-18 16:56   ` Randy Dunlap
@ 2018-06-04  6:13   ` Lee Jones
  1 sibling, 0 replies; 8+ messages in thread
From: Lee Jones @ 2018-06-04  6:13 UTC (permalink / raw)
  To: Fabrice Gasnier
  Cc: thierry.reding, rdunlap, sfr, gerald.baeza, alexandre.torgue,
	mcoquelin.stm32, linux-next, linux-arm-kernel, linux-kernel,
	linux-pwm

On Fri, 18 May 2018, Fabrice Gasnier wrote:

> This is seen when COMPILE_TEST=y and MFD_STM32_TIMERS=n.
> drivers/pwm/pwm-stm32.o: In function 'stm32_pwm_raw_capture':
> pwm-stm32.c:... undefined reference to 'stm32_timers_dma_burst_read'
> Fixes: 0c6609805b63 ("mfd: stm32-timers: Add support for DMAs")
> 
> Signed-off-by: Fabrice Gasnier <fabrice.gasnier@st.com>
> ---
>  include/linux/mfd/stm32-timers.h | 12 ++++++++++++
>  1 file changed, 12 insertions(+)

Applied, thanks.

-- 
Lee Jones [李琼斯]
Linaro Services Technical Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2018-06-04  6:13 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-05-18 15:24 [PATCH 0/2] Fix STM32 PWM capture build with COMPILE_TEST Fabrice Gasnier
2018-05-18 15:24 ` [PATCH 1/2] mfd: stm32-timers: fix pwm-stm32 linker issue " Fabrice Gasnier
2018-05-18 16:56   ` Randy Dunlap
2018-06-04  6:13   ` Lee Jones
2018-05-18 15:24 ` [PATCH 2/2] pwm: stm32: initialize raw local variables Fabrice Gasnier
2018-05-18 16:56   ` Randy Dunlap
2018-05-18 22:05   ` Thierry Reding
2018-06-04  6:12   ` Lee Jones

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).