From: James Bottomley <James.Bottomley@steeleye.com>
To: SCSI Mailing List <linux-scsi@vger.kernel.org>
Cc: Mike Anderson <andmike@us.ibm.com>
Subject: Use of the new attribute modifiers on the 53c700
Date: 23 May 2003 12:41:57 -0400 [thread overview]
Message-ID: <1053708117.2086.9.camel@mulgrave> (raw)
[-- Attachment #1: Type: text/plain, Size: 439 bytes --]
The attached patch illustrates how the new attribute functions can be
used.
The 53c700 modifies the queue_depth attribute so it can be set by the
root user, and also adds a new active_tags attribute which may be used
to obtain the information it currently puts out via its proc interface.
This achieves all I think we really need, which is the ability to have
LLDs provide their own routines for setting the default attributes.
James
[-- Attachment #2: tmp.diff --]
[-- Type: text/plain, Size: 2040 bytes --]
===== drivers/scsi/53c700.c 1.31 vs edited =====
--- 1.31/drivers/scsi/53c700.c Tue May 20 17:51:56 2003
+++ edited/drivers/scsi/53c700.c Fri May 23 12:24:10 2003
@@ -173,6 +173,8 @@
STATIC int NCR_700_slave_configure(Scsi_Device *SDpnt);
STATIC void NCR_700_slave_destroy(Scsi_Device *SDpnt);
+static struct device_attribute **NCR_700_dev_attrs = NULL;
+
static char *NCR_700_phase[] = {
"",
"after selection",
@@ -247,6 +249,9 @@
static int banner = 0;
int j;
+ if(tpnt->sdev_attrs == NULL)
+ tpnt->sdev_attrs = NCR_700_dev_attrs;
+
memory = dma_alloc_noncoherent(hostdata->dev, TOTAL_MEM_SIZE,
&pScript, GFP_KERNEL);
if(memory == NULL) {
@@ -2015,6 +2020,55 @@
/* to do here: deallocate memory */
}
+static ssize_t
+NCR_700_store_queue_depth(struct device *dev, const char *buf, size_t count)
+{
+ int depth;
+
+ struct scsi_device *SDp = to_scsi_device(dev);
+ depth = simple_strtoul(buf, NULL, 0);
+ if(depth > NCR_700_MAX_TAGS)
+ return -EINVAL;
+ scsi_adjust_queue_depth(SDp, MSG_ORDERED_TAG, depth);
+
+ return count;
+}
+
+static ssize_t
+NCR_700_show_active_tags(struct device *dev, char *buf)
+{
+ struct scsi_device *SDp = to_scsi_device(dev);
+
+ return snprintf(buf, 20, "%d\n", NCR_700_get_depth(SDp));
+}
+
+static struct device_attribute NCR_700_queue_depth_attr = {
+ .attr = {
+ .name = "queue_depth",
+ .mode = S_IWUSR,
+ },
+ .store = NCR_700_store_queue_depth,
+};
+
+static struct device_attribute NCR_700_active_tags_attr = {
+ .attr = {
+ .name = "active_tags",
+ .mode = S_IRUGO,
+ },
+ .show = NCR_700_show_active_tags,
+};
+
+STATIC int __init NCR_700_init(void)
+{
+ scsi_sysfs_modify_sdev_attribute(&NCR_700_dev_attrs,
+ &NCR_700_queue_depth_attr);
+ scsi_sysfs_modify_sdev_attribute(&NCR_700_dev_attrs,
+ &NCR_700_active_tags_attr);
+ return 0;
+}
+
EXPORT_SYMBOL(NCR_700_detect);
EXPORT_SYMBOL(NCR_700_release);
EXPORT_SYMBOL(NCR_700_intr);
+
+module_init(NCR_700_init);
reply other threads:[~2003-05-23 16:28 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=1053708117.2086.9.camel@mulgrave \
--to=james.bottomley@steeleye.com \
--cc=andmike@us.ibm.com \
--cc=linux-scsi@vger.kernel.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