Commit 4e17b87e authored by Solomon Peachy's avatar Solomon Peachy Committed by John W. Linville

cw1200: Fix compile with CONFIG_PM=n

Intel's 0-day kernel build tester caught this build failure.  This patch
properly wraps everything that depends on CONFIG_PM.
Signed-off-by: default avatarSolomon Peachy <pizza@shaftnet.org>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent b0a1ae97
...@@ -8,9 +8,9 @@ cw1200_core-y := \ ...@@ -8,9 +8,9 @@ cw1200_core-y := \
wsm.o \ wsm.o \
sta.o \ sta.o \
scan.o \ scan.o \
pm.o \
debug.o debug.o
cw1200_core-$(CONFIG_CW1200_ITP) += itp.o cw1200_core-$(CONFIG_CW1200_ITP) += itp.o
cw1200_core-$(CONFIG_PM) += pm.o
# CFLAGS_sta.o += -DDEBUG # CFLAGS_sta.o += -DDEBUG
......
...@@ -334,6 +334,7 @@ static void cw1200_sdio_disconnect(struct sdio_func *func) ...@@ -334,6 +334,7 @@ static void cw1200_sdio_disconnect(struct sdio_func *func)
} }
} }
#ifdef CONFIG_PM
static int cw1200_sdio_suspend(struct device *dev) static int cw1200_sdio_suspend(struct device *dev)
{ {
int ret; int ret;
...@@ -360,15 +361,18 @@ static const struct dev_pm_ops cw1200_pm_ops = { ...@@ -360,15 +361,18 @@ static const struct dev_pm_ops cw1200_pm_ops = {
.suspend = cw1200_sdio_suspend, .suspend = cw1200_sdio_suspend,
.resume = cw1200_sdio_resume, .resume = cw1200_sdio_resume,
}; };
#endif
static struct sdio_driver sdio_driver = { static struct sdio_driver sdio_driver = {
.name = "cw1200_wlan_sdio", .name = "cw1200_wlan_sdio",
.id_table = cw1200_sdio_ids, .id_table = cw1200_sdio_ids,
.probe = cw1200_sdio_probe, .probe = cw1200_sdio_probe,
.remove = cw1200_sdio_disconnect, .remove = cw1200_sdio_disconnect,
#ifdef CONFIG_PM
.drv = { .drv = {
.pm = &cw1200_pm_ops, .pm = &cw1200_pm_ops,
} }
#endif
}; };
/* Init Module function -> Called by insmod */ /* Init Module function -> Called by insmod */
......
...@@ -436,6 +436,7 @@ static int cw1200_spi_disconnect(struct spi_device *func) ...@@ -436,6 +436,7 @@ static int cw1200_spi_disconnect(struct spi_device *func)
return 0; return 0;
} }
#ifdef CONFIG_PM
static int cw1200_spi_suspend(struct device *dev, pm_message_t state) static int cw1200_spi_suspend(struct device *dev, pm_message_t state)
{ {
struct sbus_priv *self = spi_get_drvdata(to_spi_device(dev)); struct sbus_priv *self = spi_get_drvdata(to_spi_device(dev));
...@@ -451,6 +452,7 @@ static int cw1200_spi_resume(struct device *dev) ...@@ -451,6 +452,7 @@ static int cw1200_spi_resume(struct device *dev)
{ {
return 0; return 0;
} }
#endif
static struct spi_driver spi_driver = { static struct spi_driver spi_driver = {
.probe = cw1200_spi_probe, .probe = cw1200_spi_probe,
...@@ -459,8 +461,10 @@ static struct spi_driver spi_driver = { ...@@ -459,8 +461,10 @@ static struct spi_driver spi_driver = {
.name = "cw1200_wlan_spi", .name = "cw1200_wlan_spi",
.bus = &spi_bus_type, .bus = &spi_bus_type,
.owner = THIS_MODULE, .owner = THIS_MODULE,
#ifdef CONFIG_PM
.suspend = cw1200_spi_suspend, .suspend = cw1200_spi_suspend,
.resume = cw1200_spi_resume, .resume = cw1200_spi_resume,
#endif
}, },
}; };
......
...@@ -234,8 +234,10 @@ static const struct ieee80211_ops cw1200_ops = { ...@@ -234,8 +234,10 @@ static const struct ieee80211_ops cw1200_ops = {
.get_stats = cw1200_get_stats, .get_stats = cw1200_get_stats,
.ampdu_action = cw1200_ampdu_action, .ampdu_action = cw1200_ampdu_action,
.flush = cw1200_flush, .flush = cw1200_flush,
#ifdef CONFIG_PM
.suspend = cw1200_wow_suspend, .suspend = cw1200_wow_suspend,
.resume = cw1200_wow_resume, .resume = cw1200_wow_resume,
#endif
/* Intentionally not offloaded: */ /* Intentionally not offloaded: */
/*.channel_switch = cw1200_channel_switch, */ /*.channel_switch = cw1200_channel_switch, */
/*.remain_on_channel = cw1200_remain_on_channel, */ /*.remain_on_channel = cw1200_remain_on_channel, */
...@@ -292,10 +294,12 @@ static struct ieee80211_hw *cw1200_init_common(const u8 *macaddr, ...@@ -292,10 +294,12 @@ static struct ieee80211_hw *cw1200_init_common(const u8 *macaddr,
BIT(NL80211_IFTYPE_P2P_CLIENT) | BIT(NL80211_IFTYPE_P2P_CLIENT) |
BIT(NL80211_IFTYPE_P2P_GO); BIT(NL80211_IFTYPE_P2P_GO);
#ifdef CONFIG_PM
/* Support only for limited wowlan functionalities */ /* Support only for limited wowlan functionalities */
hw->wiphy->wowlan.flags = WIPHY_WOWLAN_ANY | hw->wiphy->wowlan.flags = WIPHY_WOWLAN_ANY |
WIPHY_WOWLAN_DISCONNECT; WIPHY_WOWLAN_DISCONNECT;
hw->wiphy->wowlan.n_patterns = 0; hw->wiphy->wowlan.n_patterns = 0;
#endif
hw->wiphy->flags |= WIPHY_FLAG_AP_UAPSD; hw->wiphy->flags |= WIPHY_FLAG_AP_UAPSD;
...@@ -419,18 +423,22 @@ static int cw1200_register_common(struct ieee80211_hw *dev) ...@@ -419,18 +423,22 @@ static int cw1200_register_common(struct ieee80211_hw *dev)
goto done; goto done;
#endif #endif
#ifdef CONFIG_PM
err = cw1200_pm_init(&priv->pm_state, priv); err = cw1200_pm_init(&priv->pm_state, priv);
if (err) { if (err) {
pr_err("Cannot init PM. (%d).\n", pr_err("Cannot init PM. (%d).\n",
err); err);
return err; return err;
} }
#endif
err = ieee80211_register_hw(dev); err = ieee80211_register_hw(dev);
if (err) { if (err) {
pr_err("Cannot register device (%d).\n", pr_err("Cannot register device (%d).\n",
err); err);
#ifdef CONFIG_PM
cw1200_pm_deinit(&priv->pm_state); cw1200_pm_deinit(&priv->pm_state);
#endif
return err; return err;
} }
...@@ -482,7 +490,9 @@ static void cw1200_unregister_common(struct ieee80211_hw *dev) ...@@ -482,7 +490,9 @@ static void cw1200_unregister_common(struct ieee80211_hw *dev)
cw1200_queue_deinit(&priv->tx_queue[i]); cw1200_queue_deinit(&priv->tx_queue[i]);
cw1200_queue_stats_deinit(&priv->tx_queue_stats); cw1200_queue_stats_deinit(&priv->tx_queue_stats);
#ifdef CONFIG_PM
cw1200_pm_deinit(&priv->pm_state); cw1200_pm_deinit(&priv->pm_state);
#endif
} }
/* Clock is in KHz */ /* Clock is in KHz */
......
...@@ -25,14 +25,19 @@ struct cw1200_pm_state { ...@@ -25,14 +25,19 @@ struct cw1200_pm_state {
spinlock_t lock; /* Protect access */ spinlock_t lock; /* Protect access */
}; };
#ifdef CONFIG_PM
int cw1200_pm_init(struct cw1200_pm_state *pm, int cw1200_pm_init(struct cw1200_pm_state *pm,
struct cw1200_common *priv); struct cw1200_common *priv);
void cw1200_pm_deinit(struct cw1200_pm_state *pm); void cw1200_pm_deinit(struct cw1200_pm_state *pm);
void cw1200_pm_stay_awake(struct cw1200_pm_state *pm,
unsigned long tmo);
int cw1200_wow_suspend(struct ieee80211_hw *hw, int cw1200_wow_suspend(struct ieee80211_hw *hw,
struct cfg80211_wowlan *wowlan); struct cfg80211_wowlan *wowlan);
int cw1200_wow_resume(struct ieee80211_hw *hw); int cw1200_wow_resume(struct ieee80211_hw *hw);
int cw1200_can_suspend(struct cw1200_common *priv); int cw1200_can_suspend(struct cw1200_common *priv);
void cw1200_pm_stay_awake(struct cw1200_pm_state *pm,
unsigned long tmo);
#else
static inline void cw1200_pm_stay_awake(struct cw1200_pm_state *pm,
unsigned long tmo) {
}
#endif
#endif #endif
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment