aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/net/cfg80211.h6
-rw-r--r--net/wireless/sysfs.c30
2 files changed, 36 insertions, 0 deletions
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index c7da88fb15b7..f19c3e163663 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -472,6 +472,9 @@ struct ieee80211_channel;
472 * wireless extensions but this is subject to reevaluation as soon as this 472 * wireless extensions but this is subject to reevaluation as soon as this
473 * code is used more widely and we have a first user without wext. 473 * code is used more widely and we have a first user without wext.
474 * 474 *
475 * @suspend: wiphy device needs to be suspended
476 * @resume: wiphy device needs to be resumed
477 *
475 * @add_virtual_intf: create a new virtual interface with the given name, 478 * @add_virtual_intf: create a new virtual interface with the given name,
476 * must set the struct wireless_dev's iftype. 479 * must set the struct wireless_dev's iftype.
477 * 480 *
@@ -525,6 +528,9 @@ struct ieee80211_channel;
525 * @set_mgmt_extra_ie: Set extra IE data for management frames 528 * @set_mgmt_extra_ie: Set extra IE data for management frames
526 */ 529 */
527struct cfg80211_ops { 530struct cfg80211_ops {
531 int (*suspend)(struct wiphy *wiphy);
532 int (*resume)(struct wiphy *wiphy);
533
528 int (*add_virtual_intf)(struct wiphy *wiphy, char *name, 534 int (*add_virtual_intf)(struct wiphy *wiphy, char *name,
529 enum nl80211_iftype type, u32 *flags, 535 enum nl80211_iftype type, u32 *flags,
530 struct vif_params *params); 536 struct vif_params *params);
diff --git a/net/wireless/sysfs.c b/net/wireless/sysfs.c
index 79a382877641..26a72b0797a0 100644
--- a/net/wireless/sysfs.c
+++ b/net/wireless/sysfs.c
@@ -55,6 +55,34 @@ static int wiphy_uevent(struct device *dev, struct kobj_uevent_env *env)
55} 55}
56#endif 56#endif
57 57
58static int wiphy_suspend(struct device *dev, pm_message_t state)
59{
60 struct cfg80211_registered_device *rdev = dev_to_rdev(dev);
61 int ret = 0;
62
63 if (rdev->ops->suspend) {
64 rtnl_lock();
65 ret = rdev->ops->suspend(&rdev->wiphy);
66 rtnl_unlock();
67 }
68
69 return ret;
70}
71
72static int wiphy_resume(struct device *dev)
73{
74 struct cfg80211_registered_device *rdev = dev_to_rdev(dev);
75 int ret = 0;
76
77 if (rdev->ops->resume) {
78 rtnl_lock();
79 ret = rdev->ops->resume(&rdev->wiphy);
80 rtnl_unlock();
81 }
82
83 return ret;
84}
85
58struct class ieee80211_class = { 86struct class ieee80211_class = {
59 .name = "ieee80211", 87 .name = "ieee80211",
60 .owner = THIS_MODULE, 88 .owner = THIS_MODULE,
@@ -63,6 +91,8 @@ struct class ieee80211_class = {
63#ifdef CONFIG_HOTPLUG 91#ifdef CONFIG_HOTPLUG
64 .dev_uevent = wiphy_uevent, 92 .dev_uevent = wiphy_uevent,
65#endif 93#endif
94 .suspend = wiphy_suspend,
95 .resume = wiphy_resume,
66}; 96};
67 97
68int wiphy_sysfs_init(void) 98int wiphy_sysfs_init(void)