aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/scsi')
-rw-r--r--drivers/scsi/hosts.c6
-rw-r--r--drivers/scsi/scsi_sysfs.c10
2 files changed, 12 insertions, 4 deletions
diff --git a/drivers/scsi/hosts.c b/drivers/scsi/hosts.c
index 112ab6abe62b..24271a871b8c 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)
345 shost->active_mode = sht->supported_mode; 345 shost->active_mode = sht->supported_mode;
346 shost->use_sg_chaining = sht->use_sg_chaining; 346 shost->use_sg_chaining = sht->use_sg_chaining;
347 347
348 if (sht->supported_mode == MODE_UNKNOWN)
349 /* means we didn't set it ... default to INITIATOR */
350 shost->active_mode = MODE_INITIATOR;
351 else
352 shost->active_mode = sht->supported_mode;
353
348 if (sht->max_host_blocked) 354 if (sht->max_host_blocked)
349 shost->max_host_blocked = sht->max_host_blocked; 355 shost->max_host_blocked = sht->max_host_blocked;
350 else 356 else
diff --git a/drivers/scsi/scsi_sysfs.c b/drivers/scsi/scsi_sysfs.c
index daed37df00b1..d531ceeb0d8c 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)
209static ssize_t show_shost_supported_mode(struct class_device *class_dev, char *buf) 209static ssize_t show_shost_supported_mode(struct class_device *class_dev, char *buf)
210{ 210{
211 struct Scsi_Host *shost = class_to_shost(class_dev); 211 struct Scsi_Host *shost = class_to_shost(class_dev);
212 unsigned int supported_mode = shost->hostt->supported_mode;
212 213
213 if (shost->hostt->supported_mode == MODE_UNKNOWN) 214 if (supported_mode == MODE_UNKNOWN)
214 return snprintf(buf, 20, "unknown\n"); 215 /* by default this should be initiator */
215 else 216 supported_mode = MODE_INITIATOR;
216 return show_shost_mode(shost->hostt->supported_mode, buf); 217
218 return show_shost_mode(supported_mode, buf);
217} 219}
218 220
219static CLASS_DEVICE_ATTR(supported_mode, S_IRUGO | S_IWUSR, show_shost_supported_mode, NULL); 221static CLASS_DEVICE_ATTR(supported_mode, S_IRUGO | S_IWUSR, show_shost_supported_mode, NULL);