2018-05-18 15:26:40

by Fabrice Gasnier

[permalink] [raw]
Subject: [PATCH 0/2] Fix STM32 PWM capture build with COMPILE_TEST

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



2018-05-18 15:26:57

by Fabrice Gasnier

[permalink] [raw]
Subject: [PATCH 1/2] mfd: stm32-timers: fix pwm-stm32 linker issue with COMPILE_TEST

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 <[email protected]>
---
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


2018-05-18 15:27:09

by Fabrice Gasnier

[permalink] [raw]
Subject: [PATCH 2/2] pwm: stm32: initialize raw local variables

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 <[email protected]>
---
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


2018-05-18 16:57:39

by Randy Dunlap

[permalink] [raw]
Subject: Re: [PATCH 2/2] pwm: stm32: initialize raw local variables

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 <[email protected]>

Tested-by: Randy Dunlap <[email protected]>

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

2018-05-18 16:58:27

by Randy Dunlap

[permalink] [raw]
Subject: Re: [PATCH 1/2] mfd: stm32-timers: fix pwm-stm32 linker issue with COMPILE_TEST

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 <[email protected]>

Reported-by: Randy Dunlap <[email protected]>
Tested-by: Randy Dunlap <[email protected]>

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

2018-05-18 22:06:26

by Thierry Reding

[permalink] [raw]
Subject: Re: [PATCH 2/2] pwm: stm32: initialize raw local variables

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 <[email protected]>
> ---
> 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 <[email protected]>


Attachments:
(No filename) (639.00 B)
signature.asc (849.00 B)
Download all attachments

2018-06-04 06:13:29

by Lee Jones

[permalink] [raw]
Subject: Re: [PATCH 2/2] pwm: stm32: initialize raw local variables

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 <[email protected]>
> ---
> 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

2018-06-04 06:13:51

by Lee Jones

[permalink] [raw]
Subject: Re: [PATCH 1/2] mfd: stm32-timers: fix pwm-stm32 linker issue with COMPILE_TEST

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 <[email protected]>
> ---
> 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