Commit 002653d2 authored by James Bottomley's avatar James Bottomley Committed by Linus Torvalds

[PATCH] update the 53c700 use of transport attributes

This patch just brings it up to date with the previous transport
attribute patch, moving it to the model where it sets the min/max of the
attribute if asked for something outside its range.  It also only makes
period and offset visible (it doesn't care about any of the others).
parent 678decfe
...@@ -1998,9 +1998,12 @@ NCR_700_set_period(struct scsi_device *SDp, int period) ...@@ -1998,9 +1998,12 @@ NCR_700_set_period(struct scsi_device *SDp, int period)
struct NCR_700_Host_Parameters *hostdata = struct NCR_700_Host_Parameters *hostdata =
(struct NCR_700_Host_Parameters *)SDp->host->hostdata[0]; (struct NCR_700_Host_Parameters *)SDp->host->hostdata[0];
if(!hostdata->fast || period < hostdata->min_period) if(!hostdata->fast)
return; return;
if(period < hostdata->min_period)
period = hostdata->min_period;
spi_period(SDp) = period; spi_period(SDp) = period;
NCR_700_clear_flag(SDp, NCR_700_DEV_NEGOTIATED_SYNC); NCR_700_clear_flag(SDp, NCR_700_DEV_NEGOTIATED_SYNC);
NCR_700_clear_flag(SDp, NCR_700_DEV_BEGIN_SYNC_NEGOTIATION); NCR_700_clear_flag(SDp, NCR_700_DEV_BEGIN_SYNC_NEGOTIATION);
...@@ -2012,12 +2015,15 @@ NCR_700_set_offset(struct scsi_device *SDp, int offset) ...@@ -2012,12 +2015,15 @@ NCR_700_set_offset(struct scsi_device *SDp, int offset)
{ {
struct NCR_700_Host_Parameters *hostdata = struct NCR_700_Host_Parameters *hostdata =
(struct NCR_700_Host_Parameters *)SDp->host->hostdata[0]; (struct NCR_700_Host_Parameters *)SDp->host->hostdata[0];
int max_offset = hostdata->chip710
? NCR_710_MAX_OFFSET : NCR_700_MAX_OFFSET;
if(!hostdata->fast || if(!hostdata->fast)
offset > (hostdata->chip710
? NCR_710_MAX_OFFSET : NCR_700_MAX_OFFSET))
return; return;
if(offset > max_offset)
offset = max_offset;
/* if we're currently async, make sure the period is reasonable */ /* if we're currently async, make sure the period is reasonable */
if(spi_offset(SDp) == 0 && (spi_period(SDp) < hostdata->min_period || if(spi_offset(SDp) == 0 && (spi_period(SDp) < hostdata->min_period ||
spi_period(SDp) > 0xff)) spi_period(SDp) > 0xff))
...@@ -2107,8 +2113,10 @@ EXPORT_SYMBOL(NCR_700_release); ...@@ -2107,8 +2113,10 @@ EXPORT_SYMBOL(NCR_700_release);
EXPORT_SYMBOL(NCR_700_intr); EXPORT_SYMBOL(NCR_700_intr);
static struct spi_function_template NCR_700_transport_functions = { static struct spi_function_template NCR_700_transport_functions = {
.set_period = NCR_700_set_period, .set_period = NCR_700_set_period,
.set_offset = NCR_700_set_offset, .show_period = 1,
.set_offset = NCR_700_set_offset,
.show_offset = 1,
}; };
static int __init NCR_700_init(void) static int __init NCR_700_init(void)
......
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