Skip to contentSkip to conversation

net: cpsw: Add __maybe_unused to generated inlines

PATCH New Tom Rini 3 participants 3 messages Jun 4, 2020 – Jun 18, 2020 Network drivers

lore
Share & tools
lore

Tom Rini

author
#0 lore raw

PATCH 1/1 net: cpsw: Add __maybe_unused to generated inlines

We generate a number of helper inline functions to make accesses easier. However not all permutations of each function will be used and clang will warn about unused ones. Decorate all of them with __maybe_unused because of this.

Cc Lokesh Vutla <[email protected]>
---
 drivers/net/ti/cpsw.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/net/ti/cpsw.c +3 -2
index 95761fffc0f0..9d4332f45048 100644
@@ -17,6 +17,7 @@
 #include <cpsw.h>
 #include <dm/device_compat.h>
 #include <linux/bitops.h>
+#include <linux/compiler.h>
 #include <linux/errno.h>
 #include <asm/gpio.h>
 #include <asm/io.h>
@@ -247,11 +248,11 @@ static inline void cpsw_ale_set_field(u32 *ale_entry, u32 start, u32 bits,
 }
 
 #define DEFINE_ALE_FIELD(name, start, bits)				\
-static inline int cpsw_ale_get_##name(u32 *ale_entry)			\
+static inline int __maybe_unused cpsw_ale_get_##name(u32 *ale_entry)	\
 {									\
 	return cpsw_ale_get_field(ale_entry, start, bits);		\
 }									\
-static inline void cpsw_ale_set_##name(u32 *ale_entry, u32 value)	\
+static inline void __maybe_unused cpsw_ale_set_##name(u32 *ale_entry, u32 value)	\
 {									\
 	cpsw_ale_set_field(ale_entry, start, bits, value);		\
 }
Signature · 1 line
2.17.1
#1 lore raw

PATCH 1/1 net: cpsw: Add __maybe_unused to generated inlines

Quoted 28 lines · Tom Rini

We generate a number of helper inline functions to make accesses easier. However not all permutations of each function will be used and clang will warn about unused ones. Decorate all of them with __maybe_unused because of this.

Cc Lokesh Vutla <[email protected]>
---
  drivers/net/ti/cpsw.c | 5 +++--
  1 file changed, 3 insertions(+), 2 deletions(-)
drivers/net/ti/cpsw.c +1 -0
index 95761fffc0f0..9d4332f45048 100644
@@ -17,6 +17,7 @@
  #include <cpsw.h>
  #include <dm/device_compat.h>
  #include <linux/bitops.h>
+#include <linux/compiler.h>
  #include <linux/errno.h>
  #include <asm/gpio.h>
  #include <asm/io.h>
@@ -247,11 +248,11 @@ static inline void cpsw_ale_set_field(u32 *ale_entry, u32 start, u32 bits,
  }
 
  #define DEFINE_ALE_FIELD(name, start, bits)				\

drivers/net/ti/cpsw.c static inline void cpsw_ale_set_field(u32 *ale_entry, u32 start, u32 bits, · line 258

Quoted 10 lines
drivers/net/ti/cpsw.c +2 -2
-static inline int cpsw_ale_get_##name(u32 *ale_entry)			\
+static inline int __maybe_unused cpsw_ale_get_##name(u32 *ale_entry)	\
  {									\
  	return cpsw_ale_get_field(ale_entry, start, bits);		\
  }									\
-static inline void cpsw_ale_set_##name(u32 *ale_entry, u32 value)	\
+static inline void __maybe_unused cpsw_ale_set_##name(u32 *ale_entry, u32 value)	\
  {									\
  	cpsw_ale_set_field(ale_entry, start, bits, value);		\
  }

Thank you.

Signature · 2 lines
Best regards,
grygorii
#2 lore raw

PATCH 1/1 net: cpsw: Add __maybe_unused to generated inlines

In reply to Tom Rini
Quoted 7 lines · Tom Rini

We generate a number of helper inline functions to make accesses easier. However not all permutations of each function will be used and clang will warn about unused ones. Decorate all of them with __maybe_unused because of this.

Cc Lokesh Vutla <[email protected]>

Applied to u-boot-ti next.

Thanks and regards,
Lokesh