* [PATCH] ALSA: hda: fix unused variable warning
@ 2018-09-11 8:25 Anders Roxell
2018-09-11 8:37 ` Takashi Iwai
0 siblings, 1 reply; 5+ messages in thread
From: Anders Roxell @ 2018-09-11 8:25 UTC (permalink / raw)
To: perex, tiwai; +Cc: alsa-devel, linux-kernel, Anders Roxell
When CONFIG_X86=n function azx_snoop doesn't use the variable chip it
only returns true.
sound/pci/hda/hda_intel.c: In function ‘dma_alloc_pages’:
sound/pci/hda/hda_intel.c:2002:14: warning: unused variable ‘chip’ [-Wunused-variable]
struct azx *chip = bus_to_azx(bus);
^~~~
Create a inline function of azx_snoop.
Fixes: a41d122449be ("ALSA: hda - Embed bus into controller object")
Signed-off-by: Anders Roxell <anders.roxell@linaro.org>
---
sound/pci/hda/hda_controller.h | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
diff --git a/sound/pci/hda/hda_controller.h b/sound/pci/hda/hda_controller.h
index 0053b704ddc4..aa20048742d0 100644
--- a/sound/pci/hda/hda_controller.h
+++ b/sound/pci/hda/hda_controller.h
@@ -170,11 +170,10 @@ struct azx {
#define azx_bus(chip) (&(chip)->bus.core)
#define bus_to_azx(_bus) container_of(_bus, struct azx, bus.core)
-#ifdef CONFIG_X86
-#define azx_snoop(chip) ((chip)->snoop)
-#else
-#define azx_snoop(chip) true
-#endif
+static inline bool azx_snoop(struct azx *chip)
+{
+ return IS_ENABLED(CONFIG_X86) || (chip->snoop);
+}
/*
* macros for easy use
--
2.18.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] ALSA: hda: fix unused variable warning
2018-09-11 8:25 [PATCH] ALSA: hda: fix unused variable warning Anders Roxell
@ 2018-09-11 8:37 ` Takashi Iwai
2018-09-11 14:18 ` Anders Roxell
2018-09-11 14:18 ` [PATCH v2] " Anders Roxell
0 siblings, 2 replies; 5+ messages in thread
From: Takashi Iwai @ 2018-09-11 8:37 UTC (permalink / raw)
To: Anders Roxell; +Cc: perex, alsa-devel, linux-kernel
On Tue, 11 Sep 2018 10:25:59 +0200,
Anders Roxell wrote:
>
> When CONFIG_X86=n function azx_snoop doesn't use the variable chip it
> only returns true.
>
> sound/pci/hda/hda_intel.c: In function ‘dma_alloc_pages’:
> sound/pci/hda/hda_intel.c:2002:14: warning: unused variable ‘chip’ [-Wunused-variable]
> struct azx *chip = bus_to_azx(bus);
> ^~~~
>
> Create a inline function of azx_snoop.
>
> Fixes: a41d122449be ("ALSA: hda - Embed bus into controller object")
> Signed-off-by: Anders Roxell <anders.roxell@linaro.org>
> ---
> sound/pci/hda/hda_controller.h | 9 ++++-----
> 1 file changed, 4 insertions(+), 5 deletions(-)
>
> diff --git a/sound/pci/hda/hda_controller.h b/sound/pci/hda/hda_controller.h
> index 0053b704ddc4..aa20048742d0 100644
> --- a/sound/pci/hda/hda_controller.h
> +++ b/sound/pci/hda/hda_controller.h
> @@ -170,11 +170,10 @@ struct azx {
> #define azx_bus(chip) (&(chip)->bus.core)
> #define bus_to_azx(_bus) container_of(_bus, struct azx, bus.core)
>
> -#ifdef CONFIG_X86
> -#define azx_snoop(chip) ((chip)->snoop)
> -#else
> -#define azx_snoop(chip) true
> -#endif
> +static inline bool azx_snoop(struct azx *chip)
> +{
> + return IS_ENABLED(CONFIG_X86) || (chip->snoop);
> +}
The idea is good, but the patch is obviously wrong; it should be
!IS_ENABLED() :)
Also, please remove the parentheses around chip->snoop.
thanks,
Takashi
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] ALSA: hda: fix unused variable warning
2018-09-11 8:37 ` Takashi Iwai
@ 2018-09-11 14:18 ` Anders Roxell
2018-09-11 14:18 ` [PATCH v2] " Anders Roxell
1 sibling, 0 replies; 5+ messages in thread
From: Anders Roxell @ 2018-09-11 14:18 UTC (permalink / raw)
To: tiwai; +Cc: perex, alsa-devel, Linux Kernel Mailing List
On Tue, 11 Sep 2018 at 10:38, Takashi Iwai <tiwai@suse.de> wrote:
>
> On Tue, 11 Sep 2018 10:25:59 +0200,
> Anders Roxell wrote:
> >
> > When CONFIG_X86=n function azx_snoop doesn't use the variable chip it
> > only returns true.
> >
> > sound/pci/hda/hda_intel.c: In function ‘dma_alloc_pages’:
> > sound/pci/hda/hda_intel.c:2002:14: warning: unused variable ‘chip’ [-Wunused-variable]
> > struct azx *chip = bus_to_azx(bus);
> > ^~~~
> >
> > Create a inline function of azx_snoop.
> >
> > Fixes: a41d122449be ("ALSA: hda - Embed bus into controller object")
> > Signed-off-by: Anders Roxell <anders.roxell@linaro.org>
> > ---
> > sound/pci/hda/hda_controller.h | 9 ++++-----
> > 1 file changed, 4 insertions(+), 5 deletions(-)
> >
> > diff --git a/sound/pci/hda/hda_controller.h b/sound/pci/hda/hda_controller.h
> > index 0053b704ddc4..aa20048742d0 100644
> > --- a/sound/pci/hda/hda_controller.h
> > +++ b/sound/pci/hda/hda_controller.h
> > @@ -170,11 +170,10 @@ struct azx {
> > #define azx_bus(chip) (&(chip)->bus.core)
> > #define bus_to_azx(_bus) container_of(_bus, struct azx, bus.core)
> >
> > -#ifdef CONFIG_X86
> > -#define azx_snoop(chip) ((chip)->snoop)
> > -#else
> > -#define azx_snoop(chip) true
> > -#endif
> > +static inline bool azx_snoop(struct azx *chip)
> > +{
> > + return IS_ENABLED(CONFIG_X86) || (chip->snoop);
> > +}
>
> The idea is good, but the patch is obviously wrong; it should be
> !IS_ENABLED() :)
oops, right.
>
> Also, please remove the parentheses around chip->snoop.
OK.
Sending v2 shortly.
Cheers,
Anders
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH v2] ALSA: hda: fix unused variable warning
2018-09-11 8:37 ` Takashi Iwai
2018-09-11 14:18 ` Anders Roxell
@ 2018-09-11 14:18 ` Anders Roxell
2018-09-11 14:47 ` Takashi Iwai
1 sibling, 1 reply; 5+ messages in thread
From: Anders Roxell @ 2018-09-11 14:18 UTC (permalink / raw)
To: perex, tiwai; +Cc: alsa-devel, linux-kernel, Anders Roxell
When CONFIG_X86=n function azx_snoop doesn't use the variable chip it
only returns true.
sound/pci/hda/hda_intel.c: In function ‘dma_alloc_pages’:
sound/pci/hda/hda_intel.c:2002:14: warning: unused variable ‘chip’ [-Wunused-variable]
struct azx *chip = bus_to_azx(bus);
^~~~
Create a inline function of azx_snoop.
Fixes: a41d122449be ("ALSA: hda - Embed bus into controller object")
Signed-off-by: Anders Roxell <anders.roxell@linaro.org>
---
sound/pci/hda/hda_controller.h | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
diff --git a/sound/pci/hda/hda_controller.h b/sound/pci/hda/hda_controller.h
index 0053b704ddc4..c95097bb5a0c 100644
--- a/sound/pci/hda/hda_controller.h
+++ b/sound/pci/hda/hda_controller.h
@@ -170,11 +170,10 @@ struct azx {
#define azx_bus(chip) (&(chip)->bus.core)
#define bus_to_azx(_bus) container_of(_bus, struct azx, bus.core)
-#ifdef CONFIG_X86
-#define azx_snoop(chip) ((chip)->snoop)
-#else
-#define azx_snoop(chip) true
-#endif
+static inline bool azx_snoop(struct azx *chip)
+{
+ return !IS_ENABLED(CONFIG_X86) || chip->snoop;
+}
/*
* macros for easy use
--
2.18.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH v2] ALSA: hda: fix unused variable warning
2018-09-11 14:18 ` [PATCH v2] " Anders Roxell
@ 2018-09-11 14:47 ` Takashi Iwai
0 siblings, 0 replies; 5+ messages in thread
From: Takashi Iwai @ 2018-09-11 14:47 UTC (permalink / raw)
To: Anders Roxell; +Cc: perex, alsa-devel, linux-kernel
On Tue, 11 Sep 2018 16:18:36 +0200,
Anders Roxell wrote:
>
> When CONFIG_X86=n function azx_snoop doesn't use the variable chip it
> only returns true.
>
> sound/pci/hda/hda_intel.c: In function ‘dma_alloc_pages’:
> sound/pci/hda/hda_intel.c:2002:14: warning: unused variable ‘chip’ [-Wunused-variable]
> struct azx *chip = bus_to_azx(bus);
> ^~~~
>
> Create a inline function of azx_snoop.
>
> Fixes: a41d122449be ("ALSA: hda - Embed bus into controller object")
> Signed-off-by: Anders Roxell <anders.roxell@linaro.org>
Applied, thanks.
Takashi
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2018-09-11 14:47 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-09-11 8:25 [PATCH] ALSA: hda: fix unused variable warning Anders Roxell
2018-09-11 8:37 ` Takashi Iwai
2018-09-11 14:18 ` Anders Roxell
2018-09-11 14:18 ` [PATCH v2] " Anders Roxell
2018-09-11 14:47 ` Takashi Iwai
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).