Re: [PATCH] dma: ste_dma40: fix unneeded variable warning

2019-07-22 Thread Vinod Koul
On 12-07-19, 11:13, Arnd Bergmann wrote:
> clang-9 points out that there are two variables that depending on the
> configuration may only be used in an ARRAY_SIZE() expression but not
> referenced:
> 
> drivers/dma/ste_dma40.c:145:12: error: variable 'd40_backup_regs' is not 
> needed and will not be emitted [-Werror,-Wunneeded-internal-declaration]
> static u32 d40_backup_regs[] = {
>^
> drivers/dma/ste_dma40.c:214:12: error: variable 'd40_backup_regs_chan' is not 
> needed and will not be emitted [-Werror,-Wunneeded-internal-declaration]
> static u32 d40_backup_regs_chan[] = {
> 
> Mark these __maybe_unused to shut up the warning.

Applied, thanks

-- 
~Vinod


Re: [PATCH] dma: ste_dma40: fix unneeded variable warning

2019-07-17 Thread Linus Walleij
On Fri, Jul 12, 2019 at 11:14 AM Arnd Bergmann  wrote:

> clang-9 points out that there are two variables that depending on the
> configuration may only be used in an ARRAY_SIZE() expression but not
> referenced:
>
> drivers/dma/ste_dma40.c:145:12: error: variable 'd40_backup_regs' is not 
> needed and will not be emitted [-Werror,-Wunneeded-internal-declaration]
> static u32 d40_backup_regs[] = {
>^
> drivers/dma/ste_dma40.c:214:12: error: variable 'd40_backup_regs_chan' is not 
> needed and will not be emitted [-Werror,-Wunneeded-internal-declaration]
> static u32 d40_backup_regs_chan[] = {
>
> Mark these __maybe_unused to shut up the warning.
>
> Signed-off-by: Arnd Bergmann 

Seems like a reasonable fix:
Reviewed-by: Linus Walleij 

Yours,
Linus Walleij


Re: [PATCH] dma: ste_dma40: fix unneeded variable warning

2019-07-12 Thread Arnd Bergmann
On Fri, Jul 12, 2019 at 9:17 PM 'Nick Desaulniers' via Clang Built
Linux  wrote:
>
> On Fri, Jul 12, 2019 at 10:39 AM Nathan Chancellor
>  wrote:
> >
> > On Fri, Jul 12, 2019 at 11:13:30AM +0200, Arnd Bergmann wrote:
> > > clang-9 points out that there are two variables that depending on the
> > > configuration may only be used in an ARRAY_SIZE() expression but not
> > > referenced:
> > >
> > > drivers/dma/ste_dma40.c:145:12: error: variable 'd40_backup_regs' is not 
> > > needed and will not be emitted [-Werror,-Wunneeded-internal-declaration]
> > > static u32 d40_backup_regs[] = {
> > >^
> > > drivers/dma/ste_dma40.c:214:12: error: variable 'd40_backup_regs_chan' is 
> > > not needed and will not be emitted 
> > > [-Werror,-Wunneeded-internal-declaration]
> > > static u32 d40_backup_regs_chan[] = {
> > >
> > > Mark these __maybe_unused to shut up the warning.
> > >
> > > Signed-off-by: Arnd Bergmann 
>
> Thanks for the patch!
>
> >
> > Might be worth mentioning that this warning will only appear when
> > CONFIG_PM is unset (they are both used in d40_save_restore_registers).
>
> So would moving the definition into a
> #ifdef CONFIG_PM
> #endif
> block be better than __maybe_unused?
>

That would not work here, since the driver still uses ARRAY_SIZE() on
the variable.
Even more #ifdefs could solve that as well, but I don't want to spend too much
effort on this driver since it has almost no users.

  Arnd


Re: [PATCH] dma: ste_dma40: fix unneeded variable warning

2019-07-12 Thread Nick Desaulniers
On Fri, Jul 12, 2019 at 10:39 AM Nathan Chancellor
 wrote:
>
> On Fri, Jul 12, 2019 at 11:13:30AM +0200, Arnd Bergmann wrote:
> > clang-9 points out that there are two variables that depending on the
> > configuration may only be used in an ARRAY_SIZE() expression but not
> > referenced:
> >
> > drivers/dma/ste_dma40.c:145:12: error: variable 'd40_backup_regs' is not 
> > needed and will not be emitted [-Werror,-Wunneeded-internal-declaration]
> > static u32 d40_backup_regs[] = {
> >^
> > drivers/dma/ste_dma40.c:214:12: error: variable 'd40_backup_regs_chan' is 
> > not needed and will not be emitted [-Werror,-Wunneeded-internal-declaration]
> > static u32 d40_backup_regs_chan[] = {
> >
> > Mark these __maybe_unused to shut up the warning.
> >
> > Signed-off-by: Arnd Bergmann 

Thanks for the patch!

>
> Might be worth mentioning that this warning will only appear when
> CONFIG_PM is unset (they are both used in d40_save_restore_registers).

So would moving the definition into a
#ifdef CONFIG_PM
#endif
block be better than __maybe_unused?

-- 
Thanks,
~Nick Desaulniers


Re: [PATCH] dma: ste_dma40: fix unneeded variable warning

2019-07-12 Thread Nathan Chancellor
On Fri, Jul 12, 2019 at 11:13:30AM +0200, Arnd Bergmann wrote:
> clang-9 points out that there are two variables that depending on the
> configuration may only be used in an ARRAY_SIZE() expression but not
> referenced:
> 
> drivers/dma/ste_dma40.c:145:12: error: variable 'd40_backup_regs' is not 
> needed and will not be emitted [-Werror,-Wunneeded-internal-declaration]
> static u32 d40_backup_regs[] = {
>^
> drivers/dma/ste_dma40.c:214:12: error: variable 'd40_backup_regs_chan' is not 
> needed and will not be emitted [-Werror,-Wunneeded-internal-declaration]
> static u32 d40_backup_regs_chan[] = {
> 
> Mark these __maybe_unused to shut up the warning.
> 
> Signed-off-by: Arnd Bergmann 

Might be worth mentioning that this warning will only appear when
CONFIG_PM is unset (they are both used in d40_save_restore_registers).

Reviewed-by: Nathan Chancellor 


[PATCH] dma: ste_dma40: fix unneeded variable warning

2019-07-12 Thread Arnd Bergmann
clang-9 points out that there are two variables that depending on the
configuration may only be used in an ARRAY_SIZE() expression but not
referenced:

drivers/dma/ste_dma40.c:145:12: error: variable 'd40_backup_regs' is not needed 
and will not be emitted [-Werror,-Wunneeded-internal-declaration]
static u32 d40_backup_regs[] = {
   ^
drivers/dma/ste_dma40.c:214:12: error: variable 'd40_backup_regs_chan' is not 
needed and will not be emitted [-Werror,-Wunneeded-internal-declaration]
static u32 d40_backup_regs_chan[] = {

Mark these __maybe_unused to shut up the warning.

Signed-off-by: Arnd Bergmann 
---
 drivers/dma/ste_dma40.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/dma/ste_dma40.c b/drivers/dma/ste_dma40.c
index 89d710899010..de8bfd9a76e9 100644
--- a/drivers/dma/ste_dma40.c
+++ b/drivers/dma/ste_dma40.c
@@ -142,7 +142,7 @@ enum d40_events {
  * when the DMA hw is powered off.
  * TODO: Add save/restore of D40_DREG_GCC on dma40 v3 or later, if that works.
  */
-static u32 d40_backup_regs[] = {
+static __maybe_unused u32 d40_backup_regs[] = {
D40_DREG_LCPA,
D40_DREG_LCLA,
D40_DREG_PRMSE,
@@ -211,7 +211,7 @@ static u32 d40_backup_regs_v4b[] = {
 
 #define BACKUP_REGS_SZ_V4B ARRAY_SIZE(d40_backup_regs_v4b)
 
-static u32 d40_backup_regs_chan[] = {
+static __maybe_unused u32 d40_backup_regs_chan[] = {
D40_CHAN_REG_SSCFG,
D40_CHAN_REG_SSELT,
D40_CHAN_REG_SSPTR,
-- 
2.20.0