Commit b75ce4ef authored by James Bottomley's avatar James Bottomley Committed by James Bottomley

[PATCH] Use of the new attribute modifiers on the 53c700

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.
parent 3134118a
......@@ -173,6 +173,8 @@ STATIC void NCR_700_chip_reset(struct Scsi_Host *host);
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 @@ NCR_700_detect(Scsi_Host_Template *tpnt,
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 @@ NCR_700_slave_destroy(Scsi_Device *SDp)
/* 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);
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment