aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/scsi_sysfs.c
diff options
context:
space:
mode:
authorHannes Reinecke <hare@suse.de>2008-03-18 09:32:28 -0400
committerJames Bottomley <James.Bottomley@HansenPartnership.com>2008-04-22 16:16:29 -0400
commitb0ed43360fdca227048d88a08290365cb681c1a8 (patch)
treec4bec4f311c2d73159df6fe35986442968aae8c9 /drivers/scsi/scsi_sysfs.c
parentcb6b7f40630f94126233194847a86bf5501fb63c (diff)
[SCSI] add scsi_host and scsi_target to scsi_bus
This patch implements scsi_host and scsi_target device types and adds both to the scsi_bus. Signed-off-by: Hannes Reinecke <hare@suse.de> Signed-off-by: Kay Sievers <kay.sievers@vrfy.org> Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
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