Skip to content

Commit

Permalink
rtw88: avoid unused function warnings
Browse files Browse the repository at this point in the history
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: 44bc17f ("rtw88: support wowlan feature for 8822c")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/20200408185413.218643-1-arnd@arndb.de
  • Loading branch information
Arnd Bergmann authored and Kalle Valo committed Apr 14, 2020
1 parent c9be1a6 commit 7dc7c41
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions drivers/net/wireless/realtek/rtw88/pci.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down Expand Up @@ -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);

Expand Down

0 comments on commit 7dc7c41

Please sign in to comment.