From b29c814364a252732b3e67ddbb499d13bbc7a976 Mon Sep 17 00:00:00 2001 From: James Bottomley Date: Tue, 25 Sep 2007 22:45:53 -0500 Subject: [PATCH] --- yaml --- r: 72313 b: refs/heads/master c: 7a39ac3f25bef018862a991d754aff681c019127 h: refs/heads/master i: 72311: 43d11cf55e5543ea01c3faeb9ebd1be460fe423b v: v3 --- [refs] | 2 +- trunk/drivers/scsi/hosts.c | 6 ++++++ trunk/drivers/scsi/scsi_sysfs.c | 10 ++++++---- 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/[refs] b/[refs] index 63c8181074ec..08b55c838d92 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 645a0c6c48e0122f4212e3957e73bddc18788d99 +refs/heads/master: 7a39ac3f25bef018862a991d754aff681c019127 diff --git a/trunk/drivers/scsi/hosts.c b/trunk/drivers/scsi/hosts.c index 112ab6abe62b..24271a871b8c 100644 --- a/trunk/drivers/scsi/hosts.c +++ b/trunk/drivers/scsi/hosts.c @@ -345,6 +345,12 @@ struct Scsi_Host *scsi_host_alloc(struct scsi_host_template *sht, int privsize) shost->active_mode = sht->supported_mode; shost->use_sg_chaining = sht->use_sg_chaining; + if (sht->supported_mode == MODE_UNKNOWN) + /* means we didn't set it ... default to INITIATOR */ + shost->active_mode = MODE_INITIATOR; + else + shost->active_mode = sht->supported_mode; + if (sht->max_host_blocked) shost->max_host_blocked = sht->max_host_blocked; else diff --git a/trunk/drivers/scsi/scsi_sysfs.c b/trunk/drivers/scsi/scsi_sysfs.c index daed37df00b1..d531ceeb0d8c 100644 --- a/trunk/drivers/scsi/scsi_sysfs.c +++ b/trunk/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);