aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/atari_NCR5380.c
diff options
context:
space:
mode:
authorFinn Thain <fthain@telegraphics.com.au>2016-01-03 00:05:53 -0500
committerMartin K. Petersen <martin.petersen@oracle.com>2016-01-06 21:43:05 -0500
commitdbb6b350695186b340e621f5edf4c31420f9ab23 (patch)
tree92103239e895bdfc961dd7c3df84ee2218c8be69 /drivers/scsi/atari_NCR5380.c
parente5c3fddfaa066e440315e713ddf8b60e9ac48cf7 (diff)
ncr5380: Remove H_NO macro and introduce dsprintk
Replace all H_NO and some HOSTNO macros (both peculiar to atari_NCR5380.c) with a new dsprintk macro that's more useful and more consistent. The new macro avoids a lot of boilerplate in new code in subsequent patches. Keep NCR5380.c in sync. Remaining HOSTNO macros are removed as side-effects of subsequent patches. Signed-off-by: Finn Thain <fthain@telegraphics.com.au> Reviewed-by: Hannes Reinecke <hare@suse.com> Tested-by: Ondrej Zary <linux@rainbow-software.org> Tested-by: Michael Schmitz <schmitzmic@gmail.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Diffstat (limited to 'drivers/scsi/atari_NCR5380.c')
-rw-r--r--drivers/scsi/atari_NCR5380.c54
1 files changed, 27 insertions, 27 deletions
diff --git a/drivers/scsi/atari_NCR5380.c b/drivers/scsi/atari_NCR5380.c
index f31a4d544e2e..029f6522e19c 100644
--- a/drivers/scsi/atari_NCR5380.c
+++ b/drivers/scsi/atari_NCR5380.c
@@ -207,7 +207,6 @@
207#define NEXTADDR(cmd) ((struct scsi_cmnd **)&(cmd)->host_scribble) 207#define NEXTADDR(cmd) ((struct scsi_cmnd **)&(cmd)->host_scribble)
208 208
209#define HOSTNO instance->host_no 209#define HOSTNO instance->host_no
210#define H_NO(cmd) (cmd)->device->host->host_no
211 210
212static int do_abort(struct Scsi_Host *); 211static int do_abort(struct Scsi_Host *);
213static void do_reset(struct Scsi_Host *); 212static void do_reset(struct Scsi_Host *);
@@ -280,7 +279,8 @@ static void __init init_tags(struct NCR5380_hostdata *hostdata)
280static int is_lun_busy(struct scsi_cmnd *cmd, int should_be_tagged) 279static int is_lun_busy(struct scsi_cmnd *cmd, int should_be_tagged)
281{ 280{
282 u8 lun = cmd->device->lun; 281 u8 lun = cmd->device->lun;
283 SETUP_HOSTDATA(cmd->device->host); 282 struct Scsi_Host *instance = cmd->device->host;
283 struct NCR5380_hostdata *hostdata = shost_priv(instance);
284 284
285 if (hostdata->busy[cmd->device->id] & (1 << lun)) 285 if (hostdata->busy[cmd->device->id] & (1 << lun))
286 return 1; 286 return 1;
@@ -290,8 +290,8 @@ static int is_lun_busy(struct scsi_cmnd *cmd, int should_be_tagged)
290 return 0; 290 return 0;
291 if (hostdata->TagAlloc[scmd_id(cmd)][lun].nr_allocated >= 291 if (hostdata->TagAlloc[scmd_id(cmd)][lun].nr_allocated >=
292 hostdata->TagAlloc[scmd_id(cmd)][lun].queue_size) { 292 hostdata->TagAlloc[scmd_id(cmd)][lun].queue_size) {
293 dprintk(NDEBUG_TAGS, "scsi%d: target %d lun %d: no free tags\n", 293 dsprintk(NDEBUG_TAGS, instance, "target %d lun %d: no free tags\n",
294 H_NO(cmd), cmd->device->id, lun); 294 scmd_id(cmd), lun);
295 return 1; 295 return 1;
296 } 296 }
297 return 0; 297 return 0;
@@ -306,7 +306,8 @@ static int is_lun_busy(struct scsi_cmnd *cmd, int should_be_tagged)
306static void cmd_get_tag(struct scsi_cmnd *cmd, int should_be_tagged) 306static void cmd_get_tag(struct scsi_cmnd *cmd, int should_be_tagged)
307{ 307{
308 u8 lun = cmd->device->lun; 308 u8 lun = cmd->device->lun;
309 SETUP_HOSTDATA(cmd->device->host); 309 struct Scsi_Host *instance = cmd->device->host;
310 struct NCR5380_hostdata *hostdata = shost_priv(instance);
310 311
311 /* If we or the target don't support tagged queuing, allocate the LUN for 312 /* If we or the target don't support tagged queuing, allocate the LUN for
312 * an untagged command. 313 * an untagged command.
@@ -316,18 +317,16 @@ static void cmd_get_tag(struct scsi_cmnd *cmd, int should_be_tagged)
316 !cmd->device->tagged_supported) { 317 !cmd->device->tagged_supported) {
317 cmd->tag = TAG_NONE; 318 cmd->tag = TAG_NONE;
318 hostdata->busy[cmd->device->id] |= (1 << lun); 319 hostdata->busy[cmd->device->id] |= (1 << lun);
319 dprintk(NDEBUG_TAGS, "scsi%d: target %d lun %d now allocated by untagged " 320 dsprintk(NDEBUG_TAGS, instance, "target %d lun %d now allocated by untagged command\n",
320 "command\n", H_NO(cmd), cmd->device->id, lun); 321 scmd_id(cmd), lun);
321 } else { 322 } else {
322 struct tag_alloc *ta = &hostdata->TagAlloc[scmd_id(cmd)][lun]; 323 struct tag_alloc *ta = &hostdata->TagAlloc[scmd_id(cmd)][lun];
323 324
324 cmd->tag = find_first_zero_bit(ta->allocated, MAX_TAGS); 325 cmd->tag = find_first_zero_bit(ta->allocated, MAX_TAGS);
325 set_bit(cmd->tag, ta->allocated); 326 set_bit(cmd->tag, ta->allocated);
326 ta->nr_allocated++; 327 ta->nr_allocated++;
327 dprintk(NDEBUG_TAGS, "scsi%d: using tag %d for target %d lun %d " 328 dsprintk(NDEBUG_TAGS, instance, "using tag %d for target %d lun %d (%d tags allocated)\n",
328 "(now %d tags in use)\n", 329 cmd->tag, scmd_id(cmd), lun, ta->nr_allocated);
329 H_NO(cmd), cmd->tag, cmd->device->id,
330 lun, ta->nr_allocated);
331 } 330 }
332} 331}
333 332
@@ -339,21 +338,22 @@ static void cmd_get_tag(struct scsi_cmnd *cmd, int should_be_tagged)
339static void cmd_free_tag(struct scsi_cmnd *cmd) 338static void cmd_free_tag(struct scsi_cmnd *cmd)
340{ 339{
341 u8 lun = cmd->device->lun; 340 u8 lun = cmd->device->lun;
342 SETUP_HOSTDATA(cmd->device->host); 341 struct Scsi_Host *instance = cmd->device->host;
342 struct NCR5380_hostdata *hostdata = shost_priv(instance);
343 343
344 if (cmd->tag == TAG_NONE) { 344 if (cmd->tag == TAG_NONE) {
345 hostdata->busy[cmd->device->id] &= ~(1 << lun); 345 hostdata->busy[cmd->device->id] &= ~(1 << lun);
346 dprintk(NDEBUG_TAGS, "scsi%d: target %d lun %d untagged cmd finished\n", 346 dsprintk(NDEBUG_TAGS, instance, "target %d lun %d untagged cmd freed\n",
347 H_NO(cmd), cmd->device->id, lun); 347 scmd_id(cmd), lun);
348 } else if (cmd->tag >= MAX_TAGS) { 348 } else if (cmd->tag >= MAX_TAGS) {
349 printk(KERN_NOTICE "scsi%d: trying to free bad tag %d!\n", 349 shost_printk(KERN_NOTICE, instance,
350 H_NO(cmd), cmd->tag); 350 "trying to free bad tag %d!\n", cmd->tag);
351 } else { 351 } else {
352 struct tag_alloc *ta = &hostdata->TagAlloc[scmd_id(cmd)][lun]; 352 struct tag_alloc *ta = &hostdata->TagAlloc[scmd_id(cmd)][lun];
353 clear_bit(cmd->tag, ta->allocated); 353 clear_bit(cmd->tag, ta->allocated);
354 ta->nr_allocated--; 354 ta->nr_allocated--;
355 dprintk(NDEBUG_TAGS, "scsi%d: freed tag %d for target %d lun %d\n", 355 dsprintk(NDEBUG_TAGS, instance, "freed tag %d for target %d lun %d\n",
356 H_NO(cmd), cmd->tag, cmd->device->id, lun); 356 cmd->tag, scmd_id(cmd), lun);
357 } 357 }
358} 358}
359 359
@@ -815,8 +815,7 @@ static int NCR5380_queue_command(struct Scsi_Host *instance,
815 switch (cmd->cmnd[0]) { 815 switch (cmd->cmnd[0]) {
816 case WRITE_6: 816 case WRITE_6:
817 case WRITE_10: 817 case WRITE_10:
818 printk(KERN_NOTICE "scsi%d: WRITE attempted with NO_WRITE debugging flag set\n", 818 shost_printk(KERN_DEBUG, instance, "WRITE attempted with NDEBUG_NO_WRITE set\n");
819 H_NO(cmd));
820 cmd->result = (DID_ERROR << 16); 819 cmd->result = (DID_ERROR << 16);
821 cmd->scsi_done(cmd); 820 cmd->scsi_done(cmd);
822 return 0; 821 return 0;
@@ -875,8 +874,8 @@ static int NCR5380_queue_command(struct Scsi_Host *instance,
875 } 874 }
876 spin_unlock_irqrestore(&hostdata->lock, flags); 875 spin_unlock_irqrestore(&hostdata->lock, flags);
877 876
878 dprintk(NDEBUG_QUEUES, "scsi%d: command added to %s of queue\n", H_NO(cmd), 877 dsprintk(NDEBUG_QUEUES, instance, "command %p added to %s of queue\n",
879 (cmd->cmnd[0] == REQUEST_SENSE) ? "head" : "tail"); 878 cmd, (cmd->cmnd[0] == REQUEST_SENSE) ? "head" : "tail");
880 879
881 /* Kick off command processing */ 880 /* Kick off command processing */
882 queue_work(hostdata->work_q, &hostdata->main_task); 881 queue_work(hostdata->work_q, &hostdata->main_task);
@@ -2079,8 +2078,9 @@ static void NCR5380_information_transfer(struct Scsi_Host *instance)
2079 LIST(cmd,hostdata->issue_queue); 2078 LIST(cmd,hostdata->issue_queue);
2080 SET_NEXT(cmd, hostdata->issue_queue); 2079 SET_NEXT(cmd, hostdata->issue_queue);
2081 hostdata->issue_queue = (struct scsi_cmnd *) cmd; 2080 hostdata->issue_queue = (struct scsi_cmnd *) cmd;
2082 dprintk(NDEBUG_QUEUES, "scsi%d: REQUEST SENSE added to head of " 2081 dsprintk(NDEBUG_QUEUES, instance,
2083 "issue queue\n", H_NO(cmd)); 2082 "REQUEST SENSE cmd %p added to head of issue queue\n",
2083 cmd);
2084 } else { 2084 } else {
2085 cmd->scsi_done(cmd); 2085 cmd->scsi_done(cmd);
2086 } 2086 }
@@ -2746,11 +2746,11 @@ static int NCR5380_bus_reset(struct scsi_cmnd *cmd)
2746 */ 2746 */
2747 2747
2748 if (hostdata->issue_queue) 2748 if (hostdata->issue_queue)
2749 dprintk(NDEBUG_ABORT, "scsi%d: reset aborted issued command(s)\n", H_NO(cmd)); 2749 dsprintk(NDEBUG_ABORT, instance, "reset aborted issued command(s)\n");
2750 if (hostdata->connected) 2750 if (hostdata->connected)
2751 dprintk(NDEBUG_ABORT, "scsi%d: reset aborted a connected command\n", H_NO(cmd)); 2751 dsprintk(NDEBUG_ABORT, instance, "reset aborted a connected command\n");
2752 if (hostdata->disconnected_queue) 2752 if (hostdata->disconnected_queue)
2753 dprintk(NDEBUG_ABORT, "scsi%d: reset aborted disconnected command(s)\n", H_NO(cmd)); 2753 dsprintk(NDEBUG_ABORT, instance, "reset aborted disconnected command(s)\n");
2754 2754
2755 hostdata->issue_queue = NULL; 2755 hostdata->issue_queue = NULL;
2756 hostdata->connected = NULL; 2756 hostdata->connected = NULL;