Skip to contentSkip to conversation

ALSA: ymfpci: remove unused snd_ymfpci_readb function

PATCH In review Tom Rix 3 participants 4 messages Mar 18, 2023 – Mar 20, 2023 Sound

lore
Share & tools
lore

Tom Rix

author
#0 lore raw

PATCH 1/1 ALSA: ymfpci: remove unused snd_ymfpci_readb function

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.

---
 sound/pci/ymfpci/ymfpci_main.c | 5 -----
 1 file changed, 5 deletions(-)
sound/pci/ymfpci/ymfpci_main.c +0 -5
index c80114c0ad7b..2858736ed20a 100644
@@ -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);
Signature · 1 line
2.27.0
#1 lore raw
Quoted 9 lines · 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.

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

thanks,

Takashi

Quoted 23 lines
---
 sound/pci/ymfpci/ymfpci_main.c | 5 -----
 1 file changed, 5 deletions(-)
sound/pci/ymfpci/ymfpci_main.c +0 -5
index c80114c0ad7b..2858736ed20a 100644
@@ -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);
Signature · 1 line
2.27.0
#2 lore raw
Quoted 10 lines · Takashi Iwai
Quoted 8 lines · 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.

Quoted 4 lines
Quoted 1 line

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

Quoted 23 lines
Quoted 23 lines
---
 sound/pci/ymfpci/ymfpci_main.c | 5 -----
 1 file changed, 5 deletions(-)
sound/pci/ymfpci/ymfpci_main.c +0 -5
index c80114c0ad7b..2858736ed20a 100644
@@ -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);
Signature · 1 line
2.27.0
author
#3 lore raw
Quoted 10 lines · Nathan Chancellor
Quoted 9 lines · Takashi Iwai
Quoted 7 lines · 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.

Quoted 7 lines
Quoted 3 lines
Quoted 1 line

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

Quoted 27 lines

Cheers,
Nathan

Quoted 23 lines
Quoted 23 lines
---
  sound/pci/ymfpci/ymfpci_main.c | 5 -----
  1 file changed, 5 deletions(-)
sound/pci/ymfpci/ymfpci_main.c +0 -5
index c80114c0ad7b..2858736ed20a 100644
@@ -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);
Signature · 1 line
2.27.0