diff mbox series

net: cpsw: Add __maybe_unused to generated inlines

Message ID 20200604200532.5456-1-trini@konsulko.com
State Accepted
Commit eab48865f93a19e2a196a6c4e3480f16df4027d9
Headers show
Series net: cpsw: Add __maybe_unused to generated inlines | expand

Commit Message

Tom Rini June 4, 2020, 8:05 p.m. UTC
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 <lokeshvutla at ti.com>
Signed-off-by: Tom Rini <trini at konsulko.com>
---
 drivers/net/ti/cpsw.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

Comments

Grygorii Strashko June 6, 2020, 3:09 a.m. UTC | #1
On 04/06/2020 23:05, Tom Rini wrote:
> 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 <lokeshvutla at ti.com>
> Signed-off-by: Tom Rini <trini at konsulko.com>
> ---
>   drivers/net/ti/cpsw.c | 5 +++--
>   1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/net/ti/cpsw.c b/drivers/net/ti/cpsw.c
> index 95761fffc0f0..9d4332f45048 100644
> --- a/drivers/net/ti/cpsw.c
> +++ b/drivers/net/ti/cpsw.c
> @@ -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);		\
>   }
> 

Thank you.
Reviewed-by: Grygorii Strashko <grygorii.strashko at ti.com>
Lokesh Vutla June 18, 2020, 1:52 p.m. UTC | #2
On 05/06/20 1:35 am, Tom Rini wrote:
> 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 <lokeshvutla at ti.com>
> Signed-off-by: Tom Rini <trini at konsulko.com>

Applied to u-boot-ti next.

Thanks and regards,
Lokesh
diff mbox series

Patch

diff --git a/drivers/net/ti/cpsw.c b/drivers/net/ti/cpsw.c
index 95761fffc0f0..9d4332f45048 100644
--- a/drivers/net/ti/cpsw.c
+++ b/drivers/net/ti/cpsw.c
@@ -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);		\
 }