aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi
diff options
context:
space:
mode:
authorFinn Thain <fthain@telegraphics.com.au>2014-03-17 20:42:21 -0400
committerChristoph Hellwig <hch@lst.de>2014-05-28 06:10:43 -0400
commit9829e52897359a17169410960e2a9dfcababb83b (patch)
tree7b40861443beafa31008301b81cc8a1588e18396 /drivers/scsi
parentd65e634a86e681ffd36717cde63fb81edbb6f719 (diff)
scsi/NCR5380: fix and standardize NDEBUG macros
All three NCR5380 core driver implementations share the same NCR5380.h header file so they need to agree on certain macro definitions. The flag bit used by the NDEBUG_MERGING macro in atari_NCR5380 and sun3_NCR5380 collides with the bit used by NDEBUG_LISTS. Moreover, NDEBUG_ABORT appears in NCR5380.c so it should be defined in NCR5380.h rather than in each of the many drivers using that core. An undefined NDEBUG_ABORT macro caused compiler errors and led to dodgy workarounds in the core driver that can now be removed. (See commits f566a576bca09de85bf477fc0ab2c8c96405b77b and 185a7a1cd79b9891e3c17abdb103ba1c98d6ca7a.) Move all of the NDEBUG_ABORT, NDEBUG_TAGS and NDEBUG_MERGING macro definitions into NCR5380.h where all the other NDEBUG macros live. Also, incorrect "#ifdef NDEBUG" becomes "#if NDEBUG" to fix the warning: drivers/scsi/mac_scsi.c: At top level: drivers/scsi/NCR5380.c:418: warning: 'NCR5380_print' defined but not used drivers/scsi/NCR5380.c:459: warning: 'NCR5380_print_phase' defined but not used The debugging code is now enabled when NDEBUG != 0. Signed-off-by: Finn Thain <fthain@telegraphics.com.au> Acked-by: Sam Creasey <sammy@sammy.net> Signed-off-by: Christoph Hellwig <hch@lst.de>
Diffstat (limited to 'drivers/scsi')
-rw-r--r--drivers/scsi/NCR5380.c7
-rw-r--r--drivers/scsi/NCR5380.h22
-rw-r--r--drivers/scsi/atari_NCR5380.c10
-rw-r--r--drivers/scsi/atari_scsi.c6
-rw-r--r--drivers/scsi/dtc.c2
-rw-r--r--drivers/scsi/mac_scsi.c6
-rw-r--r--drivers/scsi/sun3_NCR5380.c8
-rw-r--r--drivers/scsi/sun3_scsi.c6
-rw-r--r--drivers/scsi/sun3_scsi_vme.c6
9 files changed, 19 insertions, 54 deletions
diff --git a/drivers/scsi/NCR5380.c b/drivers/scsi/NCR5380.c
index d8c2f40c4f33..93d13fc9a293 100644
--- a/drivers/scsi/NCR5380.c
+++ b/drivers/scsi/NCR5380.c
@@ -87,13 +87,6 @@
87#include <scsi/scsi_dbg.h> 87#include <scsi/scsi_dbg.h>
88#include <scsi/scsi_transport_spi.h> 88#include <scsi/scsi_transport_spi.h>
89 89
90#ifndef NDEBUG
91#define NDEBUG 0
92#endif
93#ifndef NDEBUG_ABORT
94#define NDEBUG_ABORT 0
95#endif
96
97#if (NDEBUG & NDEBUG_LISTS) 90#if (NDEBUG & NDEBUG_LISTS)
98#define LIST(x,y) {printk("LINE:%d Adding %p to %p\n", __LINE__, (void*)(x), (void*)(y)); if ((x)==(y)) udelay(5); } 91#define LIST(x,y) {printk("LINE:%d Adding %p to %p\n", __LINE__, (void*)(x), (void*)(y)); if ((x)==(y)) udelay(5); }
99#define REMOVE(w,x,y,z) {printk("LINE:%d Removing: %p->%p %p->%p \n", __LINE__, (void*)(w), (void*)(x), (void*)(y), (void*)(z)); if ((x)==(y)) udelay(5); } 92#define REMOVE(w,x,y,z) {printk("LINE:%d Removing: %p->%p %p->%p \n", __LINE__, (void*)(w), (void*)(x), (void*)(y), (void*)(z)); if ((x)==(y)) udelay(5); }
diff --git a/drivers/scsi/NCR5380.h b/drivers/scsi/NCR5380.h
index 9cb3d316bbce..1541c62ddf5f 100644
--- a/drivers/scsi/NCR5380.h
+++ b/drivers/scsi/NCR5380.h
@@ -56,6 +56,9 @@
56#define NDEBUG_C400_PREAD 0x100000 56#define NDEBUG_C400_PREAD 0x100000
57#define NDEBUG_C400_PWRITE 0x200000 57#define NDEBUG_C400_PWRITE 0x200000
58#define NDEBUG_LISTS 0x400000 58#define NDEBUG_LISTS 0x400000
59#define NDEBUG_ABORT 0x800000
60#define NDEBUG_TAGS 0x1000000
61#define NDEBUG_MERGING 0x2000000
59 62
60#define NDEBUG_ANY 0xFFFFFFFFUL 63#define NDEBUG_ANY 0xFFFFFFFFUL
61 64
@@ -288,9 +291,24 @@ struct NCR5380_hostdata {
288 291
289#ifdef __KERNEL__ 292#ifdef __KERNEL__
290 293
294#ifndef NDEBUG
295#define NDEBUG (0)
296#endif
297
298#if NDEBUG
299#define dprintk(flg, fmt, args...) \
300 do { if ((NDEBUG) & (flg)) pr_debug(fmt, ## args); } while (0)
301#define NCR5380_dprint(flg, arg) \
302 do { if ((NDEBUG) & (flg)) NCR5380_print(arg); } while (0)
303#define NCR5380_dprint_phase(flg, arg) \
304 do { if ((NDEBUG) & (flg)) NCR5380_print_phase(arg); } while (0)
305static void NCR5380_print_phase(struct Scsi_Host *instance);
306static void NCR5380_print(struct Scsi_Host *instance);
307#else
291#define dprintk(flg, fmt, args...) do {} while (0) 308#define dprintk(flg, fmt, args...) do {} while (0)
292#define NCR5380_dprint(flg, arg) do {} while (0) 309#define NCR5380_dprint(flg, arg) do {} while (0)
293#define NCR5380_dprint_phase(flg, arg) do {} while (0) 310#define NCR5380_dprint_phase(flg, arg) do {} while (0)
311#endif
294 312
295#if defined(AUTOPROBE_IRQ) 313#if defined(AUTOPROBE_IRQ)
296static int NCR5380_probe_irq(struct Scsi_Host *instance, int possible); 314static int NCR5380_probe_irq(struct Scsi_Host *instance, int possible);
@@ -303,10 +321,6 @@ static irqreturn_t NCR5380_intr(int irq, void *dev_id);
303#endif 321#endif
304static void NCR5380_main(struct work_struct *work); 322static void NCR5380_main(struct work_struct *work);
305static void __maybe_unused NCR5380_print_options(struct Scsi_Host *instance); 323static void __maybe_unused NCR5380_print_options(struct Scsi_Host *instance);
306#ifdef NDEBUG
307static void NCR5380_print_phase(struct Scsi_Host *instance);
308static void NCR5380_print(struct Scsi_Host *instance);
309#endif
310static int NCR5380_abort(Scsi_Cmnd * cmd); 324static int NCR5380_abort(Scsi_Cmnd * cmd);
311static int NCR5380_bus_reset(Scsi_Cmnd * cmd); 325static int NCR5380_bus_reset(Scsi_Cmnd * cmd);
312static int NCR5380_queue_command(struct Scsi_Host *, struct scsi_cmnd *); 326static int NCR5380_queue_command(struct Scsi_Host *, struct scsi_cmnd *);
diff --git a/drivers/scsi/atari_NCR5380.c b/drivers/scsi/atari_NCR5380.c
index 9e642035b38f..1814aa20b724 100644
--- a/drivers/scsi/atari_NCR5380.c
+++ b/drivers/scsi/atari_NCR5380.c
@@ -626,16 +626,6 @@ static void NCR5380_print_phase(struct Scsi_Host *instance)
626 } 626 }
627} 627}
628 628
629#else /* !NDEBUG */
630
631/* dummies... */
632static inline void NCR5380_print(struct Scsi_Host *instance)
633{
634};
635static inline void NCR5380_print_phase(struct Scsi_Host *instance)
636{
637};
638
639#endif 629#endif
640 630
641/* 631/*
diff --git a/drivers/scsi/atari_scsi.c b/drivers/scsi/atari_scsi.c
index c66b4caee9c6..b51aa54ecf0f 100644
--- a/drivers/scsi/atari_scsi.c
+++ b/drivers/scsi/atari_scsi.c
@@ -67,12 +67,6 @@
67 67
68#include <linux/module.h> 68#include <linux/module.h>
69 69
70#define NDEBUG (0)
71
72#define NDEBUG_ABORT 0x00100000
73#define NDEBUG_TAGS 0x00200000
74#define NDEBUG_MERGING 0x00400000
75
76#define AUTOSENSE 70#define AUTOSENSE
77/* For the Atari version, use only polled IO or REAL_DMA */ 71/* For the Atari version, use only polled IO or REAL_DMA */
78#define REAL_DMA 72#define REAL_DMA
diff --git a/drivers/scsi/dtc.c b/drivers/scsi/dtc.c
index eb29fe7eaf49..0a667fe05006 100644
--- a/drivers/scsi/dtc.c
+++ b/drivers/scsi/dtc.c
@@ -3,8 +3,6 @@
3#define PSEUDO_DMA 3#define PSEUDO_DMA
4#define DONT_USE_INTR 4#define DONT_USE_INTR
5#define UNSAFE /* Leave interrupts enabled during pseudo-dma I/O */ 5#define UNSAFE /* Leave interrupts enabled during pseudo-dma I/O */
6#define xNDEBUG (NDEBUG_INTR+NDEBUG_RESELECTION+\
7 NDEBUG_SELECTION+NDEBUG_ARBITRATION)
8#define DMA_WORKS_RIGHT 6#define DMA_WORKS_RIGHT
9 7
10 8
diff --git a/drivers/scsi/mac_scsi.c b/drivers/scsi/mac_scsi.c
index ee5506454caa..6a039eb1cbce 100644
--- a/drivers/scsi/mac_scsi.c
+++ b/drivers/scsi/mac_scsi.c
@@ -54,12 +54,6 @@
54 54
55#include "NCR5380.h" 55#include "NCR5380.h"
56 56
57#if 0
58#define NDEBUG (NDEBUG_INTR | NDEBUG_PSEUDO_DMA | NDEBUG_ARBITRATION | NDEBUG_SELECTION | NDEBUG_RESELECTION)
59#else
60#define NDEBUG (NDEBUG_ABORT)
61#endif
62
63#define RESET_BOOT 57#define RESET_BOOT
64#define DRIVER_SETUP 58#define DRIVER_SETUP
65 59
diff --git a/drivers/scsi/sun3_NCR5380.c b/drivers/scsi/sun3_NCR5380.c
index 447c8f0f8cf1..61a2c101b4bc 100644
--- a/drivers/scsi/sun3_NCR5380.c
+++ b/drivers/scsi/sun3_NCR5380.c
@@ -484,7 +484,7 @@ static __inline__ void initialize_SCp(struct scsi_cmnd *cmd)
484 484
485#include <linux/delay.h> 485#include <linux/delay.h>
486 486
487#if 1 487#if NDEBUG
488static struct { 488static struct {
489 unsigned char mask; 489 unsigned char mask;
490 const char * name;} 490 const char * name;}
@@ -572,12 +572,6 @@ static void NCR5380_print_phase(struct Scsi_Host *instance)
572 } 572 }
573} 573}
574 574
575#else /* !NDEBUG */
576
577/* dummies... */
578__inline__ void NCR5380_print(struct Scsi_Host *instance) { };
579__inline__ void NCR5380_print_phase(struct Scsi_Host *instance) { };
580
581#endif 575#endif
582 576
583/* 577/*
diff --git a/drivers/scsi/sun3_scsi.c b/drivers/scsi/sun3_scsi.c
index 020d38aed4f5..99466e64e507 100644
--- a/drivers/scsi/sun3_scsi.c
+++ b/drivers/scsi/sun3_scsi.c
@@ -65,12 +65,6 @@
65#include <asm/idprom.h> 65#include <asm/idprom.h>
66#include <asm/machines.h> 66#include <asm/machines.h>
67 67
68#define NDEBUG 0
69
70#define NDEBUG_ABORT 0x00100000
71#define NDEBUG_TAGS 0x00200000
72#define NDEBUG_MERGING 0x00400000
73
74/* dma on! */ 68/* dma on! */
75#define REAL_DMA 69#define REAL_DMA
76 70
diff --git a/drivers/scsi/sun3_scsi_vme.c b/drivers/scsi/sun3_scsi_vme.c
index a3dd55d1d2fd..95031d571cd0 100644
--- a/drivers/scsi/sun3_scsi_vme.c
+++ b/drivers/scsi/sun3_scsi_vme.c
@@ -38,12 +38,6 @@
38/* dma on! */ 38/* dma on! */
39#define REAL_DMA 39#define REAL_DMA
40 40
41#define NDEBUG 0
42
43#define NDEBUG_ABORT 0x00100000
44#define NDEBUG_TAGS 0x00200000
45#define NDEBUG_MERGING 0x00400000
46
47#include "scsi.h" 41#include "scsi.h"
48#include "initio.h" 42#include "initio.h"
49#include <scsi/scsi_host.h> 43#include <scsi/scsi_host.h>