aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi
diff options
context:
space:
mode:
authorFinn Thain <fthain@telegraphics.com.au>2014-11-12 00:11:53 -0500
committerChristoph Hellwig <hch@lst.de>2014-11-20 03:11:05 -0500
commit76f13b9321ec8f9550cd1557ed28ac6ae91e612c (patch)
treecb4066631e701617bc35131231469e2c8c343ccf /drivers/scsi
parent4d3d2a54f731aa25f66adcf934ba9a55ca8204d4 (diff)
ncr5380: Cleanup TAG_NEXT and TAG_NONE macros
Both atari_NCR5380.c and sun3_NCR5380.c core drivers #undef TAG_NONE and then redefine it. But the original definition is unused because NCR5380.c lacks support for tagged queueing. So just define it once. The TAG_NEXT macro only appears in the arguments to NCR5380_select() calls. But that routine doesn't use its tag argument as the tag was already assigned in NCR5380_main(). So remove the unused argument and the macro. Signed-off-by: Finn Thain <fthain@telegraphics.com.au> Reviewed-by: Hannes Reinecke <hare@suse.de> Tested-by: Michael Schmitz <schmitzmic@gmail.com> Signed-off-by: Christoph Hellwig <hch@lst.de>
Diffstat (limited to 'drivers/scsi')
-rw-r--r--drivers/scsi/NCR5380.c29
-rw-r--r--drivers/scsi/NCR5380.h11
-rw-r--r--drivers/scsi/atari_NCR5380.c19
-rw-r--r--drivers/scsi/sun3_NCR5380.c19
4 files changed, 27 insertions, 51 deletions
diff --git a/drivers/scsi/NCR5380.c b/drivers/scsi/NCR5380.c
index 048bc02556cb..0a8786acddc3 100644
--- a/drivers/scsi/NCR5380.c
+++ b/drivers/scsi/NCR5380.c
@@ -1073,14 +1073,14 @@ static void NCR5380_main(struct work_struct *work)
1073 hostdata->selecting = NULL; 1073 hostdata->selecting = NULL;
1074 /* RvC: have to preset this to indicate a new command is being performed */ 1074 /* RvC: have to preset this to indicate a new command is being performed */
1075 1075
1076 if (!NCR5380_select(instance, tmp, 1076 /*
1077 /* 1077 * REQUEST SENSE commands are issued without tagged
1078 * REQUEST SENSE commands are issued without tagged 1078 * queueing, even on SCSI-II devices because the
1079 * queueing, even on SCSI-II devices because the 1079 * contingent allegiance condition exists for the
1080 * contingent allegiance condition exists for the 1080 * entire unit.
1081 * entire unit. 1081 */
1082 */ 1082
1083 (tmp->cmnd[0] == REQUEST_SENSE) ? TAG_NONE : TAG_NEXT)) { 1083 if (!NCR5380_select(instance, tmp)) {
1084 break; 1084 break;
1085 } else { 1085 } else {
1086 LIST(tmp, hostdata->issue_queue); 1086 LIST(tmp, hostdata->issue_queue);
@@ -1097,7 +1097,7 @@ static void NCR5380_main(struct work_struct *work)
1097 if (hostdata->selecting) { 1097 if (hostdata->selecting) {
1098 tmp = (Scsi_Cmnd *) hostdata->selecting; 1098 tmp = (Scsi_Cmnd *) hostdata->selecting;
1099 /* Selection will drop and retake the lock */ 1099 /* Selection will drop and retake the lock */
1100 if (!NCR5380_select(instance, tmp, (tmp->cmnd[0] == REQUEST_SENSE) ? TAG_NONE : TAG_NEXT)) { 1100 if (!NCR5380_select(instance, tmp)) {
1101 /* Ok ?? */ 1101 /* Ok ?? */
1102 } else { 1102 } else {
1103 /* RvC: device failed, so we wait a long time 1103 /* RvC: device failed, so we wait a long time
@@ -1246,17 +1246,14 @@ static void collect_stats(struct NCR5380_hostdata *hostdata, Scsi_Cmnd * cmd)
1246 1246
1247 1247
1248/* 1248/*
1249 * Function : int NCR5380_select (struct Scsi_Host *instance, Scsi_Cmnd *cmd, 1249 * Function : int NCR5380_select (struct Scsi_Host *instance, Scsi_Cmnd *cmd)
1250 * int tag);
1251 * 1250 *
1252 * Purpose : establishes I_T_L or I_T_L_Q nexus for new or existing command, 1251 * Purpose : establishes I_T_L or I_T_L_Q nexus for new or existing command,
1253 * including ARBITRATION, SELECTION, and initial message out for 1252 * including ARBITRATION, SELECTION, and initial message out for
1254 * IDENTIFY and queue messages. 1253 * IDENTIFY and queue messages.
1255 * 1254 *
1256 * Inputs : instance - instantiation of the 5380 driver on which this 1255 * Inputs : instance - instantiation of the 5380 driver on which this
1257 * target lives, cmd - SCSI command to execute, tag - set to TAG_NEXT for 1256 * target lives, cmd - SCSI command to execute.
1258 * new tag, TAG_NONE for untagged queueing, otherwise set to the tag for
1259 * the command that is presently connected.
1260 * 1257 *
1261 * Returns : -1 if selection could not execute for some reason, 1258 * Returns : -1 if selection could not execute for some reason,
1262 * 0 if selection succeeded or failed because the target 1259 * 0 if selection succeeded or failed because the target
@@ -1278,7 +1275,7 @@ static void collect_stats(struct NCR5380_hostdata *hostdata, Scsi_Cmnd * cmd)
1278 * Locks: caller holds hostdata lock in IRQ mode 1275 * Locks: caller holds hostdata lock in IRQ mode
1279 */ 1276 */
1280 1277
1281static int NCR5380_select(struct Scsi_Host *instance, Scsi_Cmnd * cmd, int tag) 1278static int NCR5380_select(struct Scsi_Host *instance, Scsi_Cmnd *cmd)
1282{ 1279{
1283 NCR5380_local_declare(); 1280 NCR5380_local_declare();
1284 struct NCR5380_hostdata *hostdata = (struct NCR5380_hostdata *) instance->hostdata; 1281 struct NCR5380_hostdata *hostdata = (struct NCR5380_hostdata *) instance->hostdata;
@@ -2773,7 +2770,7 @@ static int NCR5380_abort(Scsi_Cmnd * cmd) {
2773 if (cmd == tmp) { 2770 if (cmd == tmp) {
2774 dprintk(NDEBUG_ABORT, "scsi%d : aborting disconnected command.\n", instance->host_no); 2771 dprintk(NDEBUG_ABORT, "scsi%d : aborting disconnected command.\n", instance->host_no);
2775 2772
2776 if (NCR5380_select(instance, cmd, (int) cmd->tag)) 2773 if (NCR5380_select(instance, cmd))
2777 return FAILED; 2774 return FAILED;
2778 dprintk(NDEBUG_ABORT, "scsi%d : nexus reestablished.\n", instance->host_no); 2775 dprintk(NDEBUG_ABORT, "scsi%d : nexus reestablished.\n", instance->host_no);
2779 2776
diff --git a/drivers/scsi/NCR5380.h b/drivers/scsi/NCR5380.h
index b1ed20aaf10e..b36e3b4a9d43 100644
--- a/drivers/scsi/NCR5380.h
+++ b/drivers/scsi/NCR5380.h
@@ -224,14 +224,11 @@
224#define DISCONNECT_LONG 2 224#define DISCONNECT_LONG 2
225 225
226/* 226/*
227 * These are "special" values for the tag parameter passed to NCR5380_select. 227 * "Special" value for the (unsigned char) command tag, to indicate
228 * I_T_L nexus instead of I_T_L_Q.
228 */ 229 */
229 230
230#define TAG_NEXT -1 /* Use next free tag */ 231#define TAG_NONE 0xff
231#define TAG_NONE -2 /*
232 * Establish I_T_L nexus instead of I_T_L_Q
233 * even on SCSI-II devices.
234 */
235 232
236/* 233/*
237 * These are "special" values for the irq and dma_channel fields of the 234 * These are "special" values for the irq and dma_channel fields of the
@@ -323,7 +320,7 @@ static irqreturn_t NCR5380_intr(int irq, void *dev_id);
323static void NCR5380_main(struct work_struct *work); 320static void NCR5380_main(struct work_struct *work);
324static void __maybe_unused NCR5380_print_options(struct Scsi_Host *instance); 321static void __maybe_unused NCR5380_print_options(struct Scsi_Host *instance);
325static void NCR5380_reselect(struct Scsi_Host *instance); 322static void NCR5380_reselect(struct Scsi_Host *instance);
326static int NCR5380_select(struct Scsi_Host *instance, Scsi_Cmnd * cmd, int tag); 323static int NCR5380_select(struct Scsi_Host *instance, Scsi_Cmnd *cmd);
327#if defined(PSEUDO_DMA) || defined(REAL_DMA) || defined(REAL_DMA_POLL) 324#if defined(PSEUDO_DMA) || defined(REAL_DMA) || defined(REAL_DMA_POLL)
328static int NCR5380_transfer_dma(struct Scsi_Host *instance, unsigned char *phase, int *count, unsigned char **data); 325static int NCR5380_transfer_dma(struct Scsi_Host *instance, unsigned char *phase, int *count, unsigned char **data);
329#endif 326#endif
diff --git a/drivers/scsi/atari_NCR5380.c b/drivers/scsi/atari_NCR5380.c
index 339f238598b1..3cfd39c583ad 100644
--- a/drivers/scsi/atari_NCR5380.c
+++ b/drivers/scsi/atari_NCR5380.c
@@ -316,10 +316,6 @@ static struct scsi_host_template *the_template = NULL;
316 * important: the tag bit must be cleared before 'nr_allocated' is decreased. 316 * important: the tag bit must be cleared before 'nr_allocated' is decreased.
317 */ 317 */
318 318
319/* -1 for TAG_NONE is not possible with unsigned char cmd->tag */
320#undef TAG_NONE
321#define TAG_NONE 0xff
322
323typedef struct { 319typedef struct {
324 DECLARE_BITMAP(allocated, MAX_TAGS); 320 DECLARE_BITMAP(allocated, MAX_TAGS);
325 int nr_allocated; 321 int nr_allocated;
@@ -1118,9 +1114,7 @@ static void NCR5380_main(struct work_struct *work)
1118#ifdef SUPPORT_TAGS 1114#ifdef SUPPORT_TAGS
1119 cmd_get_tag(tmp, tmp->cmnd[0] != REQUEST_SENSE); 1115 cmd_get_tag(tmp, tmp->cmnd[0] != REQUEST_SENSE);
1120#endif 1116#endif
1121 if (!NCR5380_select(instance, tmp, 1117 if (!NCR5380_select(instance, tmp)) {
1122 (tmp->cmnd[0] == REQUEST_SENSE) ? TAG_NONE :
1123 TAG_NEXT)) {
1124 falcon_dont_release--; 1118 falcon_dont_release--;
1125 /* release if target did not response! */ 1119 /* release if target did not response! */
1126 falcon_release_lock_if_possible(hostdata); 1120 falcon_release_lock_if_possible(hostdata);
@@ -1351,17 +1345,14 @@ static void collect_stats(struct NCR5380_hostdata* hostdata, Scsi_Cmnd *cmd)
1351#endif 1345#endif
1352 1346
1353/* 1347/*
1354 * Function : int NCR5380_select (struct Scsi_Host *instance, Scsi_Cmnd *cmd, 1348 * Function : int NCR5380_select (struct Scsi_Host *instance, Scsi_Cmnd *cmd)
1355 * int tag);
1356 * 1349 *
1357 * Purpose : establishes I_T_L or I_T_L_Q nexus for new or existing command, 1350 * Purpose : establishes I_T_L or I_T_L_Q nexus for new or existing command,
1358 * including ARBITRATION, SELECTION, and initial message out for 1351 * including ARBITRATION, SELECTION, and initial message out for
1359 * IDENTIFY and queue messages. 1352 * IDENTIFY and queue messages.
1360 * 1353 *
1361 * Inputs : instance - instantiation of the 5380 driver on which this 1354 * Inputs : instance - instantiation of the 5380 driver on which this
1362 * target lives, cmd - SCSI command to execute, tag - set to TAG_NEXT for 1355 * target lives, cmd - SCSI command to execute.
1363 * new tag, TAG_NONE for untagged queueing, otherwise set to the tag for
1364 * the command that is presently connected.
1365 * 1356 *
1366 * Returns : -1 if selection could not execute for some reason, 1357 * Returns : -1 if selection could not execute for some reason,
1367 * 0 if selection succeeded or failed because the target 1358 * 0 if selection succeeded or failed because the target
@@ -1381,7 +1372,7 @@ static void collect_stats(struct NCR5380_hostdata* hostdata, Scsi_Cmnd *cmd)
1381 * cmd->result host byte set to DID_BAD_TARGET. 1372 * cmd->result host byte set to DID_BAD_TARGET.
1382 */ 1373 */
1383 1374
1384static int NCR5380_select(struct Scsi_Host *instance, Scsi_Cmnd *cmd, int tag) 1375static int NCR5380_select(struct Scsi_Host *instance, Scsi_Cmnd *cmd)
1385{ 1376{
1386 SETUP_HOSTDATA(instance); 1377 SETUP_HOSTDATA(instance);
1387 unsigned char tmp[3], phase; 1378 unsigned char tmp[3], phase;
@@ -2757,7 +2748,7 @@ int NCR5380_abort(Scsi_Cmnd *cmd)
2757 local_irq_restore(flags); 2748 local_irq_restore(flags);
2758 dprintk(NDEBUG_ABORT, "scsi%d: aborting disconnected command.\n", HOSTNO); 2749 dprintk(NDEBUG_ABORT, "scsi%d: aborting disconnected command.\n", HOSTNO);
2759 2750
2760 if (NCR5380_select(instance, cmd, (int)cmd->tag)) 2751 if (NCR5380_select(instance, cmd))
2761 return FAILED; 2752 return FAILED;
2762 2753
2763 dprintk(NDEBUG_ABORT, "scsi%d: nexus reestablished.\n", HOSTNO); 2754 dprintk(NDEBUG_ABORT, "scsi%d: nexus reestablished.\n", HOSTNO);
diff --git a/drivers/scsi/sun3_NCR5380.c b/drivers/scsi/sun3_NCR5380.c
index 24e90c9776a6..3586fecdc8bb 100644
--- a/drivers/scsi/sun3_NCR5380.c
+++ b/drivers/scsi/sun3_NCR5380.c
@@ -305,10 +305,6 @@ static struct scsi_host_template *the_template = NULL;
305 * important: the tag bit must be cleared before 'nr_allocated' is decreased. 305 * important: the tag bit must be cleared before 'nr_allocated' is decreased.
306 */ 306 */
307 307
308/* -1 for TAG_NONE is not possible with unsigned char cmd->tag */
309#undef TAG_NONE
310#define TAG_NONE 0xff
311
312/* For the m68k, the number of bits in 'allocated' must be a multiple of 32! */ 308/* For the m68k, the number of bits in 'allocated' must be a multiple of 32! */
313#if (MAX_TAGS % 32) != 0 309#if (MAX_TAGS % 32) != 0
314#error "MAX_TAGS must be a multiple of 32!" 310#error "MAX_TAGS must be a multiple of 32!"
@@ -1057,9 +1053,7 @@ static void NCR5380_main (struct work_struct *bl)
1057#ifdef SUPPORT_TAGS 1053#ifdef SUPPORT_TAGS
1058 cmd_get_tag( tmp, tmp->cmnd[0] != REQUEST_SENSE ); 1054 cmd_get_tag( tmp, tmp->cmnd[0] != REQUEST_SENSE );
1059#endif 1055#endif
1060 if (!NCR5380_select(instance, tmp, 1056 if (!NCR5380_select(instance, tmp)) {
1061 (tmp->cmnd[0] == REQUEST_SENSE) ? TAG_NONE :
1062 TAG_NEXT)) {
1063 break; 1057 break;
1064 } else { 1058 } else {
1065 local_irq_disable(); 1059 local_irq_disable();
@@ -1292,16 +1286,14 @@ static void collect_stats(struct NCR5380_hostdata *hostdata,
1292 1286
1293/* 1287/*
1294 * Function : int NCR5380_select(struct Scsi_Host *instance, 1288 * Function : int NCR5380_select(struct Scsi_Host *instance,
1295 * struct scsi_cmnd *cmd, int tag); 1289 * struct scsi_cmnd *cmd)
1296 * 1290 *
1297 * Purpose : establishes I_T_L or I_T_L_Q nexus for new or existing command, 1291 * Purpose : establishes I_T_L or I_T_L_Q nexus for new or existing command,
1298 * including ARBITRATION, SELECTION, and initial message out for 1292 * including ARBITRATION, SELECTION, and initial message out for
1299 * IDENTIFY and queue messages. 1293 * IDENTIFY and queue messages.
1300 * 1294 *
1301 * Inputs : instance - instantiation of the 5380 driver on which this 1295 * Inputs : instance - instantiation of the 5380 driver on which this
1302 * target lives, cmd - SCSI command to execute, tag - set to TAG_NEXT for 1296 * target lives, cmd - SCSI command to execute.
1303 * new tag, TAG_NONE for untagged queueing, otherwise set to the tag for
1304 * the command that is presently connected.
1305 * 1297 *
1306 * Returns : -1 if selection could not execute for some reason, 1298 * Returns : -1 if selection could not execute for some reason,
1307 * 0 if selection succeeded or failed because the target 1299 * 0 if selection succeeded or failed because the target
@@ -1321,8 +1313,7 @@ static void collect_stats(struct NCR5380_hostdata *hostdata,
1321 * cmd->result host byte set to DID_BAD_TARGET. 1313 * cmd->result host byte set to DID_BAD_TARGET.
1322 */ 1314 */
1323 1315
1324static int NCR5380_select(struct Scsi_Host *instance, struct scsi_cmnd *cmd, 1316static int NCR5380_select(struct Scsi_Host *instance, struct scsi_cmnd *cmd)
1325 int tag)
1326{ 1317{
1327 SETUP_HOSTDATA(instance); 1318 SETUP_HOSTDATA(instance);
1328 unsigned char tmp[3], phase; 1319 unsigned char tmp[3], phase;
@@ -2735,7 +2726,7 @@ static int NCR5380_abort(struct scsi_cmnd *cmd)
2735 local_irq_restore(flags); 2726 local_irq_restore(flags);
2736 dprintk(NDEBUG_ABORT, "scsi%d: aborting disconnected command.\n", HOSTNO); 2727 dprintk(NDEBUG_ABORT, "scsi%d: aborting disconnected command.\n", HOSTNO);
2737 2728
2738 if (NCR5380_select (instance, cmd, (int) cmd->tag)) 2729 if (NCR5380_select(instance, cmd))
2739 return FAILED; 2730 return FAILED;
2740 2731
2741 dprintk(NDEBUG_ABORT, "scsi%d: nexus reestablished.\n", HOSTNO); 2732 dprintk(NDEBUG_ABORT, "scsi%d: nexus reestablished.\n", HOSTNO);