public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ALSA: ymfpci: remove unused snd_ymfpci_readb function
@ 2023-03-18 13:27 Tom Rix
  2023-03-19  8:09 ` Takashi Iwai
  0 siblings, 1 reply; 4+ messages in thread
From: Tom Rix @ 2023-03-18 13:27 UTC (permalink / raw)
  To: perex, tiwai, nathan, ndesaulniers
  Cc: alsa-devel, linux-kernel, llvm, Tom Rix

clang with W=1 reports
sound/pci/ymfpci/ymfpci_main.c:34:18: error:
  unused function 'snd_ymfpci_readb' [-Werror,-Wunused-function]
static inline u8 snd_ymfpci_readb(struct snd_ymfpci *chip, u32 offset)
                 ^
This static function is not used, so remove it.

Signed-off-by: Tom Rix <trix@redhat.com>
---
 sound/pci/ymfpci/ymfpci_main.c | 5 -----
 1 file changed, 5 deletions(-)

diff --git a/sound/pci/ymfpci/ymfpci_main.c b/sound/pci/ymfpci/ymfpci_main.c
index c80114c0ad7b..2858736ed20a 100644
--- a/sound/pci/ymfpci/ymfpci_main.c
+++ b/sound/pci/ymfpci/ymfpci_main.c
@@ -31,11 +31,6 @@
 
 static void snd_ymfpci_irq_wait(struct snd_ymfpci *chip);
 
-static inline u8 snd_ymfpci_readb(struct snd_ymfpci *chip, u32 offset)
-{
-	return readb(chip->reg_area_virt + offset);
-}
-
 static inline void snd_ymfpci_writeb(struct snd_ymfpci *chip, u32 offset, u8 val)
 {
 	writeb(val, chip->reg_area_virt + offset);
-- 
2.27.0


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

* Re: [PATCH] ALSA: ymfpci: remove unused snd_ymfpci_readb function
  2023-03-18 13:27 [PATCH] ALSA: ymfpci: remove unused snd_ymfpci_readb function Tom Rix
@ 2023-03-19  8:09 ` Takashi Iwai
  2023-03-19 23:34   ` Nathan Chancellor
  0 siblings, 1 reply; 4+ messages in thread
From: Takashi Iwai @ 2023-03-19  8:09 UTC (permalink / raw)
  To: Tom Rix; +Cc: perex, tiwai, nathan, ndesaulniers, alsa-devel, linux-kernel,
	llvm

On Sat, 18 Mar 2023 14:27:08 +0100,
Tom Rix wrote:
> 
> clang with W=1 reports
> sound/pci/ymfpci/ymfpci_main.c:34:18: error:
>   unused function 'snd_ymfpci_readb' [-Werror,-Wunused-function]
> static inline u8 snd_ymfpci_readb(struct snd_ymfpci *chip, u32 offset)
>                  ^
> This static function is not used, so remove it.
> 
> Signed-off-by: Tom Rix <trix@redhat.com>

I applied now, but still wondering why it warns at all even if it's a
static inline function...


thanks,

Takashi

> ---
>  sound/pci/ymfpci/ymfpci_main.c | 5 -----
>  1 file changed, 5 deletions(-)
> 
> diff --git a/sound/pci/ymfpci/ymfpci_main.c b/sound/pci/ymfpci/ymfpci_main.c
> index c80114c0ad7b..2858736ed20a 100644
> --- a/sound/pci/ymfpci/ymfpci_main.c
> +++ b/sound/pci/ymfpci/ymfpci_main.c
> @@ -31,11 +31,6 @@
>  
>  static void snd_ymfpci_irq_wait(struct snd_ymfpci *chip);
>  
> -static inline u8 snd_ymfpci_readb(struct snd_ymfpci *chip, u32 offset)
> -{
> -	return readb(chip->reg_area_virt + offset);
> -}
> -
>  static inline void snd_ymfpci_writeb(struct snd_ymfpci *chip, u32 offset, u8 val)
>  {
>  	writeb(val, chip->reg_area_virt + offset);
> -- 
> 2.27.0
> 

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

* Re: [PATCH] ALSA: ymfpci: remove unused snd_ymfpci_readb function
  2023-03-19  8:09 ` Takashi Iwai
@ 2023-03-19 23:34   ` Nathan Chancellor
  2023-03-20 12:33     ` Tom Rix
  0 siblings, 1 reply; 4+ messages in thread
From: Nathan Chancellor @ 2023-03-19 23:34 UTC (permalink / raw)
  To: Takashi Iwai
  Cc: Tom Rix, perex, tiwai, ndesaulniers, alsa-devel, linux-kernel,
	llvm

