aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pnp/driver.c
diff options
context:
space:
mode:
authorPierre Ossman <drzeus-list@drzeus.cx>2005-11-29 03:09:32 -0500
committerJaroslav Kysela <perex@suse.cz>2006-01-03 06:31:30 -0500
commit68094e3251a664ee1389fcf179497237cbf78331 (patch)
tree1f38ff587622bab4b1063c19447832f6cbff8a6f /drivers/pnp/driver.c
parent4c98cfef2efa6b6662ac28c4f0069964bbd9fdf9 (diff)
[ALSA] [PATCH] alsa: Improved PnP suspend support
Also use the PnP functions to start/stop the devices during the suspend so that drivers will not have to duplicate this code. Cc: Adam Belay <ambx1@neo.rr.com> Cc: Jaroslav Kysela <perex@suse.cz> Cc: Takashi Iwai <tiwai@suse.de> Signed-off-by: Pierre Ossman <drzeus@drzeus.cx> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Takashi Iwai <tiwai@suse.de>
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 = {