* Use of the new attribute modifiers on the 53c700
@ 2003-05-23 16:41 James Bottomley
0 siblings, 0 replies; only message in thread
From: James Bottomley @ 2003-05-23 16:41 UTC (permalink / raw)
To: SCSI Mailing List; +Cc: Mike Anderson
[-- 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);
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2003-05-23 16:28 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-05-23 16:41 Use of the new attribute modifiers on the 53c700 James Bottomley
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox