===== 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);