diff options
author | Arnd Bergmann <arnd@arndb.de> | 2016-03-02 10:59:02 -0500 |
---|---|---|
committer | Kalle Valo <kvalo@codeaurora.org> | 2016-03-08 05:32:52 -0500 |
commit | 836856e3bd61d0644e5178a2c1b51d90459e2788 (patch) | |
tree | f76ac0e50e3dd42b35b758706a1abb8f6728442f | |
parent | 73fb270592164b1917442f8bff4c791d095ee2ef (diff) |
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 <arnd@arndb.de>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
-rw-r--r-- | drivers/net/wireless/st/cw1200/cw1200_spi.c | 9 | ||||
-rw-r--r-- | drivers/net/wireless/st/cw1200/pm.h | 9 |
2 files changed, 9 insertions, 9 deletions
diff --git a/drivers/net/wireless/st/cw1200/cw1200_spi.c b/drivers/net/wireless/st/cw1200/cw1200_spi.c index a740083634d8..63f95e9c2992 100644 --- a/drivers/net/wireless/st/cw1200/cw1200_spi.c +++ b/drivers/net/wireless/st/cw1200/cw1200_spi.c | |||
@@ -446,8 +446,7 @@ static int cw1200_spi_disconnect(struct spi_device *func) | |||
446 | return 0; | 446 | return 0; |
447 | } | 447 | } |
448 | 448 | ||
449 | #ifdef CONFIG_PM | 449 | static int __maybe_unused cw1200_spi_suspend(struct device *dev) |
450 | static int cw1200_spi_suspend(struct device *dev) | ||
451 | { | 450 | { |
452 | struct hwbus_priv *self = spi_get_drvdata(to_spi_device(dev)); | 451 | struct hwbus_priv *self = spi_get_drvdata(to_spi_device(dev)); |
453 | 452 | ||
@@ -460,16 +459,12 @@ static int cw1200_spi_suspend(struct device *dev) | |||
460 | 459 | ||
461 | static SIMPLE_DEV_PM_OPS(cw1200_pm_ops, cw1200_spi_suspend, NULL); | 460 | static SIMPLE_DEV_PM_OPS(cw1200_pm_ops, cw1200_spi_suspend, NULL); |
462 | 461 | ||
463 | #endif | ||
464 | |||
465 | static struct spi_driver spi_driver = { | 462 | static struct spi_driver spi_driver = { |
466 | .probe = cw1200_spi_probe, | 463 | .probe = cw1200_spi_probe, |
467 | .remove = cw1200_spi_disconnect, | 464 | .remove = cw1200_spi_disconnect, |
468 | .driver = { | 465 | .driver = { |
469 | .name = "cw1200_wlan_spi", | 466 | .name = "cw1200_wlan_spi", |
470 | #ifdef CONFIG_PM | 467 | .pm = IS_ENABLED(CONFIG_PM) ? &cw1200_pm_ops : NULL, |
471 | .pm = &cw1200_pm_ops, | ||
472 | #endif | ||
473 | }, | 468 | }, |
474 | }; | 469 | }; |
475 | 470 | ||
diff --git a/drivers/net/wireless/st/cw1200/pm.h b/drivers/net/wireless/st/cw1200/pm.h index 3ed90ff22bb8..534548470ebc 100644 --- a/drivers/net/wireless/st/cw1200/pm.h +++ b/drivers/net/wireless/st/cw1200/pm.h | |||
@@ -31,13 +31,18 @@ int cw1200_pm_init(struct cw1200_pm_state *pm, | |||
31 | void cw1200_pm_deinit(struct cw1200_pm_state *pm); | 31 | void cw1200_pm_deinit(struct cw1200_pm_state *pm); |
32 | int cw1200_wow_suspend(struct ieee80211_hw *hw, | 32 | int cw1200_wow_suspend(struct ieee80211_hw *hw, |
33 | struct cfg80211_wowlan *wowlan); | 33 | struct cfg80211_wowlan *wowlan); |
34 | int cw1200_wow_resume(struct ieee80211_hw *hw); | ||
35 | int cw1200_can_suspend(struct cw1200_common *priv); | 34 | int cw1200_can_suspend(struct cw1200_common *priv); |
35 | int cw1200_wow_resume(struct ieee80211_hw *hw); | ||
36 | void cw1200_pm_stay_awake(struct cw1200_pm_state *pm, | 36 | void cw1200_pm_stay_awake(struct cw1200_pm_state *pm, |
37 | unsigned long tmo); | 37 | unsigned long tmo); |
38 | #else | 38 | #else |
39 | static inline void cw1200_pm_stay_awake(struct cw1200_pm_state *pm, | 39 | 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; | ||
41 | } | 46 | } |
42 | #endif | 47 | #endif |
43 | #endif | 48 | #endif |