Skip to content

Commit 836856e

Browse files
arndbKalle Valo
authored andcommitted
wireless: cw1200: use __maybe_unused to hide pm functions_
The cw1200 uses #ifdef to check for CONFIG_PM, but then uses SIMPLE_DEV_PM_OPS, which leaves the references out when CONFIG_PM_SLEEP is not defined, so we get a warning with PM=y && PM_SLEEP=n: drivers/net/wireless/st/cw1200/cw1200_spi.c:450:12: error: 'cw1200_spi_suspend' defined but not used [-Werror=unused-function] This removes the incorrect #ifdef and instead uses a __maybe_unused annotation to let the compiler know it can silently drop the function definition. For the DEV_PM_OPS definition, we can use an IS_ENABLED() check to avoid defining the structure when CONFIG_PM is not set without the #ifdef. Signed-off-by: Arnd Bergmann <[email protected]> Signed-off-by: Kalle Valo <[email protected]>
1 parent 73fb270 commit 836856e

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

drivers/net/wireless/st/cw1200/cw1200_spi.c

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -446,8 +446,7 @@ static int cw1200_spi_disconnect(struct spi_device *func)
446446
return 0;
447447
}
448448

449-
#ifdef CONFIG_PM
450-
static int cw1200_spi_suspend(struct device *dev)
449+
static int __maybe_unused cw1200_spi_suspend(struct device *dev)
451450
{
452451
struct hwbus_priv *self = spi_get_drvdata(to_spi_device(dev));
453452

@@ -460,16 +459,12 @@ static int cw1200_spi_suspend(struct device *dev)
460459

461460
static SIMPLE_DEV_PM_OPS(cw1200_pm_ops, cw1200_spi_suspend, NULL);
462461

463-
#endif
464-
465462
static struct spi_driver spi_driver = {
466463
.probe = cw1200_spi_probe,
467464
.remove = cw1200_spi_disconnect,
468465
.driver = {
469466
.name = "cw1200_wlan_spi",
470-
#ifdef CONFIG_PM
471-
.pm = &cw1200_pm_ops,
472-
#endif
467+
.pm = IS_ENABLED(CONFIG_PM) ? &cw1200_pm_ops : NULL,
473468
},
474469
};
475470

drivers/net/wireless/st/cw1200/pm.h

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,18 @@ int cw1200_pm_init(struct cw1200_pm_state *pm,
3131
void cw1200_pm_deinit(struct cw1200_pm_state *pm);
3232
int cw1200_wow_suspend(struct ieee80211_hw *hw,
3333
struct cfg80211_wowlan *wowlan);
34-
int cw1200_wow_resume(struct ieee80211_hw *hw);
3534
int cw1200_can_suspend(struct cw1200_common *priv);
35+
int cw1200_wow_resume(struct ieee80211_hw *hw);
3636
void cw1200_pm_stay_awake(struct cw1200_pm_state *pm,
3737
unsigned long tmo);
3838
#else
3939
static inline void cw1200_pm_stay_awake(struct cw1200_pm_state *pm,
40-
unsigned long tmo) {
40+
unsigned long tmo)
41+
{
42+
}
43+
static inline int cw1200_can_suspend(struct cw1200_common *priv)
44+
{
45+
return 0;
4146
}
4247
#endif
4348
#endif

0 commit comments

Comments
 (0)