aboutsummaryrefslogtreecommitdiff
path: root/drivers/pnp/driver.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/pnp/driver.c')
-rw-r--r--drivers/pnp/driver.c47
1 files changed, 47 insertions, 0 deletions
diff --git a/drivers/pnp/driver.c b/drivers/pnp/driver.c
index d3ccce706ab..15fb758a9e5 100644
--- a/drivers/pnp/driver.c
+++ b/drivers/pnp/driver.c
@@ -146,10 +146,57 @@ static int pnp_bus_match(struct device *dev, struct device_driver *drv)
return 1;
}
+static int pnp_bus_suspend(struct device *dev, pm_message_t state)
+{
+ struct pnp_dev * pnp_dev = to_pnp_dev(dev);
+ struct pnp_driver * pnp_drv = pnp_dev->driver;
+ int error;
+
+ if (!pnp_drv)
+ return 0;
+
+ if (pnp_drv->suspend) {
+ error = pnp_drv->suspend(pnp_dev, state);
+ if (error)
+ return error;
+ }
+
+ if (!(pnp_drv->flags & PNP_DRIVER_RES_DO_NOT_CHANGE) &&
+ pnp_can_disable(pnp_dev)) {
+ error = pnp_stop_dev(pnp_dev);
+ if (error)
+ return error;
+ }
+
+ return 0;
+}
+
+static int pnp_bus_resume(struct device *dev)
+{
+ struct pnp_dev * pnp_dev = to_pnp_dev(dev);
+ struct pnp_driver * pnp_drv = pnp_dev->driver;
+ int error;
+
+ if (!pnp_drv)
+ return 0;
+
+ if (!(pnp_drv->flags & PNP_DRIVER_RES_DO_NOT_CHANGE)) {
+ error = pnp_start_dev(pnp_dev);
+ if (error)
+ return error;
+ }
+
+ if (pnp_drv->resume)
+ return pnp_drv->resume(pnp_dev);
+
+ return 0;
+}
struct bus_type pnp_bus_type = {
.name = "pnp",
.match = pnp_bus_match,
+ .suspend = pnp_bus_suspend,
+ .resume = pnp_bus_resume,
};