linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] rtw88: avoid unused function warnings
@ 2020-04-08 18:53 Arnd Bergmann
  2020-04-09  4:29 ` Kalle Valo
  2020-04-14 12:49 ` Kalle Valo
  0 siblings, 2 replies; 3+ messages in thread
From: Arnd Bergmann @ 2020-04-08 18:53 UTC (permalink / raw)
  To: Yan-Hsuan Chuang, Kalle Valo, Chin-Yen Lee
  Cc: Arnd Bergmann, David S. Miller, Brian Norris, Chris Chiu,
	Jian-Hong Pan, linux-wireless, netdev, linux-kernel

The rtw88 driver defines emtpy functions with multiple indirections
but gets one of these wrong:

drivers/net/wireless/realtek/rtw88/pci.c:1347:12: error: 'rtw_pci_resume' defined but not used [-Werror=unused-function]
 1347 | static int rtw_pci_resume(struct device *dev)
      |            ^~~~~~~~~~~~~~
drivers/net/wireless/realtek/rtw88/pci.c:1342:12: error: 'rtw_pci_suspend' defined but not used [-Werror=unused-function]
 1342 | static int rtw_pci_suspend(struct device *dev)

Better simplify it to rely on the conditional reference in
SIMPLE_DEV_PM_OPS(), and mark the functions as __maybe_unused to avoid
warning about it.

I'm not sure if these are needed at all given that the functions
don't do anything, but they were only recently added.

Fixes: 44bc17f7f5b3 ("rtw88: support wowlan feature for 8822c")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/net/wireless/realtek/rtw88/pci.c | 11 +++--------
 1 file changed, 3 insertions(+), 8 deletions(-)

diff --git a/drivers/net/wireless/realtek/rtw88/pci.c b/drivers/net/wireless/realtek/rtw88/pci.c
index e37c71495c0d..1af87eb2e53a 100644
--- a/drivers/net/wireless/realtek/rtw88/pci.c
+++ b/drivers/net/wireless/realtek/rtw88/pci.c
@@ -1338,22 +1338,17 @@ static void rtw_pci_phy_cfg(struct rtw_dev *rtwdev)
 	rtw_pci_link_cfg(rtwdev);
 }
 
-#ifdef CONFIG_PM
-static int rtw_pci_suspend(struct device *dev)
+static int __maybe_unused rtw_pci_suspend(struct device *dev)
 {
 	return 0;
 }
 
-static int rtw_pci_resume(struct device *dev)
+static int __maybe_unused rtw_pci_resume(struct device *dev)
 {
 	return 0;
 }
 
 static SIMPLE_DEV_PM_OPS(rtw_pm_ops, rtw_pci_suspend, rtw_pci_resume);
-#define RTW_PM_OPS (&rtw_pm_ops)
-#else
-#define RTW_PM_OPS NULL
-#endif
 
 static int rtw_pci_claim(struct rtw_dev *rtwdev, struct pci_dev *pdev)
 {
@@ -1582,7 +1577,7 @@ static struct pci_driver rtw_pci_driver = {
 	.id_table = rtw_pci_id_table,
 	.probe = rtw_pci_probe,
 	.remove = rtw_pci_remove,
-	.driver.pm = RTW_PM_OPS,
+	.driver.pm = &rtw_pm_ops,
 };
 module_pci_driver(rtw_pci_driver);
 
-- 
2.26.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] rtw88: avoid unused function warnings
  2020-04-08 18:53 [PATCH] rtw88: avoid unused function warnings Arnd Bergmann
@ 2020-04-09  4:29 ` Kalle Valo
  2020-04-14 12:49 ` Kalle Valo
  1 sibling, 0 replies; 3+ messages in thread
From: Kalle Valo @ 2020-04-09  4:29 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Yan-Hsuan Chuang, Chin-Yen Lee, David S. Miller, Brian Norris,
	Chris Chiu, Jian-Hong Pan, linux-wireless, netdev, linux-kernel

Arnd Bergmann <arnd@arndb.de> writes:

> The rtw88 driver defines emtpy functions with multiple indirections
> but gets one of these wrong:
>
> drivers/net/wireless/realtek/rtw88/pci.c:1347:12: error: 'rtw_pci_resume' defined but not used [-Werror=unused-function]
>  1347 | static int rtw_pci_resume(struct device *dev)
>       |            ^~~~~~~~~~~~~~
> drivers/net/wireless/realtek/rtw88/pci.c:1342:12: error: 'rtw_pci_suspend' defined but not used [-Werror=unused-function]
>  1342 | static int rtw_pci_suspend(struct device *dev)
>
> Better simplify it to rely on the conditional reference in
> SIMPLE_DEV_PM_OPS(), and mark the functions as __maybe_unused to avoid
> warning about it.
>
> I'm not sure if these are needed at all given that the functions
> don't do anything, but they were only recently added.
>
> Fixes: 44bc17f7f5b3 ("rtw88: support wowlan feature for 8822c")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>

I'll queue this to v5.7.

-- 
https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] rtw88: avoid unused function warnings
  2020-04-08 18:53 [PATCH] rtw88: avoid unused function warnings Arnd Bergmann
  2020-04-09  4:29 ` Kalle Valo
@ 2020-04-14 12:49 ` Kalle Valo
  1 sibling, 0 replies; 3+ messages in thread
From: Kalle Valo @ 2020-04-14 12:49 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Yan-Hsuan Chuang, Chin-Yen Lee, Arnd Bergmann, David S. Miller,
	Brian Norris, Chris Chiu, Jian-Hong Pan, linux-wireless, netdev,
	linux-kernel

Arnd Bergmann <arnd@arndb.de> wrote:

> The rtw88 driver defines emtpy functions with multiple indirections
> but gets one of these wrong:
> 
> drivers/net/wireless/realtek/rtw88/pci.c:1347:12: error: 'rtw_pci_resume' defined but not used [-Werror=unused-function]
>  1347 | static int rtw_pci_resume(struct device *dev)
>       |            ^~~~~~~~~~~~~~
> drivers/net/wireless/realtek/rtw88/pci.c:1342:12: error: 'rtw_pci_suspend' defined but not used [-Werror=unused-function]
>  1342 | static int rtw_pci_suspend(struct device *dev)
> 
> Better simplify it to rely on the conditional reference in
> SIMPLE_DEV_PM_OPS(), and mark the functions as __maybe_unused to avoid
> warning about it.
> 
> I'm not sure if these are needed at all given that the functions
> don't do anything, but they were only recently added.
> 
> Fixes: 44bc17f7f5b3 ("rtw88: support wowlan feature for 8822c")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>

Patch applied to wireless-drivers.git, thanks.

7dc7c41607d1 rtw88: avoid unused function warnings

-- 
https://patchwork.kernel.org/patch/11480657/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-04-14 12:49 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-08 18:53 [PATCH] rtw88: avoid unused function warnings Arnd Bergmann
2020-04-09  4:29 ` Kalle Valo
2020-04-14 12:49 ` Kalle Valo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).