From: Ido Schimmel <idosch@nvidia.com>
To: kernel test robot <lkp@intel.com>, <nathan@kernel.org>
Cc: "llvm@lists.linux.dev" <llvm@lists.linux.dev>,
"kbuild-all@lists.01.org" <kbuild-all@lists.01.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
Jiri Pirko <jiri@nvidia.com>
Subject: Re: drivers/net/ethernet/mellanox/mlxsw/core_acl_flex_actions.c:2022:1: warning: unused function 'mlxsw_afa_sampler_mirror_agent_get'
Date: Wed, 29 Sep 2021 12:44:16 +0300 [thread overview]
Message-ID: <YVQ1cE0Ke2cWzB0r@shredder> (raw)
In-Reply-To: <202109290245.bpgij5Zs-lkp@intel.com>
On Tue, Sep 28, 2021 at 09:06:54PM +0300, kernel test robot wrote:
> All warnings (new ones prefixed by >>):
>
> static inline u32 mlxsw_##_type##_##_cname##_##_iname##_get(const char ^
> <scratch space>:119:1: note: expanded from here
> mlxsw_afa_polcnt_c_p_get
> ^
Nathan,
I saw your reply to a similar issue here [1] and I got the impression
that you are leading the LLVM-related efforts, so I thought I will
consult with you regarding a possible solution.
The inline functions that clang is complaining about are generated by
macros that make it easy to set/get fields in the payloads of
configuration messages used to communicate with the device. It is
possible that sometime we only set a field, but never retrieve its value
such as in the warning above. This is very much intentional and not
indicative of a function we forgot to remove.
The patch below [2] adds the "__maybe_unused" keyword to these macros
and makes clang happy [3].
Is this acceptable or you suggest a different solution?
Thanks
[1] https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org/thread/TIUWC7KZVTHGJKIZ4M3LI3JJYVAAINJX/
[2]
diff --git a/drivers/net/ethernet/mellanox/mlxsw/item.h b/drivers/net/ethernet/mellanox/mlxsw/item.h
index e92cadc98128..d2c8f436efb7 100644
--- a/drivers/net/ethernet/mellanox/mlxsw/item.h
+++ b/drivers/net/ethernet/mellanox/mlxsw/item.h
@@ -290,13 +290,13 @@ static struct mlxsw_item __ITEM_NAME(_type, _cname, _iname) = { \
.size = {.bits = _sizebits,}, \
.name = #_type "_" #_cname "_" #_iname, \
}; \
-static inline u8 \
+static inline u8 __maybe_unused \
mlxsw_##_type##_##_cname##_##_iname##_get(const char *buf, unsigned short index)\
{ \
return __mlxsw_item_get8(buf, &__ITEM_NAME(_type, _cname, _iname), \
index); \
} \
-static inline void \
+static inline void __maybe_unused \
mlxsw_##_type##_##_cname##_##_iname##_set(char *buf, unsigned short index, \
u8 val) \
{ \
@@ -311,11 +311,13 @@ static struct mlxsw_item __ITEM_NAME(_type, _cname, _iname) = { \
.size = {.bits = _sizebits,}, \
.name = #_type "_" #_cname "_" #_iname, \
}; \
-static inline u16 mlxsw_##_type##_##_cname##_##_iname##_get(const char *buf) \
+static inline u16 __maybe_unused \
+mlxsw_##_type##_##_cname##_##_iname##_get(const char *buf) \
{ \
return __mlxsw_item_get16(buf, &__ITEM_NAME(_type, _cname, _iname), 0); \
} \
-static inline void mlxsw_##_type##_##_cname##_##_iname##_set(char *buf, u16 val)\
+static inline void __maybe_unused \
+mlxsw_##_type##_##_cname##_##_iname##_set(char *buf, u16 val) \
{ \
__mlxsw_item_set16(buf, &__ITEM_NAME(_type, _cname, _iname), 0, val); \
}
@@ -331,13 +333,13 @@ static struct mlxsw_item __ITEM_NAME(_type, _cname, _iname) = { \
.size = {.bits = _sizebits,}, \
.name = #_type "_" #_cname "_" #_iname, \
}; \
-static inline u16 \
+static inline u16 __maybe_unused \
mlxsw_##_type##_##_cname##_##_iname##_get(const char *buf, unsigned short index)\
{ \
return __mlxsw_item_get16(buf, &__ITEM_NAME(_type, _cname, _iname), \
index); \
} \
-static inline void \
+static inline void __maybe_unused \
mlxsw_##_type##_##_cname##_##_iname##_set(char *buf, unsigned short index, \
u16 val) \
{ \
@@ -352,11 +354,13 @@ static struct mlxsw_item __ITEM_NAME(_type, _cname, _iname) = { \
.size = {.bits = _sizebits,}, \
.name = #_type "_" #_cname "_" #_iname, \
}; \
-static inline u32 mlxsw_##_type##_##_cname##_##_iname##_get(const char *buf) \
+static inline u32 __maybe_unused \
+mlxsw_##_type##_##_cname##_##_iname##_get(const char *buf) \
{ \
return __mlxsw_item_get32(buf, &__ITEM_NAME(_type, _cname, _iname), 0); \
} \
-static inline void mlxsw_##_type##_##_cname##_##_iname##_set(char *buf, u32 val)\
+static inline void __maybe_unused \
+mlxsw_##_type##_##_cname##_##_iname##_set(char *buf, u32 val) \
{ \
__mlxsw_item_set32(buf, &__ITEM_NAME(_type, _cname, _iname), 0, val); \
}
@@ -372,13 +376,13 @@ static struct mlxsw_item __ITEM_NAME(_type, _cname, _iname) = { \
.size = {.bits = _sizebits,}, \
.name = #_type "_" #_cname "_" #_iname, \
}; \
-static inline u32 \
+static inline u32 __maybe_unused \
mlxsw_##_type##_##_cname##_##_iname##_get(const char *buf, unsigned short index)\
{ \
return __mlxsw_item_get32(buf, &__ITEM_NAME(_type, _cname, _iname), \
index); \
} \
-static inline void \
+static inline void __maybe_unused \
mlxsw_##_type##_##_cname##_##_iname##_set(char *buf, unsigned short index, \
u32 val) \
{ \
@@ -393,11 +397,13 @@ static struct mlxsw_item __ITEM_NAME(_type, _cname, _iname) = { \
.size = {.bits = _sizebits,}, \
.name = #_type "_" #_cname "_" #_iname, \
}; \
-static inline u64 mlxsw_##_type##_##_cname##_##_iname##_get(const char *buf) \
+static inline u64 __maybe_unused \
+mlxsw_##_type##_##_cname##_##_iname##_get(const char *buf) \
{ \
return __mlxsw_item_get64(buf, &__ITEM_NAME(_type, _cname, _iname), 0); \
} \
-static inline void mlxsw_##_type##_##_cname##_##_iname##_set(char *buf, u64 val)\
+static inline void __maybe_unused \
+mlxsw_##_type##_##_cname##_##_iname##_set(char *buf, u64 val) \
{ \
__mlxsw_item_set64(buf, &__ITEM_NAME(_type, _cname, _iname), 0, val); \
}
@@ -413,13 +419,13 @@ static struct mlxsw_item __ITEM_NAME(_type, _cname, _iname) = { \
.size = {.bits = _sizebits,}, \
.name = #_type "_" #_cname "_" #_iname, \
}; \
-static inline u64 \
+static inline u64 __maybe_unused \
mlxsw_##_type##_##_cname##_##_iname##_get(const char *buf, unsigned short index)\
{ \
return __mlxsw_item_get64(buf, &__ITEM_NAME(_type, _cname, _iname), \
index); \
} \
-static inline void \
+static inline void __maybe_unused \
mlxsw_##_type##_##_cname##_##_iname##_set(char *buf, unsigned short index, \
u64 val) \
{ \
@@ -433,19 +439,19 @@ static struct mlxsw_item __ITEM_NAME(_type, _cname, _iname) = { \
.size = {.bytes = _sizebytes,}, \
.name = #_type "_" #_cname "_" #_iname, \
}; \
-static inline void \
+static inline void __maybe_unused \
mlxsw_##_type##_##_cname##_##_iname##_memcpy_from(const char *buf, char *dst) \
{ \
__mlxsw_item_memcpy_from(buf, dst, \
&__ITEM_NAME(_type, _cname, _iname), 0); \
} \
-static inline void \
+static inline void __maybe_unused \
mlxsw_##_type##_##_cname##_##_iname##_memcpy_to(char *buf, const char *src) \
{ \
__mlxsw_item_memcpy_to(buf, src, \
&__ITEM_NAME(_type, _cname, _iname), 0); \
} \
-static inline char * \
+static inline char * __maybe_unused \
mlxsw_##_type##_##_cname##_##_iname##_data(char *buf) \
{ \
return __mlxsw_item_data(buf, &__ITEM_NAME(_type, _cname, _iname), 0); \
@@ -460,7 +466,7 @@ static struct mlxsw_item __ITEM_NAME(_type, _cname, _iname) = { \
.size = {.bytes = _sizebytes,}, \
.name = #_type "_" #_cname "_" #_iname, \
}; \
-static inline void \
+static inline void __maybe_unused \
mlxsw_##_type##_##_cname##_##_iname##_memcpy_from(const char *buf, \
unsigned short index, \
char *dst) \
@@ -468,7 +474,7 @@ mlxsw_##_type##_##_cname##_##_iname##_memcpy_from(const char *buf, \
__mlxsw_item_memcpy_from(buf, dst, \
&__ITEM_NAME(_type, _cname, _iname), index); \
} \
-static inline void \
+static inline void __maybe_unused \
mlxsw_##_type##_##_cname##_##_iname##_memcpy_to(char *buf, \
unsigned short index, \
const char *src) \
@@ -476,7 +482,7 @@ mlxsw_##_type##_##_cname##_##_iname##_memcpy_to(char *buf, \
__mlxsw_item_memcpy_to(buf, src, \
&__ITEM_NAME(_type, _cname, _iname), index); \
} \
-static inline char * \
+static inline char * __maybe_unused \
mlxsw_##_type##_##_cname##_##_iname##_data(char *buf, unsigned short index) \
{ \
return __mlxsw_item_data(buf, \
@@ -491,14 +497,14 @@ static struct mlxsw_item __ITEM_NAME(_type, _cname, _iname) = { \
.size = {.bytes = _sizebytes,}, \
.name = #_type "_" #_cname "_" #_iname, \
}; \
-static inline u8 \
+static inline u8 __maybe_unused \
mlxsw_##_type##_##_cname##_##_iname##_get(const char *buf, u16 index) \
{ \
return __mlxsw_item_bit_array_get(buf, \
&__ITEM_NAME(_type, _cname, _iname), \
index); \
} \
-static inline void \
+static inline void __maybe_unused \
mlxsw_##_type##_##_cname##_##_iname##_set(char *buf, u16 index, u8 val) \
{ \
return __mlxsw_item_bit_array_set(buf, \
[3]
$ make -j8 CC=clang C=2 W=1 drivers/net/ethernet/mellanox/mlxsw/
DESCEND bpf/resolve_btfids
DESCEND objtool
CHECK scripts/mod/empty.c
CALL scripts/atomic/check-atomics.sh
CALL scripts/checksyscalls.sh
CHECK drivers/net/ethernet/mellanox/mlxsw/core.c
CHECK drivers/net/ethernet/mellanox/mlxsw/core_acl_flex_keys.c
CHECK drivers/net/ethernet/mellanox/mlxsw/core_acl_flex_actions.c
CHECK drivers/net/ethernet/mellanox/mlxsw/core_env.c
CHECK drivers/net/ethernet/mellanox/mlxsw/core_hwmon.c
CHECK drivers/net/ethernet/mellanox/mlxsw/core_thermal.c
CHECK drivers/net/ethernet/mellanox/mlxsw/pci.c
CHECK drivers/net/ethernet/mellanox/mlxsw/i2c.c
CHECK drivers/net/ethernet/mellanox/mlxsw/spectrum.c
CHECK drivers/net/ethernet/mellanox/mlxsw/spectrum_buffers.c
CHECK drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c
CHECK drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c
CHECK drivers/net/ethernet/mellanox/mlxsw/spectrum_router_xm.c
CHECK drivers/net/ethernet/mellanox/mlxsw/spectrum1_kvdl.c
CHECK drivers/net/ethernet/mellanox/mlxsw/spectrum2_kvdl.c
CHECK drivers/net/ethernet/mellanox/mlxsw/spectrum_kvdl.c
CHECK drivers/net/ethernet/mellanox/mlxsw/spectrum_acl_tcam.c
CHECK drivers/net/ethernet/mellanox/mlxsw/spectrum_acl_ctcam.c
CHECK drivers/net/ethernet/mellanox/mlxsw/spectrum_acl_atcam.c
CHECK drivers/net/ethernet/mellanox/mlxsw/spectrum_acl_erp.c
CHECK drivers/net/ethernet/mellanox/mlxsw/spectrum1_acl_tcam.c
CHECK drivers/net/ethernet/mellanox/mlxsw/spectrum2_acl_tcam.c
CHECK drivers/net/ethernet/mellanox/mlxsw/spectrum_acl_bloom_filter.c
CHECK drivers/net/ethernet/mellanox/mlxsw/spectrum_acl.c
CHECK drivers/net/ethernet/mellanox/mlxsw/spectrum_flow.c
CHECK drivers/net/ethernet/mellanox/mlxsw/spectrum_matchall.c
CHECK drivers/net/ethernet/mellanox/mlxsw/spectrum_flower.c
CHECK drivers/net/ethernet/mellanox/mlxsw/spectrum_cnt.c
CHECK drivers/net/ethernet/mellanox/mlxsw/spectrum_fid.c
CHECK drivers/net/ethernet/mellanox/mlxsw/spectrum_ipip.c
CHECK drivers/net/ethernet/mellanox/mlxsw/spectrum_acl_flex_actions.c
CHECK drivers/net/ethernet/mellanox/mlxsw/spectrum_acl_flex_keys.c
CHECK drivers/net/ethernet/mellanox/mlxsw/spectrum1_mr_tcam.c
CHECK drivers/net/ethernet/mellanox/mlxsw/spectrum2_mr_tcam.c
CHECK drivers/net/ethernet/mellanox/mlxsw/spectrum_mr_tcam.c
CHECK drivers/net/ethernet/mellanox/mlxsw/spectrum_mr.c
CHECK drivers/net/ethernet/mellanox/mlxsw/spectrum_qdisc.c
CHECK drivers/net/ethernet/mellanox/mlxsw/spectrum_span.c
CHECK drivers/net/ethernet/mellanox/mlxsw/spectrum_nve.c
CHECK drivers/net/ethernet/mellanox/mlxsw/spectrum_nve_vxlan.c
CHECK drivers/net/ethernet/mellanox/mlxsw/spectrum_dpipe.c
CHECK drivers/net/ethernet/mellanox/mlxsw/spectrum_trap.c
CHECK drivers/net/ethernet/mellanox/mlxsw/spectrum_ethtool.c
CHECK drivers/net/ethernet/mellanox/mlxsw/spectrum_policer.c
CHECK drivers/net/ethernet/mellanox/mlxsw/spectrum_dcb.c
CHECK drivers/net/ethernet/mellanox/mlxsw/spectrum_ptp.c
CHECK drivers/net/ethernet/mellanox/mlxsw/minimal.c
next prev parent reply other threads:[~2021-09-29 9:44 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-09-28 18:06 drivers/net/ethernet/mellanox/mlxsw/core_acl_flex_actions.c:2022:1: warning: unused function 'mlxsw_afa_sampler_mirror_agent_get' kernel test robot
2021-09-29 9:44 ` Ido Schimmel [this message]
2021-09-29 16:39 ` Nathan Chancellor
2021-09-30 6:41 ` Ido Schimmel
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=YVQ1cE0Ke2cWzB0r@shredder \
--to=idosch@nvidia.com \
--cc=jiri@nvidia.com \
--cc=kbuild-all@lists.01.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lkp@intel.com \
--cc=llvm@lists.linux.dev \
--cc=nathan@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox