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.c29
1 files changed, 24 insertions, 5 deletions
diff --git a/drivers/scsi/scsi_sysfs.c b/drivers/scsi/scsi_sysfs.c
index 67bb20ed45d2..fbd7f9ed1251 100644
--- a/drivers/scsi/scsi_sysfs.c
+++ b/drivers/scsi/scsi_sysfs.c
@@ -21,6 +21,8 @@
21#include "scsi_priv.h" 21#include "scsi_priv.h"
22#include "scsi_logging.h" 22#include "scsi_logging.h"
23 23
24static struct device_type scsi_dev_type;
25
24static const struct { 26static const struct {
25 enum scsi_device_state value; 27 enum scsi_device_state value;
26 char *name; 28 char *name;
@@ -335,7 +337,12 @@ static struct class sdev_class = {
335/* all probing is done in the individual ->probe routines */ 337/* all probing is done in the individual ->probe routines */
336static int scsi_bus_match(struct device *dev, struct device_driver *gendrv) 338static int scsi_bus_match(struct device *dev, struct device_driver *gendrv)
337{ 339{
338 struct scsi_device *sdp = to_scsi_device(dev); 340 struct scsi_device *sdp;
341
342 if (dev->type != &scsi_dev_type)
343 return 0;
344
345 sdp = to_scsi_device(dev);
339 if (sdp->no_uld_attach) 346 if (sdp->no_uld_attach)
340 return 0; 347 return 0;
341 return (sdp->inq_periph_qual == SCSI_INQ_PQ_CON)? 1: 0; 348 return (sdp->inq_periph_qual == SCSI_INQ_PQ_CON)? 1: 0;
@@ -351,10 +358,16 @@ static int scsi_bus_uevent(struct device *dev, struct kobj_uevent_env *env)
351 358
352static int scsi_bus_suspend(struct device * dev, pm_message_t state) 359static int scsi_bus_suspend(struct device * dev, pm_message_t state)
353{ 360{
354 struct device_driver *drv = dev->driver; 361 struct device_driver *drv;
355 struct scsi_device *sdev = to_scsi_device(dev); 362 struct scsi_device *sdev;
356 int err; 363 int err;
357 364
365 if (dev->type != &scsi_dev_type)
366 return 0;
367
368 drv = dev->driver;
369 sdev = to_scsi_device(dev);
370
358 err = scsi_device_quiesce(sdev); 371 err = scsi_device_quiesce(sdev);
359 if (err) 372 if (err)
360 return err; 373 return err;
@@ -370,10 +383,16 @@ static int scsi_bus_suspend(struct device * dev, pm_message_t state)
370 383
371static int scsi_bus_resume(struct device * dev) 384static int scsi_bus_resume(struct device * dev)
372{ 385{
373 struct device_driver *drv = dev->driver; 386 struct device_driver *drv;
374 struct scsi_device *sdev = to_scsi_device(dev); 387 struct scsi_device *sdev;
375 int err = 0; 388 int err = 0;
376 389
390 if (dev->type != &scsi_dev_type)
391 return 0;
392
393 drv = dev->driver;
394 sdev = to_scsi_device(dev);
395
377 if (drv && drv->resume) 396 if (drv && drv->resume)
378 err = drv->resume(dev); 397 err = drv->resume(dev);
379 398