* [PATCH 1/2] net: hisilicon: hns_mdio: remove incorrect ACPI_PTR annotation
@ 2025-02-25 16:33 Arnd Bergmann
2025-02-25 16:33 ` [PATCH 2/2] net: xgene-v2: " Arnd Bergmann
` (2 more replies)
0 siblings, 3 replies; 8+ messages in thread
From: Arnd Bergmann @ 2025-02-25 16:33 UTC (permalink / raw)
To: Jian Shen, Salil Mehta, Andrew Lunn, David S. Miller,
Eric Dumazet, Jakub Kicinski, Paolo Abeni
Cc: Arnd Bergmann, Simon Horman, Uwe Kleine-König,
Krzysztof Kozlowski, netdev, linux-kernel
From: Arnd Bergmann <arnd@arndb.de>
Building with W=1 shows a warning about hns_mdio_acpi_match being unused when
CONFIG_ACPI is disabled:
drivers/net/ethernet/hisilicon/hns_mdio.c:631:36: error: unused variable 'hns_mdio_acpi_match' [-Werror,-Wunused-const-variable]
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
drivers/net/ethernet/hisilicon/hns_mdio.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/hisilicon/hns_mdio.c b/drivers/net/ethernet/hisilicon/hns_mdio.c
index a1aa6c1f966e..6812be8dc64f 100644
--- a/drivers/net/ethernet/hisilicon/hns_mdio.c
+++ b/drivers/net/ethernet/hisilicon/hns_mdio.c
@@ -640,7 +640,7 @@ static struct platform_driver hns_mdio_driver = {
.driver = {
.name = MDIO_DRV_NAME,
.of_match_table = hns_mdio_match,
- .acpi_match_table = ACPI_PTR(hns_mdio_acpi_match),
+ .acpi_match_table = hns_mdio_acpi_match,
},
};
--
2.39.5
^ permalink raw reply related [flat|nested] 8+ messages in thread* [PATCH 2/2] net: xgene-v2: remove incorrect ACPI_PTR annotation 2025-02-25 16:33 [PATCH 1/2] net: hisilicon: hns_mdio: remove incorrect ACPI_PTR annotation Arnd Bergmann @ 2025-02-25 16:33 ` Arnd Bergmann 2025-02-26 3:21 ` [PATCH 1/2] net: hisilicon: hns_mdio: " Jijie Shao 2025-02-27 12:50 ` patchwork-bot+netdevbpf 2 siblings, 0 replies; 8+ messages in thread From: Arnd Bergmann @ 2025-02-25 16:33 UTC (permalink / raw) To: Iyappan Subramanian, Keyur Chudgar, Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni Cc: Arnd Bergmann, Uwe Kleine-König, netdev, linux-kernel From: Arnd Bergmann <arnd@arndb.de> Building with W=1 shows a warning about xge_acpi_match being unused when CONFIG_ACPI is disabled: drivers/net/ethernet/apm/xgene-v2/main.c:723:36: error: unused variable 'xge_acpi_match' [-Werror,-Wunused-const-variable] Signed-off-by: Arnd Bergmann <arnd@arndb.de> --- drivers/net/ethernet/apm/xgene-v2/main.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/net/ethernet/apm/xgene-v2/main.c b/drivers/net/ethernet/apm/xgene-v2/main.c index 2a91c84aebdb..d7ca847d44c7 100644 --- a/drivers/net/ethernet/apm/xgene-v2/main.c +++ b/drivers/net/ethernet/apm/xgene-v2/main.c @@ -9,8 +9,6 @@ #include "main.h" -static const struct acpi_device_id xge_acpi_match[]; - static int xge_get_resources(struct xge_pdata *pdata) { struct platform_device *pdev; @@ -731,7 +729,7 @@ MODULE_DEVICE_TABLE(acpi, xge_acpi_match); static struct platform_driver xge_driver = { .driver = { .name = "xgene-enet-v2", - .acpi_match_table = ACPI_PTR(xge_acpi_match), + .acpi_match_table = xge_acpi_match, }, .probe = xge_probe, .remove = xge_remove, -- 2.39.5 ^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH 1/2] net: hisilicon: hns_mdio: remove incorrect ACPI_PTR annotation 2025-02-25 16:33 [PATCH 1/2] net: hisilicon: hns_mdio: remove incorrect ACPI_PTR annotation Arnd Bergmann 2025-02-25 16:33 ` [PATCH 2/2] net: xgene-v2: " Arnd Bergmann @ 2025-02-26 3:21 ` Jijie Shao 2025-02-26 6:49 ` Arnd Bergmann 2025-02-27 12:50 ` patchwork-bot+netdevbpf 2 siblings, 1 reply; 8+ messages in thread From: Jijie Shao @ 2025-02-26 3:21 UTC (permalink / raw) To: Arnd Bergmann, Jian Shen, Salil Mehta, Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni Cc: shaojijie, Arnd Bergmann, Simon Horman, Uwe Kleine-König, Krzysztof Kozlowski, netdev, linux-kernel on 2025/2/26 0:33, Arnd Bergmann wrote: > From: Arnd Bergmann <arnd@arndb.de> > > Building with W=1 shows a warning about hns_mdio_acpi_match being unused when > CONFIG_ACPI is disabled: > > drivers/net/ethernet/hisilicon/hns_mdio.c:631:36: error: unused variable 'hns_mdio_acpi_match' [-Werror,-Wunused-const-variable] > > Signed-off-by: Arnd Bergmann <arnd@arndb.de> > --- > drivers/net/ethernet/hisilicon/hns_mdio.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/net/ethernet/hisilicon/hns_mdio.c b/drivers/net/ethernet/hisilicon/hns_mdio.c > index a1aa6c1f966e..6812be8dc64f 100644 > --- a/drivers/net/ethernet/hisilicon/hns_mdio.c > +++ b/drivers/net/ethernet/hisilicon/hns_mdio.c > @@ -640,7 +640,7 @@ static struct platform_driver hns_mdio_driver = { > .driver = { > .name = MDIO_DRV_NAME, > .of_match_table = hns_mdio_match, > - .acpi_match_table = ACPI_PTR(hns_mdio_acpi_match), > + .acpi_match_table = hns_mdio_acpi_match, > }, > }; > Thank you. But I think it can be changed to: + #ifdef CONFIG_ACPI static const struct acpi_device_id hns_mdio_acpi_match[] = { { "HISI0141", 0 }, { }, }; MODULE_DEVICE_TABLE(acpi, hns_mdio_acpi_match); + #endif static struct platform_driver hns_mdio_driver = { .probe = hns_mdio_probe, .remove = hns_mdio_remove, .driver = { .name = MDIO_DRV_NAME, .of_match_table = hns_mdio_match, .acpi_match_table = ACPI_PTR(hns_mdio_acpi_match), }, }; Thansk, Jijie Shao ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 1/2] net: hisilicon: hns_mdio: remove incorrect ACPI_PTR annotation 2025-02-26 3:21 ` [PATCH 1/2] net: hisilicon: hns_mdio: " Jijie Shao @ 2025-02-26 6:49 ` Arnd Bergmann 2025-02-27 11:53 ` Jijie Shao 0 siblings, 1 reply; 8+ messages in thread From: Arnd Bergmann @ 2025-02-26 6:49 UTC (permalink / raw) To: Jijie Shao, Arnd Bergmann, Jian Shen, Salil Mehta, Andrew Lunn, David S . Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni Cc: Simon Horman, Uwe Kleine-König, Krzysztof Kozlowski, Netdev, linux-kernel On Wed, Feb 26, 2025, at 04:21, Jijie Shao wrote: > on 2025/2/26 0:33, Arnd Bergmann wrote: >> From: Arnd Bergmann <arnd@arndb.de> >> >> Building with W=1 shows a warning about hns_mdio_acpi_match being unused when >> CONFIG_ACPI is disabled: >> >> drivers/net/ethernet/hisilicon/hns_mdio.c:631:36: error: unused variable 'hns_mdio_acpi_match' [-Werror,-Wunused-const-variable] >> >> Signed-off-by: Arnd Bergmann <arnd@arndb.de> >> --- >> drivers/net/ethernet/hisilicon/hns_mdio.c | 2 +- >> 1 file changed, 1 insertion(+), 1 deletion(-) >> >> diff --git a/drivers/net/ethernet/hisilicon/hns_mdio.c b/drivers/net/ethernet/hisilicon/hns_mdio.c >> index a1aa6c1f966e..6812be8dc64f 100644 >> --- a/drivers/net/ethernet/hisilicon/hns_mdio.c >> +++ b/drivers/net/ethernet/hisilicon/hns_mdio.c >> @@ -640,7 +640,7 @@ static struct platform_driver hns_mdio_driver = { >> .driver = { >> .name = MDIO_DRV_NAME, >> .of_match_table = hns_mdio_match, >> - .acpi_match_table = ACPI_PTR(hns_mdio_acpi_match), >> + .acpi_match_table = hns_mdio_acpi_match, >> }, >> }; > > > But I think it can be changed to: > > + #ifdef CONFIG_ACPI > static const struct acpi_device_id hns_mdio_acpi_match[] = { > { "HISI0141", 0 }, > { }, > }; > MODULE_DEVICE_TABLE(acpi, hns_mdio_acpi_match); > + #endif > That would of course avoid the build warning, but otherwise would be worse: the only reason ACPI_PTR()/of_match_ptr() exist is to work around drivers that have to put their device ID table inside of an #ifdef for some other reason. Adding the #ifdef to work around an incorrect ACPI_PTR() makes no sense. Arnd ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 1/2] net: hisilicon: hns_mdio: remove incorrect ACPI_PTR annotation 2025-02-26 6:49 ` Arnd Bergmann @ 2025-02-27 11:53 ` Jijie Shao 2025-02-27 12:03 ` Arnd Bergmann 0 siblings, 1 reply; 8+ messages in thread From: Jijie Shao @ 2025-02-27 11:53 UTC (permalink / raw) To: Arnd Bergmann, Arnd Bergmann, Jian Shen, Salil Mehta, Andrew Lunn, David S . Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni Cc: shaojijie, Simon Horman, Uwe Kleine-König, Krzysztof Kozlowski, Netdev, linux-kernel on 2025/2/26 14:49, Arnd Bergmann wrote: > On Wed, Feb 26, 2025, at 04:21, Jijie Shao wrote: >> on 2025/2/26 0:33, Arnd Bergmann wrote: >>> From: Arnd Bergmann <arnd@arndb.de> >>> >>> Building with W=1 shows a warning about hns_mdio_acpi_match being unused when >>> CONFIG_ACPI is disabled: >>> >>> drivers/net/ethernet/hisilicon/hns_mdio.c:631:36: error: unused variable 'hns_mdio_acpi_match' [-Werror,-Wunused-const-variable] >>> >>> Signed-off-by: Arnd Bergmann <arnd@arndb.de> >>> --- >>> drivers/net/ethernet/hisilicon/hns_mdio.c | 2 +- >>> 1 file changed, 1 insertion(+), 1 deletion(-) >>> >>> diff --git a/drivers/net/ethernet/hisilicon/hns_mdio.c b/drivers/net/ethernet/hisilicon/hns_mdio.c >>> index a1aa6c1f966e..6812be8dc64f 100644 >>> --- a/drivers/net/ethernet/hisilicon/hns_mdio.c >>> +++ b/drivers/net/ethernet/hisilicon/hns_mdio.c >>> @@ -640,7 +640,7 @@ static struct platform_driver hns_mdio_driver = { >>> .driver = { >>> .name = MDIO_DRV_NAME, >>> .of_match_table = hns_mdio_match, >>> - .acpi_match_table = ACPI_PTR(hns_mdio_acpi_match), >>> + .acpi_match_table = hns_mdio_acpi_match, >>> }, >>> }; >> >> But I think it can be changed to: >> >> + #ifdef CONFIG_ACPI >> static const struct acpi_device_id hns_mdio_acpi_match[] = { >> { "HISI0141", 0 }, >> { }, >> }; >> MODULE_DEVICE_TABLE(acpi, hns_mdio_acpi_match); >> + #endif >> > That would of course avoid the build warning, but otherwise > would be worse: the only reason ACPI_PTR()/of_match_ptr() exist > is to work around drivers that have to put their device ID > table inside of an #ifdef for some other reason. Adding the > #ifdef to work around an incorrect ACPI_PTR() makes no sense. > > Arnd if CONFIG_ACPI is disabled, ACPI_PTR() will return NULL, so hns_mdio_acpi_match is unused variable. So use #ifdef is possible and has no side effects, and many drivers do so. Of course, it also seems possible to remove ACPI_PTR(), But I'm not sure if it's okay to set a value to acpi_match_table if CONFIG_ACPI is disabled. It need maintainer to look at this. Thanks, Jijie Shao ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 1/2] net: hisilicon: hns_mdio: remove incorrect ACPI_PTR annotation 2025-02-27 11:53 ` Jijie Shao @ 2025-02-27 12:03 ` Arnd Bergmann 2025-02-27 12:41 ` Paolo Abeni 0 siblings, 1 reply; 8+ messages in thread From: Arnd Bergmann @ 2025-02-27 12:03 UTC (permalink / raw) To: Jijie Shao, Arnd Bergmann, Jian Shen, Salil Mehta, Andrew Lunn, David S . Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni Cc: Simon Horman, Uwe Kleine-König, Krzysztof Kozlowski, Netdev, linux-kernel On Thu, Feb 27, 2025, at 12:53, Jijie Shao wrote: > > if CONFIG_ACPI is disabled, ACPI_PTR() will return NULL, so > hns_mdio_acpi_match is unused variable. > > > So use #ifdef is possible and has no side effects, and many drivers do so. Those should be cleaned up eventually, but that is separate from the build warning. > Of course, it also seems possible to remove ACPI_PTR(), > But I'm not sure if it's okay to set a value to acpi_match_table if > CONFIG_ACPI is disabled. Setting .acpi_match_table and .of_match_table unconditionally is the normal case. Historically we had some drivers that used of_match_ptr() to assign the .of_match_table in order to allow drivers to #ifdef out the CONFIG_OF portion of the driver for platforms that did not already use devicetree based probing. There are basically no platforms left that have not been converted to devicetree yet, so there is no point in micro-optimizing the kernel size for that case, but the (mis)use of of_match_ptr() has been copied into drivers after that, and most of the ACPI_PTR() users unfortunately copied from that when drivers started supporting both. Arnd ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 1/2] net: hisilicon: hns_mdio: remove incorrect ACPI_PTR annotation 2025-02-27 12:03 ` Arnd Bergmann @ 2025-02-27 12:41 ` Paolo Abeni 0 siblings, 0 replies; 8+ messages in thread From: Paolo Abeni @ 2025-02-27 12:41 UTC (permalink / raw) To: Arnd Bergmann, Jijie Shao, Arnd Bergmann, Jian Shen, Salil Mehta, Andrew Lunn, David S . Miller, Eric Dumazet, Jakub Kicinski Cc: Simon Horman, Uwe Kleine-König, Krzysztof Kozlowski, Netdev, linux-kernel On 2/27/25 1:03 PM, Arnd Bergmann wrote: > On Thu, Feb 27, 2025, at 12:53, Jijie Shao wrote: >> >> if CONFIG_ACPI is disabled, ACPI_PTR() will return NULL, so >> hns_mdio_acpi_match is unused variable. >> >> >> So use #ifdef is possible and has no side effects, and many drivers do so. > > Those should be cleaned up eventually, but that is separate from > the build warning. > >> Of course, it also seems possible to remove ACPI_PTR(), >> But I'm not sure if it's okay to set a value to acpi_match_table if >> CONFIG_ACPI is disabled. > > Setting .acpi_match_table and .of_match_table unconditionally > is the normal case. Historically we had some drivers that > used of_match_ptr() to assign the .of_match_table in order > to allow drivers to #ifdef out the CONFIG_OF portion of the > driver for platforms that did not already use devicetree > based probing. > > There are basically no platforms left that have not been > converted to devicetree yet, so there is no point in > micro-optimizing the kernel size for that case, but the > (mis)use of of_match_ptr() has been copied into drivers > after that, and most of the ACPI_PTR() users unfortunately > copied from that when drivers started supporting both. Makes sense, thanks! Paolo ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 1/2] net: hisilicon: hns_mdio: remove incorrect ACPI_PTR annotation 2025-02-25 16:33 [PATCH 1/2] net: hisilicon: hns_mdio: remove incorrect ACPI_PTR annotation Arnd Bergmann 2025-02-25 16:33 ` [PATCH 2/2] net: xgene-v2: " Arnd Bergmann 2025-02-26 3:21 ` [PATCH 1/2] net: hisilicon: hns_mdio: " Jijie Shao @ 2025-02-27 12:50 ` patchwork-bot+netdevbpf 2 siblings, 0 replies; 8+ messages in thread From: patchwork-bot+netdevbpf @ 2025-02-27 12:50 UTC (permalink / raw) To: Arnd Bergmann Cc: shenjian15, salil.mehta, andrew+netdev, davem, edumazet, kuba, pabeni, arnd, horms, u.kleine-koenig, krzysztof.kozlowski, netdev, linux-kernel Hello: This series was applied to netdev/net-next.git (main) by Paolo Abeni <pabeni@redhat.com>: On Tue, 25 Feb 2025 17:33:32 +0100 you wrote: > From: Arnd Bergmann <arnd@arndb.de> > > Building with W=1 shows a warning about hns_mdio_acpi_match being unused when > CONFIG_ACPI is disabled: > > drivers/net/ethernet/hisilicon/hns_mdio.c:631:36: error: unused variable 'hns_mdio_acpi_match' [-Werror,-Wunused-const-variable] > > [...] Here is the summary with links: - [1/2] net: hisilicon: hns_mdio: remove incorrect ACPI_PTR annotation https://git.kernel.org/netdev/net-next/c/9355f7277d69 - [2/2] net: xgene-v2: remove incorrect ACPI_PTR annotation https://git.kernel.org/netdev/net-next/c/01358e8fe922 You are awesome, thank you! -- Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html ^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2025-02-27 12:49 UTC | newest] Thread overview: 8+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2025-02-25 16:33 [PATCH 1/2] net: hisilicon: hns_mdio: remove incorrect ACPI_PTR annotation Arnd Bergmann 2025-02-25 16:33 ` [PATCH 2/2] net: xgene-v2: " Arnd Bergmann 2025-02-26 3:21 ` [PATCH 1/2] net: hisilicon: hns_mdio: " Jijie Shao 2025-02-26 6:49 ` Arnd Bergmann 2025-02-27 11:53 ` Jijie Shao 2025-02-27 12:03 ` Arnd Bergmann 2025-02-27 12:41 ` Paolo Abeni 2025-02-27 12:50 ` patchwork-bot+netdevbpf
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.