Skip to contentSkip to conversation

net: qed: make 'qed_ll2_ops_pass' as __maybe_unused

PATCH Applied Arnd Bergmann 3 participants 3 messages Feb 25, 2025 – Feb 28, 2025

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net: qed: make 'qed_ll2_ops_pass' as __maybe_unused

From: Arnd Bergmann <[email protected]>

gcc warns about unused const variables even in header files when building with W=1:

In file included from include/linux/qed/qed_rdma_if.h:14,
from drivers/net/ethernet/qlogic/qed/qed_rdma.h:16,
from drivers/net/ethernet/qlogic/qed/qed_cxt.c:23:
include/linux/qed/qed_ll2_if.h:270:33: error: 'qed_ll2_ops_pass' defined but not used [-Werror=unused-const-variable=]
270 | static const struct qed_ll2_ops qed_ll2_ops_pass = {

This one is intentional, so mark it as __maybe_unused to it can be included from a file that doesn't use this variable.

---
 include/linux/qed/qed_ll2_if.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
include/linux/qed/qed_ll2_if.h +1 -1
index 5b67cd03276e..aa29ac53b833 100644
@@ -267,7 +267,7 @@ struct qed_ll2_ops {
 int qed_ll2_alloc_if(struct qed_dev *);
 void qed_ll2_dealloc_if(struct qed_dev *);
 #else
-static const struct qed_ll2_ops qed_ll2_ops_pass = {
+static __maybe_unused const struct qed_ll2_ops qed_ll2_ops_pass = {
 	.start = NULL,
 	.stop = NULL,
 	.start_xmit = NULL,
Signature · 1 line
2.39.5
reviewer Reviewed-by Tested-by on v1 1/1
#1 lore raw

+ Andrew, Dave, Eric, Jakub, and Paolo

Quoted 11 lines · Arnd Bergmann

From: Arnd Bergmann <[email protected]>

gcc warns about unused const variables even in header files when building with W=1:

In file included from include/linux/qed/qed_rdma_if.h:14,
from drivers/net/ethernet/qlogic/qed/qed_rdma.h:16,
from drivers/net/ethernet/qlogic/qed/qed_cxt.c:23:
include/linux/qed/qed_ll2_if.h:270:33: error: 'qed_ll2_ops_pass' defined but not used [-Werror=unused-const-variable=]
270 | static const struct qed_ll2_ops qed_ll2_ops_pass = {

Quoted 4 lines

This one is intentional, so mark it as __maybe_unused to it can be included from a file that doesn't use this variable.

This is marked as being not a local patch in netdev patchwork. That doesn't seem right to me and perhaps this will address that.

pw-bot: under-review

Possibly this because is because while qed_rdma_if.h is included in the QLOGIC QL4xxx ETHERNET DRIVER section
of MAINTAINERS, it is not included in the NETWORKING DRIVERS section.

I will plan to submit a patch to address that.

#2 lore raw
In reply to Arnd Bergmann
This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:

Hello:

This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:

Quoted 5 lines · On Tue, 25 Feb 2025 21:09:23 +0100 you wrote:

From: Arnd Bergmann <[email protected]>

gcc warns about unused const variables even in header files when building with W=1:

Quoted 7 lines

In file included from include/linux/qed/qed_rdma_if.h:14,
from drivers/net/ethernet/qlogic/qed/qed_rdma.h:16,
from drivers/net/ethernet/qlogic/qed/qed_cxt.c:23:
include/linux/qed/qed_ll2_if.h:270:33: error: 'qed_ll2_ops_pass' defined but not used [-Werror=unused-const-variable=]
270 | static const struct qed_ll2_ops qed_ll2_ops_pass = {

[...]

Here is the summary with links:
- net: qed: make 'qed_ll2_ops_pass' as __maybe_unused

    https://git.kernel.org/netdev/net-next/c/f8131f4cc5bd

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html