Skip to content

Commit

Permalink
[SCSI] make supported_mode default to initiator.
Browse files Browse the repository at this point in the history
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 <tomof@acm.org>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
  • Loading branch information
James Bottomley authored and James Bottomley committed Oct 18, 2007
1 parent 645a0c6 commit 7a39ac3
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
6 changes: 6 additions & 0 deletions drivers/scsi/hosts.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 6 additions & 4 deletions drivers/scsi/scsi_sysfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 7a39ac3

Please sign in to comment.