From: James Bottomley <James.Bottomley@SteelEye.com>
To: Jeff Garzik <jeff@garzik.org>
Cc: Matthew Wilcox <matthew@wil.cx>, FUJITA Tomonori <tomof@acm.org>,
akpm@linux-foundation.org, linux-scsi@vger.kernel.org,
linux-kernel@vger.kernel.org, fujita.tomonori@lab.ntt.co.jp
Subject: Re: queued patches for SCSI for 2.6.24
Date: Tue, 25 Sep 2007 22:45:53 -0500 [thread overview]
Message-ID: <1190778353.8707.29.camel@localhost.localdomain> (raw)
In-Reply-To: <46F9D328.4030801@garzik.org>
On Tue, 2007-09-25 at 23:34 -0400, Jeff Garzik wrote:
> Matthew Wilcox wrote:
> > On Tue, Sep 25, 2007 at 10:37:33PM -0400, Jeff Garzik wrote:
> >> Are there any const-ness worries for scsi_host_template, or plans for
> >> the future? I do not see any other examples of the host template
> >> members getting modified.
> >
> > Goodness, Jeff, you haven't looked too hard. There's dozens of examples
> > I've come across trawling the horrible unmaintained drivers. I'd love
> > to see scsi_host_template become const, but it's not happening any time
> > soon, and we can address this little piece when the time comes.
>
> Well, sure, the driver is the owner of that memory.
>
> We're talking about common code.
>
> If everybody agrees SHT is R/W in the core, Fujita-san's patch is fine.
Well, I don't like mucking with the template either.
This whole mess is generated basically because the zero default of the
template should be treated as initiator. How about this, which makes
that manifest?
James
diff --git a/drivers/scsi/hosts.c b/drivers/scsi/hosts.c
index adc9559..7e26440 100644
--- a/drivers/scsi/hosts.c
+++ b/drivers/scsi/hosts.c
@@ -342,7 +342,11 @@ struct Scsi_Host *scsi_host_alloc(struct scsi_host_template *sht, int privsize)
shost->unchecked_isa_dma = sht->unchecked_isa_dma;
shost->use_clustering = sht->use_clustering;
shost->ordered_tag = sht->ordered_tag;
- shost->active_mode = sht->supported_mode;
+ 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;
diff --git a/drivers/scsi/scsi_sysfs.c b/drivers/scsi/scsi_sysfs.c
index 0088c4d..4965e9e 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(shost->hostt->supported_mode, buf);
}
static CLASS_DEVICE_ATTR(supported_mode, S_IRUGO | S_IWUSR, show_shost_supported_mode, NULL);
next prev parent reply other threads:[~2007-09-26 3:46 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-09-26 1:00 queued patches for SCSI for 2.6.24 James Bottomley
2007-09-26 1:05 ` David Miller
2007-09-26 1:28 ` FUJITA Tomonori
2007-09-26 1:42 ` James Bottomley
2007-09-26 2:12 ` FUJITA Tomonori
2007-09-26 2:37 ` Jeff Garzik
2007-09-26 2:52 ` FUJITA Tomonori
2007-09-26 2:56 ` Matthew Wilcox
2007-09-26 3:34 ` Jeff Garzik
2007-09-26 3:38 ` Matthew Wilcox
2007-09-26 3:45 ` James Bottomley [this message]
2007-09-26 3:55 ` Jeff Garzik
2007-09-26 3:55 ` FUJITA Tomonori
2007-09-26 4:01 ` James Bottomley
2007-09-26 4:10 ` FUJITA Tomonori
2007-09-26 4:56 ` FUJITA Tomonori
2007-09-26 14:07 ` James Bottomley
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1190778353.8707.29.camel@localhost.localdomain \
--to=james.bottomley@steeleye.com \
--cc=akpm@linux-foundation.org \
--cc=fujita.tomonori@lab.ntt.co.jp \
--cc=jeff@garzik.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=matthew@wil.cx \
--cc=tomof@acm.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox