aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/irda
diff options
context:
space:
mode:
authorGlenn Elliott <gelliott@cs.unc.edu>2012-03-04 19:47:13 -0500
committerGlenn Elliott <gelliott@cs.unc.edu>2012-03-04 19:47:13 -0500
commitc71c03bda1e86c9d5198c5d83f712e695c4f2a1e (patch)
treeecb166cb3e2b7e2adb3b5e292245fefd23381ac8 /drivers/net/irda
parentea53c912f8a86a8567697115b6a0d8152beee5c8 (diff)
parent6a00f206debf8a5c8899055726ad127dbeeed098 (diff)
Merge branch 'mpi-master' into wip-k-fmlpwip-k-fmlp
Conflicts: litmus/sched_cedf.c
Diffstat (limited to 'drivers/net/irda')
-rw-r--r--drivers/net/irda/act200l-sir.c2
-rw-r--r--drivers/net/irda/ali-ircc.c8
-rw-r--r--drivers/net/irda/bfin_sir.c59
-rw-r--r--drivers/net/irda/bfin_sir.h63
-rw-r--r--drivers/net/irda/donauboe.c10
-rw-r--r--drivers/net/irda/donauboe.h6
-rw-r--r--drivers/net/irda/girbil-sir.c2
-rw-r--r--drivers/net/irda/irda-usb.c14
-rw-r--r--drivers/net/irda/irtty-sir.c2
-rw-r--r--drivers/net/irda/mcs7780.c10
-rw-r--r--drivers/net/irda/nsc-ircc.c4
-rw-r--r--drivers/net/irda/nsc-ircc.h2
-rw-r--r--drivers/net/irda/pxaficp_ir.c4
-rw-r--r--drivers/net/irda/sh_irda.c14
-rw-r--r--drivers/net/irda/sh_sir.c2
-rw-r--r--drivers/net/irda/sir_dev.c4
-rw-r--r--drivers/net/irda/smsc-ircc2.c6
-rw-r--r--drivers/net/irda/stir4200.c2
-rw-r--r--drivers/net/irda/via-ircc.c101
-rw-r--r--drivers/net/irda/via-ircc.h2
-rw-r--r--drivers/net/irda/vlsi_ir.h6
21 files changed, 114 insertions, 209 deletions
diff --git a/drivers/net/irda/act200l-sir.c b/drivers/net/irda/act200l-sir.c
index 37ab8c855719..8ff084f1d236 100644
--- a/drivers/net/irda/act200l-sir.c
+++ b/drivers/net/irda/act200l-sir.c
@@ -199,7 +199,7 @@ static int act200l_reset(struct sir_dev *dev)
199{ 199{
200 unsigned state = dev->fsm.substate; 200 unsigned state = dev->fsm.substate;
201 unsigned delay = 0; 201 unsigned delay = 0;
202 u8 control[9] = { 202 static const u8 control[9] = {
203 ACT200L_REG15, 203 ACT200L_REG15,
204 ACT200L_REG13 | ACT200L_SHDW, 204 ACT200L_REG13 | ACT200L_SHDW,
205 ACT200L_REG21 | ACT200L_EXCK | ACT200L_OSCL, 205 ACT200L_REG21 | ACT200L_EXCK | ACT200L_OSCL,
diff --git a/drivers/net/irda/ali-ircc.c b/drivers/net/irda/ali-ircc.c
index a3cb109006a5..d532dde5120f 100644
--- a/drivers/net/irda/ali-ircc.c
+++ b/drivers/net/irda/ali-ircc.c
@@ -76,7 +76,7 @@ static int ali_ircc_probe_53(ali_chip_t *chip, chipio_t *info);
76static int ali_ircc_init_43(ali_chip_t *chip, chipio_t *info); 76static int ali_ircc_init_43(ali_chip_t *chip, chipio_t *info);
77static int ali_ircc_init_53(ali_chip_t *chip, chipio_t *info); 77static int ali_ircc_init_53(ali_chip_t *chip, chipio_t *info);
78 78
79/* These are the currently known ALi sourth-bridge chipsets, the only one difference 79/* These are the currently known ALi south-bridge chipsets, the only one difference
80 * is that M1543C doesn't support HP HDSL-3600 80 * is that M1543C doesn't support HP HDSL-3600
81 */ 81 */
82static ali_chip_t chips[] = 82static ali_chip_t chips[] =
@@ -142,7 +142,7 @@ static void SetCOMInterrupts(struct ali_ircc_cb *self , unsigned char enable);
142 * Function ali_ircc_init () 142 * Function ali_ircc_init ()
143 * 143 *
144 * Initialize chip. Find out whay kinds of chips we are dealing with 144 * Initialize chip. Find out whay kinds of chips we are dealing with
145 * and their configuation registers address 145 * and their configuration registers address
146 */ 146 */
147static int __init ali_ircc_init(void) 147static int __init ali_ircc_init(void)
148{ 148{
@@ -1108,7 +1108,7 @@ static void ali_ircc_sir_change_speed(struct ali_ircc_cb *priv, __u32 speed)
1108 outb(lcr, iobase+UART_LCR); /* Set 8N1 */ 1108 outb(lcr, iobase+UART_LCR); /* Set 8N1 */
1109 outb(fcr, iobase+UART_FCR); /* Enable FIFO's */ 1109 outb(fcr, iobase+UART_FCR); /* Enable FIFO's */
1110 1110
1111 /* without this, the conection will be broken after come back from FIR speed, 1111 /* without this, the connection will be broken after come back from FIR speed,
1112 but with this, the SIR connection is harder to established */ 1112 but with this, the SIR connection is harder to established */
1113 outb((UART_MCR_DTR | UART_MCR_RTS | UART_MCR_OUT2), iobase+UART_MCR); 1113 outb((UART_MCR_DTR | UART_MCR_RTS | UART_MCR_OUT2), iobase+UART_MCR);
1114 1114
@@ -1800,7 +1800,7 @@ static int ali_ircc_dma_receive_complete(struct ali_ircc_cb *self)
1800 MessageCount = inb(iobase+ FIR_LSR)&0x07; 1800 MessageCount = inb(iobase+ FIR_LSR)&0x07;
1801 1801
1802 if (MessageCount > 0) 1802 if (MessageCount > 0)
1803 IRDA_DEBUG(0, "%s(), Messsage count = %d,\n", __func__ , MessageCount); 1803 IRDA_DEBUG(0, "%s(), Message count = %d,\n", __func__ , MessageCount);
1804 1804
1805 for (i=0; i<=MessageCount; i++) 1805 for (i=0; i<=MessageCount; i++)
1806 { 1806 {
diff --git a/drivers/net/irda/bfin_sir.c b/drivers/net/irda/bfin_sir.c
index f940dfa1f7f8..9d4ce1aba10c 100644
--- a/drivers/net/irda/bfin_sir.c
+++ b/drivers/net/irda/bfin_sir.c
@@ -67,27 +67,27 @@ static void bfin_sir_stop_tx(struct bfin_sir_port *port)
67 disable_dma(port->tx_dma_channel); 67 disable_dma(port->tx_dma_channel);
68#endif 68#endif
69 69
70 while (!(SIR_UART_GET_LSR(port) & THRE)) { 70 while (!(UART_GET_LSR(port) & THRE)) {
71 cpu_relax(); 71 cpu_relax();
72 continue; 72 continue;
73 } 73 }
74 74
75 SIR_UART_STOP_TX(port); 75 UART_CLEAR_IER(port, ETBEI);
76} 76}
77 77
78static void bfin_sir_enable_tx(struct bfin_sir_port *port) 78static void bfin_sir_enable_tx(struct bfin_sir_port *port)
79{ 79{
80 SIR_UART_ENABLE_TX(port); 80 UART_SET_IER(port, ETBEI);
81} 81}
82 82
83static void bfin_sir_stop_rx(struct bfin_sir_port *port) 83static void bfin_sir_stop_rx(struct bfin_sir_port *port)
84{ 84{
85 SIR_UART_STOP_RX(port); 85 UART_CLEAR_IER(port, ERBFI);
86} 86}
87 87
88static void bfin_sir_enable_rx(struct bfin_sir_port *port) 88static void bfin_sir_enable_rx(struct bfin_sir_port *port)
89{ 89{
90 SIR_UART_ENABLE_RX(port); 90 UART_SET_IER(port, ERBFI);
91} 91}
92 92
93static int bfin_sir_set_speed(struct bfin_sir_port *port, int speed) 93static int bfin_sir_set_speed(struct bfin_sir_port *port, int speed)
@@ -116,7 +116,7 @@ static int bfin_sir_set_speed(struct bfin_sir_port *port, int speed)
116 116
117 do { 117 do {
118 udelay(utime); 118 udelay(utime);
119 lsr = SIR_UART_GET_LSR(port); 119 lsr = UART_GET_LSR(port);
120 } while (!(lsr & TEMT) && count--); 120 } while (!(lsr & TEMT) && count--);
121 121
122 /* The useconds for 1 bits to transmit */ 122 /* The useconds for 1 bits to transmit */
@@ -125,27 +125,27 @@ static int bfin_sir_set_speed(struct bfin_sir_port *port, int speed)
125 /* Clear UCEN bit to reset the UART state machine 125 /* Clear UCEN bit to reset the UART state machine
126 * and control registers 126 * and control registers
127 */ 127 */
128 val = SIR_UART_GET_GCTL(port); 128 val = UART_GET_GCTL(port);
129 val &= ~UCEN; 129 val &= ~UCEN;
130 SIR_UART_PUT_GCTL(port, val); 130 UART_PUT_GCTL(port, val);
131 131
132 /* Set DLAB in LCR to Access THR RBR IER */ 132 /* Set DLAB in LCR to Access THR RBR IER */
133 SIR_UART_SET_DLAB(port); 133 UART_SET_DLAB(port);
134 SSYNC(); 134 SSYNC();
135 135
136 SIR_UART_PUT_DLL(port, quot & 0xFF); 136 UART_PUT_DLL(port, quot & 0xFF);
137 SIR_UART_PUT_DLH(port, (quot >> 8) & 0xFF); 137 UART_PUT_DLH(port, (quot >> 8) & 0xFF);
138 SSYNC(); 138 SSYNC();
139 139
140 /* Clear DLAB in LCR */ 140 /* Clear DLAB in LCR */
141 SIR_UART_CLEAR_DLAB(port); 141 UART_CLEAR_DLAB(port);
142 SSYNC(); 142 SSYNC();
143 143
144 SIR_UART_PUT_LCR(port, lcr); 144 UART_PUT_LCR(port, lcr);
145 145
146 val = SIR_UART_GET_GCTL(port); 146 val = UART_GET_GCTL(port);
147 val |= UCEN; 147 val |= UCEN;
148 SIR_UART_PUT_GCTL(port, val); 148 UART_PUT_GCTL(port, val);
149 149
150 ret = 0; 150 ret = 0;
151 break; 151 break;
@@ -154,12 +154,12 @@ static int bfin_sir_set_speed(struct bfin_sir_port *port, int speed)
154 break; 154 break;
155 } 155 }
156 156
157 val = SIR_UART_GET_GCTL(port); 157 val = UART_GET_GCTL(port);
158 /* If not add the 'RPOLC', we can't catch the receive interrupt. 158 /* If not add the 'RPOLC', we can't catch the receive interrupt.
159 * It's related with the HW layout and the IR transiver. 159 * It's related with the HW layout and the IR transiver.
160 */ 160 */
161 val |= IREN | RPOLC; 161 val |= IREN | RPOLC;
162 SIR_UART_PUT_GCTL(port, val); 162 UART_PUT_GCTL(port, val);
163 return ret; 163 return ret;
164} 164}
165 165
@@ -168,7 +168,7 @@ static int bfin_sir_is_receiving(struct net_device *dev)
168 struct bfin_sir_self *self = netdev_priv(dev); 168 struct bfin_sir_self *self = netdev_priv(dev);
169 struct bfin_sir_port *port = self->sir_port; 169 struct bfin_sir_port *port = self->sir_port;
170 170
171 if (!(SIR_UART_GET_IER(port) & ERBFI)) 171 if (!(UART_GET_IER(port) & ERBFI))
172 return 0; 172 return 0;
173 return self->rx_buff.state != OUTSIDE_FRAME; 173 return self->rx_buff.state != OUTSIDE_FRAME;
174} 174}
@@ -182,7 +182,7 @@ static void bfin_sir_tx_chars(struct net_device *dev)
182 182
183 if (self->tx_buff.len != 0) { 183 if (self->tx_buff.len != 0) {
184 chr = *(self->tx_buff.data); 184 chr = *(self->tx_buff.data);
185 SIR_UART_PUT_CHAR(port, chr); 185 UART_PUT_CHAR(port, chr);
186 self->tx_buff.data++; 186 self->tx_buff.data++;
187 self->tx_buff.len--; 187 self->tx_buff.len--;
188 } else { 188 } else {
@@ -206,8 +206,8 @@ static void bfin_sir_rx_chars(struct net_device *dev)
206 struct bfin_sir_port *port = self->sir_port; 206 struct bfin_sir_port *port = self->sir_port;
207 unsigned char ch; 207 unsigned char ch;
208 208
209 SIR_UART_CLEAR_LSR(port); 209 UART_CLEAR_LSR(port);
210 ch = SIR_UART_GET_CHAR(port); 210 ch = UART_GET_CHAR(port);
211 async_unwrap_char(dev, &self->stats, &self->rx_buff, ch); 211 async_unwrap_char(dev, &self->stats, &self->rx_buff, ch);
212 dev->last_rx = jiffies; 212 dev->last_rx = jiffies;
213} 213}
@@ -219,7 +219,7 @@ static irqreturn_t bfin_sir_rx_int(int irq, void *dev_id)
219 struct bfin_sir_port *port = self->sir_port; 219 struct bfin_sir_port *port = self->sir_port;
220 220
221 spin_lock(&self->lock); 221 spin_lock(&self->lock);
222 while ((SIR_UART_GET_LSR(port) & DR)) 222 while ((UART_GET_LSR(port) & DR))
223 bfin_sir_rx_chars(dev); 223 bfin_sir_rx_chars(dev);
224 spin_unlock(&self->lock); 224 spin_unlock(&self->lock);
225 225
@@ -233,7 +233,7 @@ static irqreturn_t bfin_sir_tx_int(int irq, void *dev_id)
233 struct bfin_sir_port *port = self->sir_port; 233 struct bfin_sir_port *port = self->sir_port;
234 234
235 spin_lock(&self->lock); 235 spin_lock(&self->lock);
236 if (SIR_UART_GET_LSR(port) & THRE) 236 if (UART_GET_LSR(port) & THRE)
237 bfin_sir_tx_chars(dev); 237 bfin_sir_tx_chars(dev);
238 spin_unlock(&self->lock); 238 spin_unlock(&self->lock);
239 239
@@ -312,7 +312,7 @@ static void bfin_sir_dma_rx_chars(struct net_device *dev)
312 struct bfin_sir_port *port = self->sir_port; 312 struct bfin_sir_port *port = self->sir_port;
313 int i; 313 int i;
314 314
315 SIR_UART_CLEAR_LSR(port); 315 UART_CLEAR_LSR(port);
316 316
317 for (i = port->rx_dma_buf.head; i < port->rx_dma_buf.tail; i++) 317 for (i = port->rx_dma_buf.head; i < port->rx_dma_buf.tail; i++)
318 async_unwrap_char(dev, &self->stats, &self->rx_buff, port->rx_dma_buf.buf[i]); 318 async_unwrap_char(dev, &self->stats, &self->rx_buff, port->rx_dma_buf.buf[i]);
@@ -430,11 +430,10 @@ static void bfin_sir_shutdown(struct bfin_sir_port *port, struct net_device *dev
430 unsigned short val; 430 unsigned short val;
431 431
432 bfin_sir_stop_rx(port); 432 bfin_sir_stop_rx(port);
433 SIR_UART_DISABLE_INTS(port);
434 433
435 val = SIR_UART_GET_GCTL(port); 434 val = UART_GET_GCTL(port);
436 val &= ~(UCEN | IREN | RPOLC); 435 val &= ~(UCEN | IREN | RPOLC);
437 SIR_UART_PUT_GCTL(port, val); 436 UART_PUT_GCTL(port, val);
438 437
439#ifdef CONFIG_SIR_BFIN_DMA 438#ifdef CONFIG_SIR_BFIN_DMA
440 disable_dma(port->tx_dma_channel); 439 disable_dma(port->tx_dma_channel);
@@ -518,12 +517,12 @@ static void bfin_sir_send_work(struct work_struct *work)
518 * sending data. We also can set the speed, which will 517 * sending data. We also can set the speed, which will
519 * reset all the UART. 518 * reset all the UART.
520 */ 519 */
521 val = SIR_UART_GET_GCTL(port); 520 val = UART_GET_GCTL(port);
522 val &= ~(IREN | RPOLC); 521 val &= ~(IREN | RPOLC);
523 SIR_UART_PUT_GCTL(port, val); 522 UART_PUT_GCTL(port, val);
524 SSYNC(); 523 SSYNC();
525 val |= IREN | RPOLC; 524 val |= IREN | RPOLC;
526 SIR_UART_PUT_GCTL(port, val); 525 UART_PUT_GCTL(port, val);
527 SSYNC(); 526 SSYNC();
528 /* bfin_sir_set_speed(port, self->speed); */ 527 /* bfin_sir_set_speed(port, self->speed); */
529 528
diff --git a/drivers/net/irda/bfin_sir.h b/drivers/net/irda/bfin_sir.h
index b54a6f08db45..29cbde8501ed 100644
--- a/drivers/net/irda/bfin_sir.h
+++ b/drivers/net/irda/bfin_sir.h
@@ -26,6 +26,7 @@
26#include <asm/cacheflush.h> 26#include <asm/cacheflush.h>
27#include <asm/dma.h> 27#include <asm/dma.h>
28#include <asm/portmux.h> 28#include <asm/portmux.h>
29#undef DRIVER_NAME
29 30
30#ifdef CONFIG_SIR_BFIN_DMA 31#ifdef CONFIG_SIR_BFIN_DMA
31struct dma_rx_buf { 32struct dma_rx_buf {
@@ -81,64 +82,10 @@ struct bfin_sir_self {
81 82
82#define DRIVER_NAME "bfin_sir" 83#define DRIVER_NAME "bfin_sir"
83 84
84#define SIR_UART_GET_CHAR(port) bfin_read16((port)->membase + OFFSET_RBR) 85#define port_membase(port) (((struct bfin_sir_port *)(port))->membase)
85#define SIR_UART_GET_DLL(port) bfin_read16((port)->membase + OFFSET_DLL) 86#define get_lsr_cache(port) (((struct bfin_sir_port *)(port))->lsr)
86#define SIR_UART_GET_DLH(port) bfin_read16((port)->membase + OFFSET_DLH) 87#define put_lsr_cache(port, v) (((struct bfin_sir_port *)(port))->lsr = (v))
87#define SIR_UART_GET_LCR(port) bfin_read16((port)->membase + OFFSET_LCR) 88#include <asm/bfin_serial.h>
88#define SIR_UART_GET_GCTL(port) bfin_read16((port)->membase + OFFSET_GCTL)
89
90#define SIR_UART_PUT_CHAR(port, v) bfin_write16(((port)->membase + OFFSET_THR), v)
91#define SIR_UART_PUT_DLL(port, v) bfin_write16(((port)->membase + OFFSET_DLL), v)
92#define SIR_UART_PUT_DLH(port, v) bfin_write16(((port)->membase + OFFSET_DLH), v)
93#define SIR_UART_PUT_LCR(port, v) bfin_write16(((port)->membase + OFFSET_LCR), v)
94#define SIR_UART_PUT_GCTL(port, v) bfin_write16(((port)->membase + OFFSET_GCTL), v)
95
96#ifdef CONFIG_BF54x
97#define SIR_UART_GET_LSR(port) bfin_read16((port)->membase + OFFSET_LSR)
98#define SIR_UART_GET_IER(port) bfin_read16((port)->membase + OFFSET_IER_SET)
99#define SIR_UART_SET_IER(port, v) bfin_write16(((port)->membase + OFFSET_IER_SET), v)
100#define SIR_UART_CLEAR_IER(port, v) bfin_write16(((port)->membase + OFFSET_IER_CLEAR), v)
101#define SIR_UART_PUT_LSR(port, v) bfin_write16(((port)->membase + OFFSET_LSR), v)
102#define SIR_UART_CLEAR_LSR(port) bfin_write16(((port)->membase + OFFSET_LSR), -1)
103
104#define SIR_UART_SET_DLAB(port)
105#define SIR_UART_CLEAR_DLAB(port)
106
107#define SIR_UART_ENABLE_INTS(port, v) SIR_UART_SET_IER(port, v)
108#define SIR_UART_DISABLE_INTS(port) SIR_UART_CLEAR_IER(port, 0xF)
109#define SIR_UART_STOP_TX(port) do { SIR_UART_PUT_LSR(port, TFI); SIR_UART_CLEAR_IER(port, ETBEI); } while (0)
110#define SIR_UART_ENABLE_TX(port) do { SIR_UART_SET_IER(port, ETBEI); } while (0)
111#define SIR_UART_STOP_RX(port) do { SIR_UART_CLEAR_IER(port, ERBFI); } while (0)
112#define SIR_UART_ENABLE_RX(port) do { SIR_UART_SET_IER(port, ERBFI); } while (0)
113#else
114
115#define SIR_UART_GET_IIR(port) bfin_read16((port)->membase + OFFSET_IIR)
116#define SIR_UART_GET_IER(port) bfin_read16((port)->membase + OFFSET_IER)
117#define SIR_UART_PUT_IER(port, v) bfin_write16(((port)->membase + OFFSET_IER), v)
118
119#define SIR_UART_SET_DLAB(port) do { SIR_UART_PUT_LCR(port, SIR_UART_GET_LCR(port) | DLAB); } while (0)
120#define SIR_UART_CLEAR_DLAB(port) do { SIR_UART_PUT_LCR(port, SIR_UART_GET_LCR(port) & ~DLAB); } while (0)
121
122#define SIR_UART_ENABLE_INTS(port, v) SIR_UART_PUT_IER(port, v)
123#define SIR_UART_DISABLE_INTS(port) SIR_UART_PUT_IER(port, 0)
124#define SIR_UART_STOP_TX(port) do { SIR_UART_PUT_IER(port, SIR_UART_GET_IER(port) & ~ETBEI); } while (0)
125#define SIR_UART_ENABLE_TX(port) do { SIR_UART_PUT_IER(port, SIR_UART_GET_IER(port) | ETBEI); } while (0)
126#define SIR_UART_STOP_RX(port) do { SIR_UART_PUT_IER(port, SIR_UART_GET_IER(port) & ~ERBFI); } while (0)
127#define SIR_UART_ENABLE_RX(port) do { SIR_UART_PUT_IER(port, SIR_UART_GET_IER(port) | ERBFI); } while (0)
128
129static inline unsigned int SIR_UART_GET_LSR(struct bfin_sir_port *port)
130{
131 unsigned int lsr = bfin_read16(port->membase + OFFSET_LSR);
132 port->lsr |= (lsr & (BI|FE|PE|OE));
133 return lsr | port->lsr;
134}
135
136static inline void SIR_UART_CLEAR_LSR(struct bfin_sir_port *port)
137{
138 port->lsr = 0;
139 bfin_read16(port->membase + OFFSET_LSR);
140}
141#endif
142 89
143static const unsigned short per[][4] = { 90static const unsigned short per[][4] = {
144 /* rx pin tx pin NULL uart_number */ 91 /* rx pin tx pin NULL uart_number */
diff --git a/drivers/net/irda/donauboe.c b/drivers/net/irda/donauboe.c
index 48bd5ec9f29b..174cafad2c1a 100644
--- a/drivers/net/irda/donauboe.c
+++ b/drivers/net/irda/donauboe.c
@@ -56,7 +56,7 @@
56/* do_probe module parameter Enable this code */ 56/* do_probe module parameter Enable this code */
57/* Probe code is very useful for understanding how the hardware works */ 57/* Probe code is very useful for understanding how the hardware works */
58/* Use it with various combinations of TT_LEN, RX_LEN */ 58/* Use it with various combinations of TT_LEN, RX_LEN */
59/* Strongly recomended, disable if the probe fails on your machine */ 59/* Strongly recommended, disable if the probe fails on your machine */
60/* and send me <james@fishsoup.dhs.org> the output of dmesg */ 60/* and send me <james@fishsoup.dhs.org> the output of dmesg */
61#define USE_PROBE 1 61#define USE_PROBE 1
62#undef USE_PROBE 62#undef USE_PROBE
@@ -217,7 +217,7 @@ toshoboe_checkfcs (unsigned char *buf, int len)
217 for (i = 0; i < len; ++i) 217 for (i = 0; i < len; ++i)
218 fcs.value = irda_fcs (fcs.value, *(buf++)); 218 fcs.value = irda_fcs (fcs.value, *(buf++));
219 219
220 return (fcs.value == GOOD_FCS); 220 return fcs.value == GOOD_FCS;
221} 221}
222 222
223/***********************************************************************/ 223/***********************************************************************/
@@ -759,7 +759,7 @@ toshoboe_maketestpacket (unsigned char *buf, int badcrc, int fir)
759 if (fir) 759 if (fir)
760 { 760 {
761 memset (buf, 0, TT_LEN); 761 memset (buf, 0, TT_LEN);
762 return (TT_LEN); 762 return TT_LEN;
763 } 763 }
764 764
765 fcs.value = INIT_FCS; 765 fcs.value = INIT_FCS;
@@ -818,9 +818,9 @@ toshoboe_probe (struct toshoboe_cb *self)
818{ 818{
819 int i, j, n; 819 int i, j, n;
820#ifdef USE_MIR 820#ifdef USE_MIR
821 int bauds[] = { 9600, 115200, 4000000, 1152000 }; 821 static const int bauds[] = { 9600, 115200, 4000000, 1152000 };
822#else 822#else
823 int bauds[] = { 9600, 115200, 4000000 }; 823 static const int bauds[] = { 9600, 115200, 4000000 };
824#endif 824#endif
825 unsigned long flags; 825 unsigned long flags;
826 826
diff --git a/drivers/net/irda/donauboe.h b/drivers/net/irda/donauboe.h
index 36c3060411d2..d92d54e839b9 100644
--- a/drivers/net/irda/donauboe.h
+++ b/drivers/net/irda/donauboe.h
@@ -30,7 +30,7 @@
30 * or the type-DO IR port. 30 * or the type-DO IR port.
31 * 31 *
32 * IrDA chip set list from Toshiba Computer Engineering Corp. 32 * IrDA chip set list from Toshiba Computer Engineering Corp.
33 * model method maker controler Version 33 * model method maker controller Version
34 * Portege 320CT FIR,SIR Toshiba Oboe(Triangle) 34 * Portege 320CT FIR,SIR Toshiba Oboe(Triangle)
35 * Portege 3010CT FIR,SIR Toshiba Oboe(Sydney) 35 * Portege 3010CT FIR,SIR Toshiba Oboe(Sydney)
36 * Portege 3015CT FIR,SIR Toshiba Oboe(Sydney) 36 * Portege 3015CT FIR,SIR Toshiba Oboe(Sydney)
@@ -51,10 +51,10 @@
51 51
52/* The documentation for this chip is allegedly released */ 52/* The documentation for this chip is allegedly released */
53/* However I have not seen it, not have I managed to contact */ 53/* However I have not seen it, not have I managed to contact */
54/* anyone who has. HOWEVER the chip bears a striking resemblence */ 54/* anyone who has. HOWEVER the chip bears a striking resemblance */
55/* to the IrDA controller in the Toshiba RISC TMPR3922 chip */ 55/* to the IrDA controller in the Toshiba RISC TMPR3922 chip */
56/* the documentation for this is freely available at */ 56/* the documentation for this is freely available at */
57/* http://www.toshiba.com/taec/components/Generic/TMPR3922.shtml */ 57/* http://www.madingley.org/james/resources/toshoboe/TMPR3922.pdf */
58/* The mapping between the registers in that document and the */ 58/* The mapping between the registers in that document and the */
59/* Registers in the 701 oboe chip are as follows */ 59/* Registers in the 701 oboe chip are as follows */
60 60
diff --git a/drivers/net/irda/girbil-sir.c b/drivers/net/irda/girbil-sir.c
index a31b8fa8aaa9..96cdecff349d 100644
--- a/drivers/net/irda/girbil-sir.c
+++ b/drivers/net/irda/girbil-sir.c
@@ -38,7 +38,7 @@ static int girbil_change_speed(struct sir_dev *dev, unsigned speed);
38/* Control register 1 */ 38/* Control register 1 */
39#define GIRBIL_TXEN 0x01 /* Enable transmitter */ 39#define GIRBIL_TXEN 0x01 /* Enable transmitter */
40#define GIRBIL_RXEN 0x02 /* Enable receiver */ 40#define GIRBIL_RXEN 0x02 /* Enable receiver */
41#define GIRBIL_ECAN 0x04 /* Cancel self emmited data */ 41#define GIRBIL_ECAN 0x04 /* Cancel self emitted data */
42#define GIRBIL_ECHO 0x08 /* Echo control characters */ 42#define GIRBIL_ECHO 0x08 /* Echo control characters */
43 43
44/* LED Current Register (0x2) */ 44/* LED Current Register (0x2) */
diff --git a/drivers/net/irda/irda-usb.c b/drivers/net/irda/irda-usb.c
index 4441fa3389c2..d9267cb98a23 100644
--- a/drivers/net/irda/irda-usb.c
+++ b/drivers/net/irda/irda-usb.c
@@ -370,7 +370,7 @@ static void speed_bulk_callback(struct urb *urb)
370 /* urb is now available */ 370 /* urb is now available */
371 //urb->status = 0; -> tested above 371 //urb->status = 0; -> tested above
372 372
373 /* New speed and xbof is now commited in hardware */ 373 /* New speed and xbof is now committed in hardware */
374 self->new_speed = -1; 374 self->new_speed = -1;
375 self->new_xbofs = -1; 375 self->new_xbofs = -1;
376 376
@@ -602,7 +602,7 @@ static void write_bulk_callback(struct urb *urb)
602 IRDA_DEBUG(1, "%s(), Changing speed now...\n", __func__); 602 IRDA_DEBUG(1, "%s(), Changing speed now...\n", __func__);
603 irda_usb_change_speed_xbofs(self); 603 irda_usb_change_speed_xbofs(self);
604 } else { 604 } else {
605 /* New speed and xbof is now commited in hardware */ 605 /* New speed and xbof is now committed in hardware */
606 self->new_speed = -1; 606 self->new_speed = -1;
607 self->new_xbofs = -1; 607 self->new_xbofs = -1;
608 /* Done, waiting for next packet */ 608 /* Done, waiting for next packet */
@@ -1124,11 +1124,11 @@ static int stir421x_patch_device(struct irda_usb_cb *self)
1124 * The actual image starts after the "STMP" keyword 1124 * The actual image starts after the "STMP" keyword
1125 * so forward to the firmware header tag 1125 * so forward to the firmware header tag
1126 */ 1126 */
1127 for (i = 0; (fw->data[i] != STIR421X_PATCH_END_OF_HDR_TAG) && 1127 for (i = 0; i < fw->size && fw->data[i] !=
1128 (i < fw->size); i++) ; 1128 STIR421X_PATCH_END_OF_HDR_TAG; i++) ;
1129 /* here we check for the out of buffer case */ 1129 /* here we check for the out of buffer case */
1130 if ((STIR421X_PATCH_END_OF_HDR_TAG == fw->data[i]) && 1130 if (i < STIR421X_PATCH_CODE_OFFSET && i < fw->size &&
1131 (i < STIR421X_PATCH_CODE_OFFSET)) { 1131 STIR421X_PATCH_END_OF_HDR_TAG == fw->data[i]) {
1132 if (!memcmp(fw->data + i + 1, STIR421X_PATCH_STMP_TAG, 1132 if (!memcmp(fw->data + i + 1, STIR421X_PATCH_STMP_TAG,
1133 sizeof(STIR421X_PATCH_STMP_TAG) - 1)) { 1133 sizeof(STIR421X_PATCH_STMP_TAG) - 1)) {
1134 1134
@@ -1514,7 +1514,7 @@ static inline int irda_usb_parse_endpoints(struct irda_usb_cb *self, struct usb_
1514 IRDA_DEBUG(0, "%s(), And our endpoints are : in=%02X, out=%02X (%d), int=%02X\n", 1514 IRDA_DEBUG(0, "%s(), And our endpoints are : in=%02X, out=%02X (%d), int=%02X\n",
1515 __func__, self->bulk_in_ep, self->bulk_out_ep, self->bulk_out_mtu, self->bulk_int_ep); 1515 __func__, self->bulk_in_ep, self->bulk_out_ep, self->bulk_out_mtu, self->bulk_int_ep);
1516 1516
1517 return((self->bulk_in_ep != 0) && (self->bulk_out_ep != 0)); 1517 return (self->bulk_in_ep != 0) && (self->bulk_out_ep != 0);
1518} 1518}
1519 1519
1520#ifdef IU_DUMP_CLASS_DESC 1520#ifdef IU_DUMP_CLASS_DESC
diff --git a/drivers/net/irda/irtty-sir.c b/drivers/net/irda/irtty-sir.c
index ee1dde52e8fc..3352b2443e58 100644
--- a/drivers/net/irda/irtty-sir.c
+++ b/drivers/net/irda/irtty-sir.c
@@ -167,7 +167,7 @@ static int irtty_set_dtr_rts(struct sir_dev *dev, int dtr, int rts)
167 * let's be careful... Jean II 167 * let's be careful... Jean II
168 */ 168 */
169 IRDA_ASSERT(priv->tty->ops->tiocmset != NULL, return -1;); 169 IRDA_ASSERT(priv->tty->ops->tiocmset != NULL, return -1;);
170 priv->tty->ops->tiocmset(priv->tty, NULL, set, clear); 170 priv->tty->ops->tiocmset(priv->tty, set, clear);
171 171
172 return 0; 172 return 0;
173} 173}
diff --git a/drivers/net/irda/mcs7780.c b/drivers/net/irda/mcs7780.c
index 5b1036ac38d7..be52bfed66a9 100644
--- a/drivers/net/irda/mcs7780.c
+++ b/drivers/net/irda/mcs7780.c
@@ -588,7 +588,7 @@ static int mcs_speed_change(struct mcs_cb *mcs)
588 588
589 mcs_get_reg(mcs, MCS_MODE_REG, &rval); 589 mcs_get_reg(mcs, MCS_MODE_REG, &rval);
590 590
591 /* MINRXPW values recomended by MosChip */ 591 /* MINRXPW values recommended by MosChip */
592 if (mcs->new_speed <= 115200) { 592 if (mcs->new_speed <= 115200) {
593 rval &= ~MCS_FIR; 593 rval &= ~MCS_FIR;
594 594
@@ -734,7 +734,7 @@ static int mcs_net_open(struct net_device *netdev)
734 } 734 }
735 735
736 if (!mcs_setup_urbs(mcs)) 736 if (!mcs_setup_urbs(mcs))
737 goto error3; 737 goto error3;
738 738
739 ret = mcs_receive_start(mcs); 739 ret = mcs_receive_start(mcs);
740 if (ret) 740 if (ret)
@@ -799,7 +799,7 @@ static void mcs_receive_irq(struct urb *urb)
799 ret = usb_submit_urb(urb, GFP_ATOMIC); 799 ret = usb_submit_urb(urb, GFP_ATOMIC);
800} 800}
801 801
802/* Transmit callback funtion. */ 802/* Transmit callback function. */
803static void mcs_send_irq(struct urb *urb) 803static void mcs_send_irq(struct urb *urb)
804{ 804{
805 struct mcs_cb *mcs = urb->context; 805 struct mcs_cb *mcs = urb->context;
@@ -811,7 +811,7 @@ static void mcs_send_irq(struct urb *urb)
811 netif_wake_queue(ndev); 811 netif_wake_queue(ndev);
812} 812}
813 813
814/* Transmit callback funtion. */ 814/* Transmit callback function. */
815static netdev_tx_t mcs_hard_xmit(struct sk_buff *skb, 815static netdev_tx_t mcs_hard_xmit(struct sk_buff *skb,
816 struct net_device *ndev) 816 struct net_device *ndev)
817{ 817{
@@ -959,7 +959,7 @@ static void mcs_disconnect(struct usb_interface *intf)
959 if (!mcs) 959 if (!mcs)
960 return; 960 return;
961 961
962 flush_scheduled_work(); 962 cancel_work_sync(&mcs->work);
963 963
964 unregister_netdev(mcs->netdev); 964 unregister_netdev(mcs->netdev);
965 free_netdev(mcs->netdev); 965 free_netdev(mcs->netdev);
diff --git a/drivers/net/irda/nsc-ircc.c b/drivers/net/irda/nsc-ircc.c
index e30cdbb14745..7a963d4e6d06 100644
--- a/drivers/net/irda/nsc-ircc.c
+++ b/drivers/net/irda/nsc-ircc.c
@@ -716,7 +716,7 @@ static int nsc_ircc_probe_338(nsc_chip_t *chip, chipio_t *info)
716 int reg, com = 0; 716 int reg, com = 0;
717 int pnp; 717 int pnp;
718 718
719 /* Read funtion enable register (FER) */ 719 /* Read function enable register (FER) */
720 outb(CFG_338_FER, cfg_base); 720 outb(CFG_338_FER, cfg_base);
721 reg = inb(cfg_base+1); 721 reg = inb(cfg_base+1);
722 722
@@ -1348,7 +1348,7 @@ static __u8 nsc_ircc_change_speed(struct nsc_ircc_cb *self, __u32 speed)
1348 outb(bank, iobase+BSR); 1348 outb(bank, iobase+BSR);
1349 1349
1350 /* Make sure interrupt handlers keep the proper interrupt mask */ 1350 /* Make sure interrupt handlers keep the proper interrupt mask */
1351 return(ier); 1351 return ier;
1352} 1352}
1353 1353
1354/* 1354/*
diff --git a/drivers/net/irda/nsc-ircc.h b/drivers/net/irda/nsc-ircc.h
index 7ba7738759b9..32fa58211fad 100644
--- a/drivers/net/irda/nsc-ircc.h
+++ b/drivers/net/irda/nsc-ircc.h
@@ -135,7 +135,7 @@
135#define LSR_TXRDY 0x20 /* Transmitter ready */ 135#define LSR_TXRDY 0x20 /* Transmitter ready */
136#define LSR_TXEMP 0x40 /* Transmitter empty */ 136#define LSR_TXEMP 0x40 /* Transmitter empty */
137 137
138#define ASCR 0x07 /* Auxillary Status and Control Register */ 138#define ASCR 0x07 /* Auxiliary Status and Control Register */
139#define ASCR_RXF_TOUT 0x01 /* Rx FIFO timeout */ 139#define ASCR_RXF_TOUT 0x01 /* Rx FIFO timeout */
140#define ASCR_FEND_INF 0x02 /* Frame end bytes in rx FIFO */ 140#define ASCR_FEND_INF 0x02 /* Frame end bytes in rx FIFO */
141#define ASCR_S_EOT 0x04 /* Set end of transmission */ 141#define ASCR_S_EOT 0x04 /* Set end of transmission */
diff --git a/drivers/net/irda/pxaficp_ir.c b/drivers/net/irda/pxaficp_ir.c
index c192c31e4c5c..001ed0a255f6 100644
--- a/drivers/net/irda/pxaficp_ir.c
+++ b/drivers/net/irda/pxaficp_ir.c
@@ -40,7 +40,7 @@
40 40
41#define ICCR0_AME (1 << 7) /* Address match enable */ 41#define ICCR0_AME (1 << 7) /* Address match enable */
42#define ICCR0_TIE (1 << 6) /* Transmit FIFO interrupt enable */ 42#define ICCR0_TIE (1 << 6) /* Transmit FIFO interrupt enable */
43#define ICCR0_RIE (1 << 5) /* Recieve FIFO interrupt enable */ 43#define ICCR0_RIE (1 << 5) /* Receive FIFO interrupt enable */
44#define ICCR0_RXE (1 << 4) /* Receive enable */ 44#define ICCR0_RXE (1 << 4) /* Receive enable */
45#define ICCR0_TXE (1 << 3) /* Transmit enable */ 45#define ICCR0_TXE (1 << 3) /* Transmit enable */
46#define ICCR0_TUS (1 << 2) /* Transmit FIFO underrun select */ 46#define ICCR0_TUS (1 << 2) /* Transmit FIFO underrun select */
@@ -483,7 +483,7 @@ static irqreturn_t pxa_irda_fir_irq(int irq, void *dev_id)
483 } 483 }
484 484
485 if (icsr0 & ICSR0_EIF) { 485 if (icsr0 & ICSR0_EIF) {
486 /* An error in FIFO occured, or there is a end of frame */ 486 /* An error in FIFO occurred, or there is a end of frame */
487 pxa_irda_fir_irq_eif(si, dev, icsr0); 487 pxa_irda_fir_irq_eif(si, dev, icsr0);
488 } 488 }
489 489
diff --git a/drivers/net/irda/sh_irda.c b/drivers/net/irda/sh_irda.c
index 9e3f4f54281d..4488bd581eca 100644
--- a/drivers/net/irda/sh_irda.c
+++ b/drivers/net/irda/sh_irda.c
@@ -635,7 +635,7 @@ static int sh_irda_hard_xmit(struct sk_buff *skb, struct net_device *ndev)
635 635
636 ret = sh_irda_set_baudrate(self, speed); 636 ret = sh_irda_set_baudrate(self, speed);
637 if (ret < 0) 637 if (ret < 0)
638 return ret; 638 goto sh_irda_hard_xmit_end;
639 639
640 self->tx_buff.len = 0; 640 self->tx_buff.len = 0;
641 if (skb->len) { 641 if (skb->len) {
@@ -652,11 +652,21 @@ static int sh_irda_hard_xmit(struct sk_buff *skb, struct net_device *ndev)
652 652
653 sh_irda_write(self, IRTFLR, self->tx_buff.len); 653 sh_irda_write(self, IRTFLR, self->tx_buff.len);
654 sh_irda_write(self, IRTCTR, ARMOD | TE); 654 sh_irda_write(self, IRTCTR, ARMOD | TE);
655 } 655 } else
656 goto sh_irda_hard_xmit_end;
656 657
657 dev_kfree_skb(skb); 658 dev_kfree_skb(skb);
658 659
659 return 0; 660 return 0;
661
662sh_irda_hard_xmit_end:
663 sh_irda_set_baudrate(self, 9600);
664 netif_wake_queue(self->ndev);
665 sh_irda_rcv_ctrl(self, 1);
666 dev_kfree_skb(skb);
667
668 return ret;
669
660} 670}
661 671
662static int sh_irda_ioctl(struct net_device *ndev, struct ifreq *ifreq, int cmd) 672static int sh_irda_ioctl(struct net_device *ndev, struct ifreq *ifreq, int cmd)
diff --git a/drivers/net/irda/sh_sir.c b/drivers/net/irda/sh_sir.c
index 00b38bccd6d0..52a7c86af663 100644
--- a/drivers/net/irda/sh_sir.c
+++ b/drivers/net/irda/sh_sir.c
@@ -258,7 +258,7 @@ static int sh_sir_set_baudrate(struct sh_sir_self *self, u32 baudrate)
258 258
259 /* Baud Rate Error Correction x 10000 */ 259 /* Baud Rate Error Correction x 10000 */
260 u32 rate_err_array[] = { 260 u32 rate_err_array[] = {
261 0000, 0625, 1250, 1875, 261 0, 625, 1250, 1875,
262 2500, 3125, 3750, 4375, 262 2500, 3125, 3750, 4375,
263 5000, 5625, 6250, 6875, 263 5000, 5625, 6250, 6875,
264 7500, 8125, 8750, 9375, 264 7500, 8125, 8750, 9375,
diff --git a/drivers/net/irda/sir_dev.c b/drivers/net/irda/sir_dev.c
index 1b051dab7b29..efe05bb34dd8 100644
--- a/drivers/net/irda/sir_dev.c
+++ b/drivers/net/irda/sir_dev.c
@@ -336,7 +336,7 @@ static int sirdev_is_receiving(struct sir_dev *dev)
336 if (!atomic_read(&dev->enable_rx)) 336 if (!atomic_read(&dev->enable_rx))
337 return 0; 337 return 0;
338 338
339 return (dev->rx_buff.state != OUTSIDE_FRAME); 339 return dev->rx_buff.state != OUTSIDE_FRAME;
340} 340}
341 341
342int sirdev_set_dongle(struct sir_dev *dev, IRDA_DONGLE type) 342int sirdev_set_dongle(struct sir_dev *dev, IRDA_DONGLE type)
@@ -909,7 +909,7 @@ struct sir_dev * sirdev_get_instance(const struct sir_driver *drv, const char *n
909 dev->tx_skb = NULL; 909 dev->tx_skb = NULL;
910 910
911 spin_lock_init(&dev->tx_lock); 911 spin_lock_init(&dev->tx_lock);
912 init_MUTEX(&dev->fsm.sem); 912 sema_init(&dev->fsm.sem, 1);
913 913
914 dev->drv = drv; 914 dev->drv = drv;
915 dev->netdev = ndev; 915 dev->netdev = ndev;
diff --git a/drivers/net/irda/smsc-ircc2.c b/drivers/net/irda/smsc-ircc2.c
index 850ca1c5ee19..8800e1fe4129 100644
--- a/drivers/net/irda/smsc-ircc2.c
+++ b/drivers/net/irda/smsc-ircc2.c
@@ -376,7 +376,7 @@ MODULE_DEVICE_TABLE(pnp, smsc_ircc_pnp_table);
376static int pnp_driver_registered; 376static int pnp_driver_registered;
377 377
378#ifdef CONFIG_PNP 378#ifdef CONFIG_PNP
379static int __init smsc_ircc_pnp_probe(struct pnp_dev *dev, 379static int __devinit smsc_ircc_pnp_probe(struct pnp_dev *dev,
380 const struct pnp_device_id *dev_id) 380 const struct pnp_device_id *dev_id)
381{ 381{
382 unsigned int firbase, sirbase; 382 unsigned int firbase, sirbase;
@@ -1582,7 +1582,7 @@ static irqreturn_t smsc_ircc_interrupt_sir(struct net_device *dev)
1582 int iobase; 1582 int iobase;
1583 int iir, lsr; 1583 int iir, lsr;
1584 1584
1585 /* Already locked comming here in smsc_ircc_interrupt() */ 1585 /* Already locked coming here in smsc_ircc_interrupt() */
1586 /*spin_lock(&self->lock);*/ 1586 /*spin_lock(&self->lock);*/
1587 1587
1588 iobase = self->io.sir_base; 1588 iobase = self->io.sir_base;
@@ -2051,7 +2051,7 @@ static int smsc_ircc_sir_write(int iobase, int fifo_size, __u8 *buf, int len)
2051 */ 2051 */
2052static int smsc_ircc_is_receiving(struct smsc_ircc_cb *self) 2052static int smsc_ircc_is_receiving(struct smsc_ircc_cb *self)
2053{ 2053{
2054 return (self->rx_buff.state != OUTSIDE_FRAME); 2054 return self->rx_buff.state != OUTSIDE_FRAME;
2055} 2055}
2056 2056
2057 2057
diff --git a/drivers/net/irda/stir4200.c b/drivers/net/irda/stir4200.c
index e5698fa30a4f..41c96b3d8152 100644
--- a/drivers/net/irda/stir4200.c
+++ b/drivers/net/irda/stir4200.c
@@ -219,7 +219,7 @@ static inline int read_reg(struct stir_cb *stir, __u16 reg,
219 219
220static inline int isfir(u32 speed) 220static inline int isfir(u32 speed)
221{ 221{
222 return (speed == 4000000); 222 return speed == 4000000;
223} 223}
224 224
225/* 225/*
diff --git a/drivers/net/irda/via-ircc.c b/drivers/net/irda/via-ircc.c
index b0a6cd815be1..f504b262ba36 100644
--- a/drivers/net/irda/via-ircc.c
+++ b/drivers/net/irda/via-ircc.c
@@ -29,7 +29,7 @@ F02 Oct/28/02: Add SB device ID for 3147 and 3177.
29 29
302004-02-16: <sda@bdit.de> 302004-02-16: <sda@bdit.de>
31- Removed unneeded 'legacy' pci stuff. 31- Removed unneeded 'legacy' pci stuff.
32- Make sure SIR mode is set (hw_init()) before calling mode-dependant stuff. 32- Make sure SIR mode is set (hw_init()) before calling mode-dependent stuff.
33- On speed change from core, don't send SIR frame with new speed. 33- On speed change from core, don't send SIR frame with new speed.
34 Use current speed and change speeds later. 34 Use current speed and change speeds later.
35- Make module-param dongle_id actually work. 35- Make module-param dongle_id actually work.
@@ -75,15 +75,9 @@ static int dongle_id = 0; /* default: probe */
75/* We can't guess the type of connected dongle, user *must* supply it. */ 75/* We can't guess the type of connected dongle, user *must* supply it. */
76module_param(dongle_id, int, 0); 76module_param(dongle_id, int, 0);
77 77
78/* FIXME : we should not need this, because instances should be automatically
79 * managed by the PCI layer. Especially that we seem to only be using the
80 * first entry. Jean II */
81/* Max 4 instances for now */
82static struct via_ircc_cb *dev_self[] = { NULL, NULL, NULL, NULL };
83
84/* Some prototypes */ 78/* Some prototypes */
85static int via_ircc_open(int i, chipio_t * info, unsigned int id); 79static int via_ircc_open(struct pci_dev *pdev, chipio_t * info,
86static int via_ircc_close(struct via_ircc_cb *self); 80 unsigned int id);
87static int via_ircc_dma_receive(struct via_ircc_cb *self); 81static int via_ircc_dma_receive(struct via_ircc_cb *self);
88static int via_ircc_dma_receive_complete(struct via_ircc_cb *self, 82static int via_ircc_dma_receive_complete(struct via_ircc_cb *self,
89 int iobase); 83 int iobase);
@@ -215,7 +209,7 @@ static int __devinit via_init_one (struct pci_dev *pcidev, const struct pci_devi
215 pci_write_config_byte(pcidev,0x42,(bTmp | 0xf0)); 209 pci_write_config_byte(pcidev,0x42,(bTmp | 0xf0));
216 pci_write_config_byte(pcidev,0x5a,0xc0); 210 pci_write_config_byte(pcidev,0x5a,0xc0);
217 WriteLPCReg(0x28, 0x70 ); 211 WriteLPCReg(0x28, 0x70 );
218 if (via_ircc_open(0, &info,0x3076) == 0) 212 if (via_ircc_open(pcidev, &info, 0x3076) == 0)
219 rc=0; 213 rc=0;
220 } else 214 } else
221 rc = -ENODEV; //IR not turn on 215 rc = -ENODEV; //IR not turn on
@@ -254,7 +248,7 @@ static int __devinit via_init_one (struct pci_dev *pcidev, const struct pci_devi
254 info.irq=FirIRQ; 248 info.irq=FirIRQ;
255 info.dma=FirDRQ1; 249 info.dma=FirDRQ1;
256 info.dma2=FirDRQ0; 250 info.dma2=FirDRQ0;
257 if (via_ircc_open(0, &info,0x3096) == 0) 251 if (via_ircc_open(pcidev, &info, 0x3096) == 0)
258 rc=0; 252 rc=0;
259 } else 253 } else
260 rc = -ENODEV; //IR not turn on !!!!! 254 rc = -ENODEV; //IR not turn on !!!!!
@@ -264,48 +258,10 @@ static int __devinit via_init_one (struct pci_dev *pcidev, const struct pci_devi
264 return rc; 258 return rc;
265} 259}
266 260
267/*
268 * Function via_ircc_clean ()
269 *
270 * Close all configured chips
271 *
272 */
273static void via_ircc_clean(void)
274{
275 int i;
276
277 IRDA_DEBUG(3, "%s()\n", __func__);
278
279 for (i=0; i < ARRAY_SIZE(dev_self); i++) {
280 if (dev_self[i])
281 via_ircc_close(dev_self[i]);
282 }
283}
284
285static void __devexit via_remove_one (struct pci_dev *pdev)
286{
287 IRDA_DEBUG(3, "%s()\n", __func__);
288
289 /* FIXME : This is ugly. We should use pci_get_drvdata(pdev);
290 * to get our driver instance and call directly via_ircc_close().
291 * See vlsi_ir for details...
292 * Jean II */
293 via_ircc_clean();
294
295 /* FIXME : This should be in via_ircc_close(), because here we may
296 * theoritically disable still configured devices :-( - Jean II */
297 pci_disable_device(pdev);
298}
299
300static void __exit via_ircc_cleanup(void) 261static void __exit via_ircc_cleanup(void)
301{ 262{
302 IRDA_DEBUG(3, "%s()\n", __func__); 263 IRDA_DEBUG(3, "%s()\n", __func__);
303 264
304 /* FIXME : This should be redundant, as pci_unregister_driver()
305 * should call via_remove_one() on each device.
306 * Jean II */
307 via_ircc_clean();
308
309 /* Cleanup all instances of the driver */ 265 /* Cleanup all instances of the driver */
310 pci_unregister_driver (&via_driver); 266 pci_unregister_driver (&via_driver);
311} 267}
@@ -324,12 +280,13 @@ static const struct net_device_ops via_ircc_fir_ops = {
324}; 280};
325 281
326/* 282/*
327 * Function via_ircc_open (iobase, irq) 283 * Function via_ircc_open(pdev, iobase, irq)
328 * 284 *
329 * Open driver instance 285 * Open driver instance
330 * 286 *
331 */ 287 */
332static __devinit int via_ircc_open(int i, chipio_t * info, unsigned int id) 288static __devinit int via_ircc_open(struct pci_dev *pdev, chipio_t * info,
289 unsigned int id)
333{ 290{
334 struct net_device *dev; 291 struct net_device *dev;
335 struct via_ircc_cb *self; 292 struct via_ircc_cb *self;
@@ -337,9 +294,6 @@ static __devinit int via_ircc_open(int i, chipio_t * info, unsigned int id)
337 294
338 IRDA_DEBUG(3, "%s()\n", __func__); 295 IRDA_DEBUG(3, "%s()\n", __func__);
339 296
340 if (i >= ARRAY_SIZE(dev_self))
341 return -ENOMEM;
342
343 /* Allocate new instance of the driver */ 297 /* Allocate new instance of the driver */
344 dev = alloc_irdadev(sizeof(struct via_ircc_cb)); 298 dev = alloc_irdadev(sizeof(struct via_ircc_cb));
345 if (dev == NULL) 299 if (dev == NULL)
@@ -349,13 +303,8 @@ static __devinit int via_ircc_open(int i, chipio_t * info, unsigned int id)
349 self->netdev = dev; 303 self->netdev = dev;
350 spin_lock_init(&self->lock); 304 spin_lock_init(&self->lock);
351 305
352 /* FIXME : We should store our driver instance in the PCI layer, 306 pci_set_drvdata(pdev, self);
353 * using pci_set_drvdata(), not in this array. 307
354 * See vlsi_ir for details... - Jean II */
355 /* FIXME : 'i' is always 0 (see via_init_one()) :-( - Jean II */
356 /* Need to store self somewhere */
357 dev_self[i] = self;
358 self->index = i;
359 /* Initialize Resource */ 308 /* Initialize Resource */
360 self->io.cfg_base = info->cfg_base; 309 self->io.cfg_base = info->cfg_base;
361 self->io.fir_base = info->fir_base; 310 self->io.fir_base = info->fir_base;
@@ -385,7 +334,7 @@ static __devinit int via_ircc_open(int i, chipio_t * info, unsigned int id)
385 self->io.dongle_id = dongle_id; 334 self->io.dongle_id = dongle_id;
386 335
387 /* The only value we must override it the baudrate */ 336 /* The only value we must override it the baudrate */
388 /* Maximum speeds and capabilities are dongle-dependant. */ 337 /* Maximum speeds and capabilities are dongle-dependent. */
389 switch( self->io.dongle_id ){ 338 switch( self->io.dongle_id ){
390 case 0x0d: 339 case 0x0d:
391 self->qos.baud_rate.bits = 340 self->qos.baud_rate.bits =
@@ -414,7 +363,7 @@ static __devinit int via_ircc_open(int i, chipio_t * info, unsigned int id)
414 363
415 /* Allocate memory if needed */ 364 /* Allocate memory if needed */
416 self->rx_buff.head = 365 self->rx_buff.head =
417 dma_alloc_coherent(NULL, self->rx_buff.truesize, 366 dma_alloc_coherent(&pdev->dev, self->rx_buff.truesize,
418 &self->rx_buff_dma, GFP_KERNEL); 367 &self->rx_buff_dma, GFP_KERNEL);
419 if (self->rx_buff.head == NULL) { 368 if (self->rx_buff.head == NULL) {
420 err = -ENOMEM; 369 err = -ENOMEM;
@@ -423,7 +372,7 @@ static __devinit int via_ircc_open(int i, chipio_t * info, unsigned int id)
423 memset(self->rx_buff.head, 0, self->rx_buff.truesize); 372 memset(self->rx_buff.head, 0, self->rx_buff.truesize);
424 373
425 self->tx_buff.head = 374 self->tx_buff.head =
426 dma_alloc_coherent(NULL, self->tx_buff.truesize, 375 dma_alloc_coherent(&pdev->dev, self->tx_buff.truesize,
427 &self->tx_buff_dma, GFP_KERNEL); 376 &self->tx_buff_dma, GFP_KERNEL);
428 if (self->tx_buff.head == NULL) { 377 if (self->tx_buff.head == NULL) {
429 err = -ENOMEM; 378 err = -ENOMEM;
@@ -455,33 +404,32 @@ static __devinit int via_ircc_open(int i, chipio_t * info, unsigned int id)
455 via_hw_init(self); 404 via_hw_init(self);
456 return 0; 405 return 0;
457 err_out4: 406 err_out4:
458 dma_free_coherent(NULL, self->tx_buff.truesize, 407 dma_free_coherent(&pdev->dev, self->tx_buff.truesize,
459 self->tx_buff.head, self->tx_buff_dma); 408 self->tx_buff.head, self->tx_buff_dma);
460 err_out3: 409 err_out3:
461 dma_free_coherent(NULL, self->rx_buff.truesize, 410 dma_free_coherent(&pdev->dev, self->rx_buff.truesize,
462 self->rx_buff.head, self->rx_buff_dma); 411 self->rx_buff.head, self->rx_buff_dma);
463 err_out2: 412 err_out2:
464 release_region(self->io.fir_base, self->io.fir_ext); 413 release_region(self->io.fir_base, self->io.fir_ext);
465 err_out1: 414 err_out1:
415 pci_set_drvdata(pdev, NULL);
466 free_netdev(dev); 416 free_netdev(dev);
467 dev_self[i] = NULL;
468 return err; 417 return err;
469} 418}
470 419
471/* 420/*
472 * Function via_ircc_close (self) 421 * Function via_remove_one(pdev)
473 * 422 *
474 * Close driver instance 423 * Close driver instance
475 * 424 *
476 */ 425 */
477static int via_ircc_close(struct via_ircc_cb *self) 426static void __devexit via_remove_one(struct pci_dev *pdev)
478{ 427{
428 struct via_ircc_cb *self = pci_get_drvdata(pdev);
479 int iobase; 429 int iobase;
480 430
481 IRDA_DEBUG(3, "%s()\n", __func__); 431 IRDA_DEBUG(3, "%s()\n", __func__);
482 432
483 IRDA_ASSERT(self != NULL, return -1;);
484
485 iobase = self->io.fir_base; 433 iobase = self->io.fir_base;
486 434
487 ResetChip(iobase, 5); //hardware reset. 435 ResetChip(iobase, 5); //hardware reset.
@@ -493,16 +441,16 @@ static int via_ircc_close(struct via_ircc_cb *self)
493 __func__, self->io.fir_base); 441 __func__, self->io.fir_base);
494 release_region(self->io.fir_base, self->io.fir_ext); 442 release_region(self->io.fir_base, self->io.fir_ext);
495 if (self->tx_buff.head) 443 if (self->tx_buff.head)
496 dma_free_coherent(NULL, self->tx_buff.truesize, 444 dma_free_coherent(&pdev->dev, self->tx_buff.truesize,
497 self->tx_buff.head, self->tx_buff_dma); 445 self->tx_buff.head, self->tx_buff_dma);
498 if (self->rx_buff.head) 446 if (self->rx_buff.head)
499 dma_free_coherent(NULL, self->rx_buff.truesize, 447 dma_free_coherent(&pdev->dev, self->rx_buff.truesize,
500 self->rx_buff.head, self->rx_buff_dma); 448 self->rx_buff.head, self->rx_buff_dma);
501 dev_self[self->index] = NULL; 449 pci_set_drvdata(pdev, NULL);
502 450
503 free_netdev(self->netdev); 451 free_netdev(self->netdev);
504 452
505 return 0; 453 pci_disable_device(pdev);
506} 454}
507 455
508/* 456/*
@@ -1182,12 +1130,13 @@ F01_E */
1182 1130
1183 skb = dev_alloc_skb(len + 1 - 4); 1131 skb = dev_alloc_skb(len + 1 - 4);
1184 /* 1132 /*
1185 * if frame size,data ptr,or skb ptr are wrong ,the get next 1133 * if frame size, data ptr, or skb ptr are wrong, then get next
1186 * entry. 1134 * entry.
1187 */ 1135 */
1188 if ((skb == NULL) || (skb->data == NULL) || 1136 if ((skb == NULL) || (skb->data == NULL) ||
1189 (self->rx_buff.data == NULL) || (len < 6)) { 1137 (self->rx_buff.data == NULL) || (len < 6)) {
1190 self->netdev->stats.rx_dropped++; 1138 self->netdev->stats.rx_dropped++;
1139 kfree_skb(skb);
1191 return TRUE; 1140 return TRUE;
1192 } 1141 }
1193 skb_reserve(skb, 1); 1142 skb_reserve(skb, 1);
diff --git a/drivers/net/irda/via-ircc.h b/drivers/net/irda/via-ircc.h
index 5a84822b5a43..c6f58482b769 100644
--- a/drivers/net/irda/via-ircc.h
+++ b/drivers/net/irda/via-ircc.h
@@ -238,7 +238,7 @@ static void WriteLPCReg(int iRegNum, unsigned char iVal)
238 238
239static __u8 ReadReg(unsigned int BaseAddr, int iRegNum) 239static __u8 ReadReg(unsigned int BaseAddr, int iRegNum)
240{ 240{
241 return ((__u8) inb(BaseAddr + iRegNum)); 241 return (__u8) inb(BaseAddr + iRegNum);
242} 242}
243 243
244static void WriteReg(unsigned int BaseAddr, int iRegNum, unsigned char iVal) 244static void WriteReg(unsigned int BaseAddr, int iRegNum, unsigned char iVal)
diff --git a/drivers/net/irda/vlsi_ir.h b/drivers/net/irda/vlsi_ir.h
index 3f24a1f33022..a076eb125349 100644
--- a/drivers/net/irda/vlsi_ir.h
+++ b/drivers/net/irda/vlsi_ir.h
@@ -209,7 +209,7 @@ enum vlsi_pio_irintr {
209 IRINTR_ACTEN = 0x80, /* activity interrupt enable */ 209 IRINTR_ACTEN = 0x80, /* activity interrupt enable */
210 IRINTR_ACTIVITY = 0x40, /* activity monitor (traffic detected) */ 210 IRINTR_ACTIVITY = 0x40, /* activity monitor (traffic detected) */
211 IRINTR_RPKTEN = 0x20, /* receive packet interrupt enable*/ 211 IRINTR_RPKTEN = 0x20, /* receive packet interrupt enable*/
212 IRINTR_RPKTINT = 0x10, /* rx-packet transfered from fifo to memory finished */ 212 IRINTR_RPKTINT = 0x10, /* rx-packet transferred from fifo to memory finished */
213 IRINTR_TPKTEN = 0x08, /* transmit packet interrupt enable */ 213 IRINTR_TPKTEN = 0x08, /* transmit packet interrupt enable */
214 IRINTR_TPKTINT = 0x04, /* last bit of tx-packet+crc shifted to ir-pulser */ 214 IRINTR_TPKTINT = 0x04, /* last bit of tx-packet+crc shifted to ir-pulser */
215 IRINTR_OE_EN = 0x02, /* UART rx fifo overrun error interrupt enable */ 215 IRINTR_OE_EN = 0x02, /* UART rx fifo overrun error interrupt enable */
@@ -595,7 +595,7 @@ struct ring_descr {
595 595
596static inline int rd_is_active(struct ring_descr *rd) 596static inline int rd_is_active(struct ring_descr *rd)
597{ 597{
598 return ((rd->hw->rd_status & RD_ACTIVE) != 0); 598 return (rd->hw->rd_status & RD_ACTIVE) != 0;
599} 599}
600 600
601static inline void rd_activate(struct ring_descr *rd) 601static inline void rd_activate(struct ring_descr *rd)
@@ -739,7 +739,7 @@ typedef struct vlsi_irda_dev {
739/* the remapped error flags we use for returning from frame 739/* the remapped error flags we use for returning from frame
740 * post-processing in vlsi_process_tx/rx() after it was completed 740 * post-processing in vlsi_process_tx/rx() after it was completed
741 * by the hardware. These functions either return the >=0 number 741 * by the hardware. These functions either return the >=0 number
742 * of transfered bytes in case of success or the negative (-) 742 * of transferred bytes in case of success or the negative (-)
743 * of the or'ed error flags. 743 * of the or'ed error flags.
744 */ 744 */
745 745