Commit 684f4a4c4a69f7226d8c7559c0cdfc7bd388335a

Authored by Roel Kluin
Committed by David S. Miller
1 parent 18cc42a3a1

EtherExpress16: fix printing timed out status

in drivers/net/eexpress.c:558, function unstick_cu()

while (!SCB_complete(rsst=scb_status(dev))) {
	...
	if (...)
		printk(KERN_WARNING "%s: Reset timed out status %04x, retrying...\n",
                                                       dev->name,rsst);
}

but this will become

while (!((rsst = scb_status(dev) & 0x8000) != 0) ...

because of the macro:

#define SCB_complete(s) ((s&0x8000)!=0)

so rsst can only become either 0x8000 or 0, but in the latter case the
loop ends, I think the wrong timed out status is printed. This also
cleans up similar macros.

Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

Showing 1 changed file with 28 additions and 28 deletions Side-by-side Diff

drivers/net/eexpress.h
... ... @@ -68,17 +68,17 @@
68 68 */
69 69  
70 70 /* these functions take the SCB status word and test the relevant status bit */
71   -#define SCB_complete(s) ((s&0x8000)!=0)
72   -#define SCB_rxdframe(s) ((s&0x4000)!=0)
73   -#define SCB_CUdead(s) ((s&0x2000)!=0)
74   -#define SCB_RUdead(s) ((s&0x1000)!=0)
75   -#define SCB_ack(s) (s & 0xf000)
  71 +#define SCB_complete(s) (((s) & 0x8000) != 0)
  72 +#define SCB_rxdframe(s) (((s) & 0x4000) != 0)
  73 +#define SCB_CUdead(s) (((s) & 0x2000) != 0)
  74 +#define SCB_RUdead(s) (((s) & 0x1000) != 0)
  75 +#define SCB_ack(s) ((s) & 0xf000)
76 76  
77 77 /* Command unit status: 0=idle, 1=suspended, 2=active */
78   -#define SCB_CUstat(s) ((s&0x0300)>>8)
  78 +#define SCB_CUstat(s) (((s)&0x0300)>>8)
79 79  
80 80 /* Receive unit status: 0=idle, 1=suspended, 2=out of resources, 4=ready */
81   -#define SCB_RUstat(s) ((s&0x0070)>>4)
  81 +#define SCB_RUstat(s) (((s)&0x0070)>>4)
82 82  
83 83 /* SCB commands */
84 84 #define SCB_CUnop 0x0000
... ... @@ -98,18 +98,18 @@
98 98 * Command block defines
99 99 */
100 100  
101   -#define Stat_Done(s) ((s&0x8000)!=0)
102   -#define Stat_Busy(s) ((s&0x4000)!=0)
103   -#define Stat_OK(s) ((s&0x2000)!=0)
104   -#define Stat_Abort(s) ((s&0x1000)!=0)
105   -#define Stat_STFail ((s&0x0800)!=0)
106   -#define Stat_TNoCar(s) ((s&0x0400)!=0)
107   -#define Stat_TNoCTS(s) ((s&0x0200)!=0)
108   -#define Stat_TNoDMA(s) ((s&0x0100)!=0)
109   -#define Stat_TDefer(s) ((s&0x0080)!=0)
110   -#define Stat_TColl(s) ((s&0x0040)!=0)
111   -#define Stat_TXColl(s) ((s&0x0020)!=0)
112   -#define Stat_NoColl(s) (s&0x000f)
  101 +#define Stat_Done(s) (((s) & 0x8000) != 0)
  102 +#define Stat_Busy(s) (((s) & 0x4000) != 0)
  103 +#define Stat_OK(s) (((s) & 0x2000) != 0)
  104 +#define Stat_Abort(s) (((s) & 0x1000) != 0)
  105 +#define Stat_STFail (((s) & 0x0800) != 0)
  106 +#define Stat_TNoCar(s) (((s) & 0x0400) != 0)
  107 +#define Stat_TNoCTS(s) (((s) & 0x0200) != 0)
  108 +#define Stat_TNoDMA(s) (((s) & 0x0100) != 0)
  109 +#define Stat_TDefer(s) (((s) & 0x0080) != 0)
  110 +#define Stat_TColl(s) (((s) & 0x0040) != 0)
  111 +#define Stat_TXColl(s) (((s) & 0x0020) != 0)
  112 +#define Stat_NoColl(s) ((s) & 0x000f)
113 113  
114 114 /* Cmd_END will end AFTER the command if this is the first
115 115 * command block after an SCB_CUstart, but BEFORE the command
116 116  
... ... @@ -136,16 +136,16 @@
136 136 * Frame Descriptor (Receive block) defines
137 137 */
138 138  
139   -#define FD_Done(s) ((s&0x8000)!=0)
140   -#define FD_Busy(s) ((s&0x4000)!=0)
141   -#define FD_OK(s) ((s&0x2000)!=0)
  139 +#define FD_Done(s) (((s) & 0x8000) != 0)
  140 +#define FD_Busy(s) (((s) & 0x4000) != 0)
  141 +#define FD_OK(s) (((s) & 0x2000) != 0)
142 142  
143   -#define FD_CRC(s) ((s&0x0800)!=0)
144   -#define FD_Align(s) ((s&0x0400)!=0)
145   -#define FD_Resrc(s) ((s&0x0200)!=0)
146   -#define FD_DMA(s) ((s&0x0100)!=0)
147   -#define FD_Short(s) ((s&0x0080)!=0)
148   -#define FD_NoEOF(s) ((s&0x0040)!=0)
  143 +#define FD_CRC(s) (((s) & 0x0800) != 0)
  144 +#define FD_Align(s) (((s) & 0x0400) != 0)
  145 +#define FD_Resrc(s) (((s) & 0x0200) != 0)
  146 +#define FD_DMA(s) (((s) & 0x0100) != 0)
  147 +#define FD_Short(s) (((s) & 0x0080) != 0)
  148 +#define FD_NoEOF(s) (((s) & 0x0040) != 0)
149 149  
150 150 struct rfd_header {
151 151 volatile unsigned long flags;