aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pnp/driver.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/pnp/driver.c')
-rw-r--r--drivers/pnp/driver.c37
1 files changed, 32 insertions, 5 deletions
diff --git a/drivers/pnp/driver.c b/drivers/pnp/driver.c
index ea2cb9a8b21d..15fb758a9e52 100644
--- a/drivers/pnp/driver.c
+++ b/drivers/pnp/driver.c
@@ -150,19 +150,46 @@ static int pnp_bus_suspend(struct device *dev, pm_message_t state)
150{ 150{
151 struct pnp_dev * pnp_dev = to_pnp_dev(dev); 151 struct pnp_dev * pnp_dev = to_pnp_dev(dev);
152 struct pnp_driver * pnp_drv = pnp_dev->driver; 152 struct pnp_driver * pnp_drv = pnp_dev->driver;
153 int error;
154
155 if (!pnp_drv)
156 return 0;
157
158 if (pnp_drv->suspend) {
159 error = pnp_drv->suspend(pnp_dev, state);
160 if (error)
161 return error;
162 }
163
164 if (!(pnp_drv->flags & PNP_DRIVER_RES_DO_NOT_CHANGE) &&
165 pnp_can_disable(pnp_dev)) {
166 error = pnp_stop_dev(pnp_dev);
167 if (error)
168 return error;
169 }
153 170
154 if (pnp_drv && pnp_drv->suspend)
155 return pnp_drv->suspend(pnp_dev, state);
156 return 0; 171 return 0;
157} 172}
158 173
159static void pnp_bus_resume(struct device *dev) 174static int pnp_bus_resume(struct device *dev)
160{ 175{
161 struct pnp_dev * pnp_dev = to_pnp_dev(dev); 176 struct pnp_dev * pnp_dev = to_pnp_dev(dev);
162 struct pnp_driver * pnp_drv = pnp_dev->driver; 177 struct pnp_driver * pnp_drv = pnp_dev->driver;
178 int error;
179
180 if (!pnp_drv)
181 return 0;
182
183 if (!(pnp_drv->flags & PNP_DRIVER_RES_DO_NOT_CHANGE)) {
184 error = pnp_start_dev(pnp_dev);
185 if (error)
186 return error;
187 }
163 188
164 if (pnp_drv && pnp_drv->resume) 189 if (pnp_drv->resume)
165 pnp_drv->resume(pnp_dev); 190 return pnp_drv->resume(pnp_dev);
191
192 return 0;
166} 193}
167 194
168struct bus_type pnp_bus_type = { 195struct bus_type pnp_bus_type = {