diff options
Diffstat (limited to 'drivers/scsi/scsi_sysfs.c')
-rw-r--r-- | drivers/scsi/scsi_sysfs.c | 35 |
1 files changed, 33 insertions, 2 deletions
diff --git a/drivers/scsi/scsi_sysfs.c b/drivers/scsi/scsi_sysfs.c index 46349293de08..ea7f3a433572 100644 --- a/drivers/scsi/scsi_sysfs.c +++ b/drivers/scsi/scsi_sysfs.c | |||
@@ -21,7 +21,7 @@ | |||
21 | #include "scsi_priv.h" | 21 | #include "scsi_priv.h" |
22 | #include "scsi_logging.h" | 22 | #include "scsi_logging.h" |
23 | 23 | ||
24 | static struct { | 24 | static const struct { |
25 | enum scsi_device_state value; | 25 | enum scsi_device_state value; |
26 | char *name; | 26 | char *name; |
27 | } sdev_states[] = { | 27 | } sdev_states[] = { |
@@ -48,7 +48,7 @@ const char *scsi_device_state_name(enum scsi_device_state state) | |||
48 | return name; | 48 | return name; |
49 | } | 49 | } |
50 | 50 | ||
51 | static struct { | 51 | static const struct { |
52 | enum scsi_host_state value; | 52 | enum scsi_host_state value; |
53 | char *name; | 53 | char *name; |
54 | } shost_states[] = { | 54 | } shost_states[] = { |
@@ -263,9 +263,40 @@ static int scsi_bus_match(struct device *dev, struct device_driver *gendrv) | |||
263 | return (sdp->inq_periph_qual == SCSI_INQ_PQ_CON)? 1: 0; | 263 | return (sdp->inq_periph_qual == SCSI_INQ_PQ_CON)? 1: 0; |
264 | } | 264 | } |
265 | 265 | ||
266 | static int scsi_bus_suspend(struct device * dev, pm_message_t state) | ||
267 | { | ||
268 | struct scsi_device *sdev = to_scsi_device(dev); | ||
269 | struct scsi_host_template *sht = sdev->host->hostt; | ||
270 | int err; | ||
271 | |||
272 | err = scsi_device_quiesce(sdev); | ||
273 | if (err) | ||
274 | return err; | ||
275 | |||
276 | if (sht->suspend) | ||
277 | err = sht->suspend(sdev); | ||
278 | |||
279 | return err; | ||
280 | } | ||
281 | |||
282 | static int scsi_bus_resume(struct device * dev) | ||
283 | { | ||
284 | struct scsi_device *sdev = to_scsi_device(dev); | ||
285 | struct scsi_host_template *sht = sdev->host->hostt; | ||
286 | int err = 0; | ||
287 | |||
288 | if (sht->resume) | ||
289 | err = sht->resume(sdev); | ||
290 | |||
291 | scsi_device_resume(sdev); | ||
292 | return err; | ||
293 | } | ||
294 | |||
266 | struct bus_type scsi_bus_type = { | 295 | struct bus_type scsi_bus_type = { |
267 | .name = "scsi", | 296 | .name = "scsi", |
268 | .match = scsi_bus_match, | 297 | .match = scsi_bus_match, |
298 | .suspend = scsi_bus_suspend, | ||
299 | .resume = scsi_bus_resume, | ||
269 | }; | 300 | }; |
270 | 301 | ||
271 | int scsi_sysfs_register(void) | 302 | int scsi_sysfs_register(void) |