diff options
author | Alan Stern <stern@rowland.harvard.edu> | 2010-06-17 10:36:49 -0400 |
---|---|---|
committer | James Bottomley <James.Bottomley@suse.de> | 2010-07-28 10:07:49 -0400 |
commit | db5bd1e0b505c54ff492172ce4abc245cf6cd639 (patch) | |
tree | b0b4c42c45b52ce9f1f4727a144475071a3f0ac3 /drivers/scsi/scsi_sysfs.c | |
parent | df64d3caab8db6ae17dacd229a03d7689a10c432 (diff) |
[SCSI] convert to the new PM framework
This patch (as1397b) converts the SCSI midlayer to use the new PM
callbacks (struct dev_pm_ops). A new source file, scsi_pm.c, is
created to hold the new callback routines, and the existing
suspend/resume code is moved there.
Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
Diffstat (limited to 'drivers/scsi/scsi_sysfs.c')
-rw-r--r-- | drivers/scsi/scsi_sysfs.c | 48 |
1 files changed, 1 insertions, 47 deletions
diff --git a/drivers/scsi/scsi_sysfs.c b/drivers/scsi/scsi_sysfs.c index c23ab978c3ba..5f85f8e831f3 100644 --- a/drivers/scsi/scsi_sysfs.c +++ b/drivers/scsi/scsi_sysfs.c | |||
@@ -376,57 +376,11 @@ static int scsi_bus_uevent(struct device *dev, struct kobj_uevent_env *env) | |||
376 | return 0; | 376 | return 0; |
377 | } | 377 | } |
378 | 378 | ||
379 | static int scsi_bus_suspend(struct device * dev, pm_message_t state) | ||
380 | { | ||
381 | struct device_driver *drv; | ||
382 | struct scsi_device *sdev; | ||
383 | int err; | ||
384 | |||
385 | if (dev->type != &scsi_dev_type) | ||
386 | return 0; | ||
387 | |||
388 | drv = dev->driver; | ||
389 | sdev = to_scsi_device(dev); | ||
390 | |||
391 | err = scsi_device_quiesce(sdev); | ||
392 | if (err) | ||
393 | return err; | ||
394 | |||
395 | if (drv && drv->suspend) { | ||
396 | err = drv->suspend(dev, state); | ||
397 | if (err) | ||
398 | return err; | ||
399 | } | ||
400 | |||
401 | return 0; | ||
402 | } | ||
403 | |||
404 | static int scsi_bus_resume(struct device * dev) | ||
405 | { | ||
406 | struct device_driver *drv; | ||
407 | struct scsi_device *sdev; | ||
408 | int err = 0; | ||
409 | |||
410 | if (dev->type != &scsi_dev_type) | ||
411 | return 0; | ||
412 | |||
413 | drv = dev->driver; | ||
414 | sdev = to_scsi_device(dev); | ||
415 | |||
416 | if (drv && drv->resume) | ||
417 | err = drv->resume(dev); | ||
418 | |||
419 | scsi_device_resume(sdev); | ||
420 | |||
421 | return err; | ||
422 | } | ||
423 | |||
424 | struct bus_type scsi_bus_type = { | 379 | struct bus_type scsi_bus_type = { |
425 | .name = "scsi", | 380 | .name = "scsi", |
426 | .match = scsi_bus_match, | 381 | .match = scsi_bus_match, |
427 | .uevent = scsi_bus_uevent, | 382 | .uevent = scsi_bus_uevent, |
428 | .suspend = scsi_bus_suspend, | 383 | .pm = &scsi_bus_pm_ops, |
429 | .resume = scsi_bus_resume, | ||
430 | }; | 384 | }; |
431 | EXPORT_SYMBOL_GPL(scsi_bus_type); | 385 | EXPORT_SYMBOL_GPL(scsi_bus_type); |
432 | 386 | ||