diff options
author | Shuah Khan <shuah.kh@samsung.com> | 2013-07-26 17:07:26 -0400 |
---|---|---|
committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2013-07-26 21:21:03 -0400 |
commit | eaf140b60ec961252083ab8adaf67aef29a362dd (patch) | |
tree | 5fca9d78081c2d47a7b45a5ee477e9c1b47de048 /drivers | |
parent | 3b2f64d00c46e1e4e9bd0bb9bb12619adac27a4b (diff) |
PNP: convert PNP driver bus legacy pm_ops to dev_pm_ops
Convert drivers/pnp/driver.c bus legacy pm_ops to dev_pm_ops using
existing suspend and resume routines. Add freeze interface to
handle PM_EVENT_FREEZE correctly with dev_pm_ops. pm_op() looks for
freeze interface when the event is PM_EVENT_FREEZE.
Signed-off-by: Shuah Khan <shuah.kh@samsung.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/pnp/driver.c | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/drivers/pnp/driver.c b/drivers/pnp/driver.c index 00e94032531a..12adb43a0693 100644 --- a/drivers/pnp/driver.c +++ b/drivers/pnp/driver.c | |||
@@ -154,7 +154,7 @@ static int pnp_bus_match(struct device *dev, struct device_driver *drv) | |||
154 | return 1; | 154 | return 1; |
155 | } | 155 | } |
156 | 156 | ||
157 | static int pnp_bus_suspend(struct device *dev, pm_message_t state) | 157 | static int __pnp_bus_suspend(struct device *dev, pm_message_t state) |
158 | { | 158 | { |
159 | struct pnp_dev *pnp_dev = to_pnp_dev(dev); | 159 | struct pnp_dev *pnp_dev = to_pnp_dev(dev); |
160 | struct pnp_driver *pnp_drv = pnp_dev->driver; | 160 | struct pnp_driver *pnp_drv = pnp_dev->driver; |
@@ -180,6 +180,16 @@ static int pnp_bus_suspend(struct device *dev, pm_message_t state) | |||
180 | return 0; | 180 | return 0; |
181 | } | 181 | } |
182 | 182 | ||
183 | static int pnp_bus_suspend(struct device *dev) | ||
184 | { | ||
185 | return __pnp_bus_suspend(dev, PMSG_SUSPEND); | ||
186 | } | ||
187 | |||
188 | static int pnp_bus_freeze(struct device *dev) | ||
189 | { | ||
190 | return __pnp_bus_suspend(dev, PMSG_FREEZE); | ||
191 | } | ||
192 | |||
183 | static int pnp_bus_resume(struct device *dev) | 193 | static int pnp_bus_resume(struct device *dev) |
184 | { | 194 | { |
185 | struct pnp_dev *pnp_dev = to_pnp_dev(dev); | 195 | struct pnp_dev *pnp_dev = to_pnp_dev(dev); |
@@ -210,14 +220,19 @@ static int pnp_bus_resume(struct device *dev) | |||
210 | return 0; | 220 | return 0; |
211 | } | 221 | } |
212 | 222 | ||
223 | static const struct dev_pm_ops pnp_bus_dev_pm_ops = { | ||
224 | .suspend = pnp_bus_suspend, | ||
225 | .freeze = pnp_bus_freeze, | ||
226 | .resume = pnp_bus_resume, | ||
227 | }; | ||
228 | |||
213 | struct bus_type pnp_bus_type = { | 229 | struct bus_type pnp_bus_type = { |
214 | .name = "pnp", | 230 | .name = "pnp", |
215 | .match = pnp_bus_match, | 231 | .match = pnp_bus_match, |
216 | .probe = pnp_device_probe, | 232 | .probe = pnp_device_probe, |
217 | .remove = pnp_device_remove, | 233 | .remove = pnp_device_remove, |
218 | .shutdown = pnp_device_shutdown, | 234 | .shutdown = pnp_device_shutdown, |
219 | .suspend = pnp_bus_suspend, | 235 | .pm = &pnp_bus_dev_pm_ops, |
220 | .resume = pnp_bus_resume, | ||
221 | .dev_attrs = pnp_interface_attrs, | 236 | .dev_attrs = pnp_interface_attrs, |
222 | }; | 237 | }; |
223 | 238 | ||