diff options
author | Johannes Berg <johannes@sipsolutions.net> | 2009-01-19 11:20:52 -0500 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2009-01-29 16:00:51 -0500 |
commit | 0378b3f1c49d48ed524eabda7e4340163d9483c9 (patch) | |
tree | 98ba4934248151f1e28abe67a4318d05ffeb83bf /net/wireless/sysfs.c | |
parent | e0463f501fb945c1fde536d98eefc5ba156ff497 (diff) |
cfg80211: add PM hooks
This should help implement suspend/resume in mac80211, these
hooks will be run before the device is suspended and after it
resumes. Therefore, they can touch the hardware as much as
they want to.
Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: Bob Copeland <me@bobcopeland.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'net/wireless/sysfs.c')
-rw-r--r-- | net/wireless/sysfs.c | 30 |
1 files changed, 30 insertions, 0 deletions
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 | ||
58 | static 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 | |||
72 | static 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 | |||
58 | struct class ieee80211_class = { | 86 | struct 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 | ||
68 | int wiphy_sysfs_init(void) | 98 | int wiphy_sysfs_init(void) |