aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/scsi_sysfs.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/scsi/scsi_sysfs.c')
-rw-r--r--drivers/scsi/scsi_sysfs.c25
1 files changed, 3 insertions, 22 deletions
diff --git a/drivers/scsi/scsi_sysfs.c b/drivers/scsi/scsi_sysfs.c
index 67a38a1409ba..ed720863ab97 100644
--- a/drivers/scsi/scsi_sysfs.c
+++ b/drivers/scsi/scsi_sysfs.c
@@ -293,30 +293,18 @@ static int scsi_bus_suspend(struct device * dev, pm_message_t state)
293{ 293{
294 struct device_driver *drv = dev->driver; 294 struct device_driver *drv = dev->driver;
295 struct scsi_device *sdev = to_scsi_device(dev); 295 struct scsi_device *sdev = to_scsi_device(dev);
296 struct scsi_host_template *sht = sdev->host->hostt;
297 int err; 296 int err;
298 297
299 err = scsi_device_quiesce(sdev); 298 err = scsi_device_quiesce(sdev);
300 if (err) 299 if (err)
301 return err; 300 return err;
302 301
303 /* call HLD suspend first */
304 if (drv && drv->suspend) { 302 if (drv && drv->suspend) {
305 err = drv->suspend(dev, state); 303 err = drv->suspend(dev, state);
306 if (err) 304 if (err)
307 return err; 305 return err;
308 } 306 }
309 307
310 /* then, call host suspend */
311 if (sht->suspend) {
312 err = sht->suspend(sdev, state);
313 if (err) {
314 if (drv && drv->resume)
315 drv->resume(dev);
316 return err;
317 }
318 }
319
320 return 0; 308 return 0;
321} 309}
322 310
@@ -324,21 +312,14 @@ static int scsi_bus_resume(struct device * dev)
324{ 312{
325 struct device_driver *drv = dev->driver; 313 struct device_driver *drv = dev->driver;
326 struct scsi_device *sdev = to_scsi_device(dev); 314 struct scsi_device *sdev = to_scsi_device(dev);
327 struct scsi_host_template *sht = sdev->host->hostt; 315 int err = 0;
328 int err = 0, err2 = 0;
329
330 /* call host resume first */
331 if (sht->resume)
332 err = sht->resume(sdev);
333 316
334 /* then, call HLD resume */
335 if (drv && drv->resume) 317 if (drv && drv->resume)
336 err2 = drv->resume(dev); 318 err = drv->resume(dev);
337 319
338 scsi_device_resume(sdev); 320 scsi_device_resume(sdev);
339 321
340 /* favor LLD failure */ 322 return err;
341 return err ? err : err2;;
342} 323}
343 324
344struct bus_type scsi_bus_type = { 325struct bus_type scsi_bus_type = {