On Sun, Mar 19, 2023 at 09:09:22AM +0100, Takashi Iwai wrote:
> On Sat, 18 Mar 2023 14:27:08 +0100,
> Tom Rix wrote:
> > 
> > clang with W=1 reports
> > sound/pci/ymfpci/ymfpci_main.c:34:18: error:
> >   unused function 'snd_ymfpci_readb' [-Werror,-Wunused-function]
> > static inline u8 snd_ymfpci_readb(struct snd_ymfpci *chip, u32 offset)
> >                  ^
> > This static function is not used, so remove it.
> > 
> > Signed-off-by: Tom Rix <trix@redhat.com>
> 
> I applied now, but still wondering why it warns at all even if it's a
> static inline function...

See commit 6863f5643dd7 ("kbuild: allow Clang to find unused static
inline functions for W=1 build") for some more information. The key part
of the commit message is 'with W=1', this will not happen with a normal
clang build.

Cheers,
Nathan

> > ---
> >  sound/pci/ymfpci/ymfpci_main.c | 5 -----
> >  1 file changed, 5 deletions(-)
> > 
> > diff --git a/sound/pci/ymfpci/ymfpci_main.c b/sound/pci/ymfpci/ymfpci_main.c
> > index c80114c0ad7b..2858736ed20a 100644
> > --- a/sound/pci/ymfpci/ymfpci_main.c
> > +++ b/sound/pci/ymfpci/ymfpci_main.c
> > @@ -31,11 +31,6 @@
> >  
> >  static void snd_ymfpci_irq_wait(struct snd_ymfpci *chip);
> >  
> > -static inline u8 snd_ymfpci_readb(struct snd_ymfpci *chip, u32 offset)
> > -{
> > -	return readb(chip->reg_area_virt + offset);
> > -}
> > -
> >  static inline void snd_ymfpci_writeb(struct snd_ymfpci *chip, u32 offset, u8 val)
> >  {
> >  	writeb(val, chip->reg_area_virt + offset);
> > -- 
> > 2.27.0
> > 

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

* Re: [PATCH] ALSA: ymfpci: remove unused snd_ymfpci_readb function
  2023-03-19 23:34   ` Nathan Chancellor
@ 2023-03-20 12:33     ` Tom Rix
  0 siblings, 0 replies; 4+ messages in thread
From: Tom Rix @ 2023-03-20 12:33 UTC (permalink / raw)
  To: Nathan Chancellor, Takashi Iwai
  Cc: perex, tiwai, ndesaulniers, alsa-devel, linux-kernel, llvm


On 3/19/23 4:34 PM, Nathan Chancellor wrote:
> On Sun, Mar 19, 2023 at 09:09:22AM +0100, Takashi Iwai wrote:
>> On Sat, 18 Mar 2023 14:27:08 +0100,
>> Tom Rix wrote:
>>> clang with W=1 reports
>>> sound/pci/ymfpci/ymfpci_main.c:34:18: error:
>>>    unused function 'snd_ymfpci_readb' [-Werror,-Wunused-function]
>>> static inline u8 snd_ymfpci_readb(struct snd_ymfpci *chip, u32 offset)
>>>                   ^
>>> This static function is not used, so remove it.
>>>
>>> Signed-off-by: Tom Rix <trix@redhat.com>
>> I applied now, but still wondering why it warns at all even if it's a
>> static inline function...
> See commit 6863f5643dd7 ("kbuild: allow Clang to find unused static
> inline functions for W=1 build") for some more information. The key part
> of the commit message is 'with W=1', this will not happen with a normal
> clang build.

IMO from this general cleanup, being at W=1, is the correct location.

There many functions that could be removed and some that should not be.

Tom

>
> Cheers,
> Nathan
>
>>> ---
>>>   sound/pci/ymfpci/ymfpci_main.c | 5 -----
>>>   1 file changed, 5 deletions(-)
>>>
>>> diff --git a/sound/pci/ymfpci/ymfpci_main.c b/sound/pci/ymfpci/ymfpci_main.c
>>> index c80114c0ad7b..2858736ed20a 100644
>>> --- a/sound/pci/ymfpci/ymfpci_main.c
>>> +++ b/sound/pci/ymfpci/ymfpci_main.c
>>> @@ -31,11 +31,6 @@
>>>   
>>>   static void snd_ymfpci_irq_wait(struct snd_ymfpci *chip);
>>>   
>>> -static inline u8 snd_ymfpci_readb(struct snd_ymfpci *chip, u32 offset)
>>> -{
>>> -	return readb(chip->reg_area_virt + offset);
>>> -}
>>> -
>>>   static inline void snd_ymfpci_writeb(struct snd_ymfpci *chip, u32 offset, u8 val)
>>>   {
>>>   	writeb(val, chip->reg_area_virt + offset);
>>> -- 
>>> 2.27.0
>>>


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

end of thread, other threads:[~2023-03-20 12:34 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-03-18 13:27 [PATCH] ALSA: ymfpci: remove unused snd_ymfpci_readb function Tom Rix
2023-03-19  8:09 ` Takashi Iwai
2023-03-19 23:34   ` Nathan Chancellor
2023-03-20 12:33     ` Tom Rix

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox