aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/irda
diff options
context:
space:
mode:
authorDmitry Torokhov <dtor_core@ameritech.net>2005-09-06 18:19:21 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2005-09-07 19:57:58 -0400
commit80a9058924d66643b645dbf5ad92acdac6d1d134 (patch)
treed11569b14b8e1980e9491f3ddc2c146b127f20fb /drivers/net/irda
parentb6158d23a60ac32fc08316703266b6ab14d9dc00 (diff)
[PATCH] smsc-ircc2: dont pass iobase around
IRDA: smsc-ircc2 - cleanup - do not pass around iobase, it can be retrieved from smsc_ircc_cb structure. Signed-off-by: Dmitry Torokhov <dtor@mail.ru> Cc: Jean Tourrilhes <jt@hpl.hp.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/net/irda')
-rw-r--r--drivers/net/irda/smsc-ircc2.c61
1 files changed, 26 insertions, 35 deletions
diff --git a/drivers/net/irda/smsc-ircc2.c b/drivers/net/irda/smsc-ircc2.c
index 6c6747d2b00d..ee5ab94124a1 100644
--- a/drivers/net/irda/smsc-ircc2.c
+++ b/drivers/net/irda/smsc-ircc2.c
@@ -163,13 +163,13 @@ static void smsc_ircc_setup_io(struct smsc_ircc_cb *self, unsigned int fir_base,
163static void smsc_ircc_setup_qos(struct smsc_ircc_cb *self); 163static void smsc_ircc_setup_qos(struct smsc_ircc_cb *self);
164static void smsc_ircc_init_chip(struct smsc_ircc_cb *self); 164static void smsc_ircc_init_chip(struct smsc_ircc_cb *self);
165static int __exit smsc_ircc_close(struct smsc_ircc_cb *self); 165static int __exit smsc_ircc_close(struct smsc_ircc_cb *self);
166static int smsc_ircc_dma_receive(struct smsc_ircc_cb *self, int iobase); 166static int smsc_ircc_dma_receive(struct smsc_ircc_cb *self);
167static void smsc_ircc_dma_receive_complete(struct smsc_ircc_cb *self, int iobase); 167static void smsc_ircc_dma_receive_complete(struct smsc_ircc_cb *self);
168static void smsc_ircc_sir_receive(struct smsc_ircc_cb *self); 168static void smsc_ircc_sir_receive(struct smsc_ircc_cb *self);
169static int smsc_ircc_hard_xmit_sir(struct sk_buff *skb, struct net_device *dev); 169static int smsc_ircc_hard_xmit_sir(struct sk_buff *skb, struct net_device *dev);
170static int smsc_ircc_hard_xmit_fir(struct sk_buff *skb, struct net_device *dev); 170static int smsc_ircc_hard_xmit_fir(struct sk_buff *skb, struct net_device *dev);
171static void smsc_ircc_dma_xmit(struct smsc_ircc_cb *self, int iobase, int bofs); 171static void smsc_ircc_dma_xmit(struct smsc_ircc_cb *self, int bofs);
172static void smsc_ircc_dma_xmit_complete(struct smsc_ircc_cb *self, int iobase); 172static void smsc_ircc_dma_xmit_complete(struct smsc_ircc_cb *self);
173static void smsc_ircc_change_speed(void *priv, u32 speed); 173static void smsc_ircc_change_speed(void *priv, u32 speed);
174static void smsc_ircc_set_sir_speed(void *priv, u32 speed); 174static void smsc_ircc_set_sir_speed(void *priv, u32 speed);
175static irqreturn_t smsc_ircc_interrupt(int irq, void *dev_id, struct pt_regs *regs); 175static irqreturn_t smsc_ircc_interrupt(int irq, void *dev_id, struct pt_regs *regs);
@@ -758,7 +758,6 @@ int smsc_ircc_hard_xmit_sir(struct sk_buff *skb, struct net_device *dev)
758{ 758{
759 struct smsc_ircc_cb *self; 759 struct smsc_ircc_cb *self;
760 unsigned long flags; 760 unsigned long flags;
761 int iobase;
762 s32 speed; 761 s32 speed;
763 762
764 IRDA_DEBUG(1, "%s\n", __FUNCTION__); 763 IRDA_DEBUG(1, "%s\n", __FUNCTION__);
@@ -768,8 +767,6 @@ int smsc_ircc_hard_xmit_sir(struct sk_buff *skb, struct net_device *dev)
768 self = (struct smsc_ircc_cb *) dev->priv; 767 self = (struct smsc_ircc_cb *) dev->priv;
769 IRDA_ASSERT(self != NULL, return 0;); 768 IRDA_ASSERT(self != NULL, return 0;);
770 769
771 iobase = self->io.sir_base;
772
773 netif_stop_queue(dev); 770 netif_stop_queue(dev);
774 771
775 /* Make sure test of self->io.speed & speed change are atomic */ 772 /* Make sure test of self->io.speed & speed change are atomic */
@@ -808,7 +805,7 @@ int smsc_ircc_hard_xmit_sir(struct sk_buff *skb, struct net_device *dev)
808 self->stats.tx_bytes += self->tx_buff.len; 805 self->stats.tx_bytes += self->tx_buff.len;
809 806
810 /* Turn on transmit finished interrupt. Will fire immediately! */ 807 /* Turn on transmit finished interrupt. Will fire immediately! */
811 outb(UART_IER_THRI, iobase + UART_IER); 808 outb(UART_IER_THRI, self->io.sir_base + UART_IER);
812 809
813 spin_unlock_irqrestore(&self->lock, flags); 810 spin_unlock_irqrestore(&self->lock, flags);
814 811
@@ -951,14 +948,12 @@ static void smsc_ircc_change_speed(void *priv, u32 speed)
951{ 948{
952 struct smsc_ircc_cb *self = (struct smsc_ircc_cb *) priv; 949 struct smsc_ircc_cb *self = (struct smsc_ircc_cb *) priv;
953 struct net_device *dev; 950 struct net_device *dev;
954 int iobase;
955 int last_speed_was_sir; 951 int last_speed_was_sir;
956 952
957 IRDA_DEBUG(0, "%s() changing speed to: %d\n", __FUNCTION__, speed); 953 IRDA_DEBUG(0, "%s() changing speed to: %d\n", __FUNCTION__, speed);
958 954
959 IRDA_ASSERT(self != NULL, return;); 955 IRDA_ASSERT(self != NULL, return;);
960 dev = self->netdev; 956 dev = self->netdev;
961 iobase = self->io.fir_base;
962 957
963 last_speed_was_sir = self->io.speed <= SMSC_IRCC2_MAX_SIR_SPEED; 958 last_speed_was_sir = self->io.speed <= SMSC_IRCC2_MAX_SIR_SPEED;
964 959
@@ -1001,10 +996,10 @@ static void smsc_ircc_change_speed(void *priv, u32 speed)
1001 self->tx_buff.len = 10; 996 self->tx_buff.len = 10;
1002 self->tx_buff.data = self->tx_buff.head; 997 self->tx_buff.data = self->tx_buff.head;
1003 998
1004 smsc_ircc_dma_xmit(self, iobase, 4000); 999 smsc_ircc_dma_xmit(self, 4000);
1005 #endif 1000 #endif
1006 /* Be ready for incoming frames */ 1001 /* Be ready for incoming frames */
1007 smsc_ircc_dma_receive(self, iobase); 1002 smsc_ircc_dma_receive(self);
1008 } 1003 }
1009 1004
1010 netif_wake_queue(dev); 1005 netif_wake_queue(dev);
@@ -1074,15 +1069,12 @@ static int smsc_ircc_hard_xmit_fir(struct sk_buff *skb, struct net_device *dev)
1074 struct smsc_ircc_cb *self; 1069 struct smsc_ircc_cb *self;
1075 unsigned long flags; 1070 unsigned long flags;
1076 s32 speed; 1071 s32 speed;
1077 int iobase;
1078 int mtt; 1072 int mtt;
1079 1073
1080 IRDA_ASSERT(dev != NULL, return 0;); 1074 IRDA_ASSERT(dev != NULL, return 0;);
1081 self = (struct smsc_ircc_cb *) dev->priv; 1075 self = (struct smsc_ircc_cb *) dev->priv;
1082 IRDA_ASSERT(self != NULL, return 0;); 1076 IRDA_ASSERT(self != NULL, return 0;);
1083 1077
1084 iobase = self->io.fir_base;
1085
1086 netif_stop_queue(dev); 1078 netif_stop_queue(dev);
1087 1079
1088 /* Make sure test of self->io.speed & speed change are atomic */ 1080 /* Make sure test of self->io.speed & speed change are atomic */
@@ -1122,10 +1114,10 @@ static int smsc_ircc_hard_xmit_fir(struct sk_buff *skb, struct net_device *dev)
1122 if (bofs > 4095) 1114 if (bofs > 4095)
1123 bofs = 4095; 1115 bofs = 4095;
1124 1116
1125 smsc_ircc_dma_xmit(self, iobase, bofs); 1117 smsc_ircc_dma_xmit(self, bofs);
1126 } else { 1118 } else {
1127 /* Transmit frame */ 1119 /* Transmit frame */
1128 smsc_ircc_dma_xmit(self, iobase, 0); 1120 smsc_ircc_dma_xmit(self, 0);
1129 } 1121 }
1130 1122
1131 spin_unlock_irqrestore(&self->lock, flags); 1123 spin_unlock_irqrestore(&self->lock, flags);
@@ -1135,13 +1127,14 @@ static int smsc_ircc_hard_xmit_fir(struct sk_buff *skb, struct net_device *dev)
1135} 1127}
1136 1128
1137/* 1129/*
1138 * Function smsc_ircc_dma_xmit (self, iobase) 1130 * Function smsc_ircc_dma_xmit (self, bofs)
1139 * 1131 *
1140 * Transmit data using DMA 1132 * Transmit data using DMA
1141 * 1133 *
1142 */ 1134 */
1143static void smsc_ircc_dma_xmit(struct smsc_ircc_cb *self, int iobase, int bofs) 1135static void smsc_ircc_dma_xmit(struct smsc_ircc_cb *self, int bofs)
1144{ 1136{
1137 int iobase = self->io.fir_base;
1145 u8 ctrl; 1138 u8 ctrl;
1146 1139
1147 IRDA_DEBUG(3, "%s\n", __FUNCTION__); 1140 IRDA_DEBUG(3, "%s\n", __FUNCTION__);
@@ -1194,17 +1187,19 @@ static void smsc_ircc_dma_xmit(struct smsc_ircc_cb *self, int iobase, int bofs)
1194 * by the interrupt handler 1187 * by the interrupt handler
1195 * 1188 *
1196 */ 1189 */
1197static void smsc_ircc_dma_xmit_complete(struct smsc_ircc_cb *self, int iobase) 1190static void smsc_ircc_dma_xmit_complete(struct smsc_ircc_cb *self)
1198{ 1191{
1192 int iobase = self->io.fir_base;
1193
1199 IRDA_DEBUG(3, "%s\n", __FUNCTION__); 1194 IRDA_DEBUG(3, "%s\n", __FUNCTION__);
1200#if 0 1195#if 0
1201 /* Disable Tx */ 1196 /* Disable Tx */
1202 register_bank(iobase, 0); 1197 register_bank(iobase, 0);
1203 outb(0x00, iobase + IRCC_LCR_B); 1198 outb(0x00, iobase + IRCC_LCR_B);
1204#endif 1199#endif
1205 register_bank(self->io.fir_base, 1); 1200 register_bank(iobase, 1);
1206 outb(inb(self->io.fir_base + IRCC_SCE_CFGB) & ~IRCC_CFGB_DMA_ENABLE, 1201 outb(inb(iobase + IRCC_SCE_CFGB) & ~IRCC_CFGB_DMA_ENABLE,
1207 self->io.fir_base + IRCC_SCE_CFGB); 1202 iobase + IRCC_SCE_CFGB);
1208 1203
1209 /* Check for underrun! */ 1204 /* Check for underrun! */
1210 register_bank(iobase, 0); 1205 register_bank(iobase, 0);
@@ -1237,8 +1232,9 @@ static void smsc_ircc_dma_xmit_complete(struct smsc_ircc_cb *self, int iobase)
1237 * if it starts to receive a frame. 1232 * if it starts to receive a frame.
1238 * 1233 *
1239 */ 1234 */
1240static int smsc_ircc_dma_receive(struct smsc_ircc_cb *self, int iobase) 1235static int smsc_ircc_dma_receive(struct smsc_ircc_cb *self)
1241{ 1236{
1237 int iobase = self->io.fir_base;
1242#if 0 1238#if 0
1243 /* Turn off chip DMA */ 1239 /* Turn off chip DMA */
1244 register_bank(iobase, 1); 1240 register_bank(iobase, 1);
@@ -1286,15 +1282,16 @@ static int smsc_ircc_dma_receive(struct smsc_ircc_cb *self, int iobase)
1286} 1282}
1287 1283
1288/* 1284/*
1289 * Function smsc_ircc_dma_receive_complete(self, iobase) 1285 * Function smsc_ircc_dma_receive_complete(self)
1290 * 1286 *
1291 * Finished with receiving frames 1287 * Finished with receiving frames
1292 * 1288 *
1293 */ 1289 */
1294static void smsc_ircc_dma_receive_complete(struct smsc_ircc_cb *self, int iobase) 1290static void smsc_ircc_dma_receive_complete(struct smsc_ircc_cb *self)
1295{ 1291{
1296 struct sk_buff *skb; 1292 struct sk_buff *skb;
1297 int len, msgcnt, lsr; 1293 int len, msgcnt, lsr;
1294 int iobase = self->io.fir_base;
1298 1295
1299 register_bank(iobase, 0); 1296 register_bank(iobase, 0);
1300 1297
@@ -1435,11 +1432,11 @@ static irqreturn_t smsc_ircc_interrupt(int irq, void *dev_id, struct pt_regs *re
1435 1432
1436 if (iir & IRCC_IIR_EOM) { 1433 if (iir & IRCC_IIR_EOM) {
1437 if (self->io.direction == IO_RECV) 1434 if (self->io.direction == IO_RECV)
1438 smsc_ircc_dma_receive_complete(self, iobase); 1435 smsc_ircc_dma_receive_complete(self);
1439 else 1436 else
1440 smsc_ircc_dma_xmit_complete(self, iobase); 1437 smsc_ircc_dma_xmit_complete(self);
1441 1438
1442 smsc_ircc_dma_receive(self, iobase); 1439 smsc_ircc_dma_receive(self);
1443 } 1440 }
1444 1441
1445 if (iir & IRCC_IIR_ACTIVE_FRAME) { 1442 if (iir & IRCC_IIR_ACTIVE_FRAME) {
@@ -1549,7 +1546,6 @@ static int ircc_is_receiving(struct smsc_ircc_cb *self)
1549static int smsc_ircc_net_open(struct net_device *dev) 1546static int smsc_ircc_net_open(struct net_device *dev)
1550{ 1547{
1551 struct smsc_ircc_cb *self; 1548 struct smsc_ircc_cb *self;
1552 int iobase;
1553 char hwname[16]; 1549 char hwname[16];
1554 unsigned long flags; 1550 unsigned long flags;
1555 1551
@@ -1559,8 +1555,6 @@ static int smsc_ircc_net_open(struct net_device *dev)
1559 self = (struct smsc_ircc_cb *) dev->priv; 1555 self = (struct smsc_ircc_cb *) dev->priv;
1560 IRDA_ASSERT(self != NULL, return 0;); 1556 IRDA_ASSERT(self != NULL, return 0;);
1561 1557
1562 iobase = self->io.fir_base;
1563
1564 if (request_irq(self->io.irq, smsc_ircc_interrupt, 0, dev->name, 1558 if (request_irq(self->io.irq, smsc_ircc_interrupt, 0, dev->name,
1565 (void *) dev)) { 1559 (void *) dev)) {
1566 IRDA_DEBUG(0, "%s(), unable to allocate irq=%d\n", 1560 IRDA_DEBUG(0, "%s(), unable to allocate irq=%d\n",
@@ -1610,7 +1604,6 @@ static int smsc_ircc_net_open(struct net_device *dev)
1610static int smsc_ircc_net_close(struct net_device *dev) 1604static int smsc_ircc_net_close(struct net_device *dev)
1611{ 1605{
1612 struct smsc_ircc_cb *self; 1606 struct smsc_ircc_cb *self;
1613 int iobase;
1614 1607
1615 IRDA_DEBUG(1, "%s\n", __FUNCTION__); 1608 IRDA_DEBUG(1, "%s\n", __FUNCTION__);
1616 1609
@@ -1618,8 +1611,6 @@ static int smsc_ircc_net_close(struct net_device *dev)
1618 self = (struct smsc_ircc_cb *) dev->priv; 1611 self = (struct smsc_ircc_cb *) dev->priv;
1619 IRDA_ASSERT(self != NULL, return 0;); 1612 IRDA_ASSERT(self != NULL, return 0;);
1620 1613
1621 iobase = self->io.fir_base;
1622
1623 /* Stop device */ 1614 /* Stop device */
1624 netif_stop_queue(dev); 1615 netif_stop_queue(dev);
1625 1616