From 7a39ac3f25bef018862a991d754aff681c019127 Mon Sep 17 00:00:00 2001 From: James Bottomley Date: Tue, 25 Sep 2007 22:45:53 -0500 Subject: [SCSI] make supported_mode default to initiator. if shost->supported mode is zero (i.e. MODE_UNKNOWN) show it as initiator (it's obviously an unconverted driver that won't do target). Acked-by: FUJITA Tomonori Signed-off-by: James Bottomley --- drivers/scsi/scsi_sysfs.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'drivers/scsi/scsi_sysfs.c') diff --git a/drivers/scsi/scsi_sysfs.c b/drivers/scsi/scsi_sysfs.c index daed37d..d531cee 100644 --- a/drivers/scsi/scsi_sysfs.c +++ b/drivers/scsi/scsi_sysfs.c @@ -209,11 +209,13 @@ show_shost_mode(unsigned int mode, char *buf) static ssize_t show_shost_supported_mode(struct class_device *class_dev, char *buf) { struct Scsi_Host *shost = class_to_shost(class_dev); + unsigned int supported_mode = shost->hostt->supported_mode; - if (shost->hostt->supported_mode == MODE_UNKNOWN) - return snprintf(buf, 20, "unknown\n"); - else - return show_shost_mode(shost->hostt->supported_mode, buf); + if (supported_mode == MODE_UNKNOWN) + /* by default this should be initiator */ + supported_mode = MODE_INITIATOR; + + return show_shost_mode(supported_mode, buf); } static CLASS_DEVICE_ATTR(supported_mode, S_IRUGO | S_IWUSR, show_shost_supported_mode, NULL); -- cgit v1.1