Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=7a39ac3f25bef018862a991d754aff681c019127
Commit:     7a39ac3f25bef018862a991d754aff681c019127
Parent:     645a0c6c48e0122f4212e3957e73bddc18788d99
Author:     James Bottomley <[EMAIL PROTECTED]>
AuthorDate: Tue Sep 25 22:45:53 2007 -0500
Committer:  James Bottomley <[EMAIL PROTECTED]>
CommitDate: Wed Oct 17 21:56:12 2007 -0400

    [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 <[EMAIL PROTECTED]>
    Signed-off-by: James Bottomley <[EMAIL PROTECTED]>
---
 drivers/scsi/hosts.c      |    6 ++++++
 drivers/scsi/scsi_sysfs.c |   10 ++++++----
 2 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/drivers/scsi/hosts.c b/drivers/scsi/hosts.c
index 112ab6a..24271a8 100644
--- a/drivers/scsi/hosts.c
+++ b/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/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);
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to