aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/irda/via-ircc.c
diff options
context:
space:
mode:
authorStephen Hemminger <shemminger@vyatta.com>2009-01-06 13:40:43 -0500
committerDavid S. Miller <davem@davemloft.net>2009-01-06 13:40:43 -0500
commitaf0490810cfa159b4894ddecfc5eb2e4432fb976 (patch)
tree7c5074c11633b5c9cfa1489859d015974be5fe32 /drivers/net/irda/via-ircc.c
parent46377bb311a7682f6240c954c48e81a1e4f51e66 (diff)
irda: convert to internal stats
Convert IRDA drivers to use already existing net_device_stats structure in network device. This is a pre-cursor to conversion to net_device ops. Compile tested only. Signed-off-by: Stephen Hemminger <shemminger@vyatta.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/irda/via-ircc.c')
-rw-r--r--drivers/net/irda/via-ircc.c47
1 files changed, 18 insertions, 29 deletions
diff --git a/drivers/net/irda/via-ircc.c b/drivers/net/irda/via-ircc.c
index 74c78cf7a333..8b3e545924cc 100644
--- a/drivers/net/irda/via-ircc.c
+++ b/drivers/net/irda/via-ircc.c
@@ -101,8 +101,6 @@ static int via_ircc_net_open(struct net_device *dev);
101static int via_ircc_net_close(struct net_device *dev); 101static int via_ircc_net_close(struct net_device *dev);
102static int via_ircc_net_ioctl(struct net_device *dev, struct ifreq *rq, 102static int via_ircc_net_ioctl(struct net_device *dev, struct ifreq *rq,
103 int cmd); 103 int cmd);
104static struct net_device_stats *via_ircc_net_get_stats(struct net_device
105 *dev);
106static void via_ircc_change_dongle_speed(int iobase, int speed, 104static void via_ircc_change_dongle_speed(int iobase, int speed,
107 int dongle_id); 105 int dongle_id);
108static int RxTimerHandler(struct via_ircc_cb *self, int iobase); 106static int RxTimerHandler(struct via_ircc_cb *self, int iobase);
@@ -434,7 +432,6 @@ static __devinit int via_ircc_open(int i, chipio_t * info, unsigned int id)
434 dev->open = via_ircc_net_open; 432 dev->open = via_ircc_net_open;
435 dev->stop = via_ircc_net_close; 433 dev->stop = via_ircc_net_close;
436 dev->do_ioctl = via_ircc_net_ioctl; 434 dev->do_ioctl = via_ircc_net_ioctl;
437 dev->get_stats = via_ircc_net_get_stats;
438 435
439 err = register_netdev(dev); 436 err = register_netdev(dev);
440 if (err) 437 if (err)
@@ -855,7 +852,7 @@ static int via_ircc_hard_xmit_sir(struct sk_buff *skb,
855 async_wrap_skb(skb, self->tx_buff.data, 852 async_wrap_skb(skb, self->tx_buff.data,
856 self->tx_buff.truesize); 853 self->tx_buff.truesize);
857 854
858 self->stats.tx_bytes += self->tx_buff.len; 855 dev->stats.tx_bytes += self->tx_buff.len;
859 /* Send this frame with old speed */ 856 /* Send this frame with old speed */
860 SetBaudRate(iobase, self->io.speed); 857 SetBaudRate(iobase, self->io.speed);
861 SetPulseWidth(iobase, 12); 858 SetPulseWidth(iobase, 12);
@@ -921,7 +918,7 @@ static int via_ircc_hard_xmit_fir(struct sk_buff *skb,
921 self->tx_fifo.queue[self->tx_fifo.free].len = skb->len; 918 self->tx_fifo.queue[self->tx_fifo.free].len = skb->len;
922 919
923 self->tx_fifo.tail += skb->len; 920 self->tx_fifo.tail += skb->len;
924 self->stats.tx_bytes += skb->len; 921 dev->stats.tx_bytes += skb->len;
925 skb_copy_from_linear_data(skb, 922 skb_copy_from_linear_data(skb,
926 self->tx_fifo.queue[self->tx_fifo.free].start, skb->len); 923 self->tx_fifo.queue[self->tx_fifo.free].start, skb->len);
927 self->tx_fifo.len++; 924 self->tx_fifo.len++;
@@ -990,12 +987,12 @@ static int via_ircc_dma_xmit_complete(struct via_ircc_cb *self)
990 /* Clear bit, by writing 1 into it */ 987 /* Clear bit, by writing 1 into it */
991 Tx_status = GetTXStatus(iobase); 988 Tx_status = GetTXStatus(iobase);
992 if (Tx_status & 0x08) { 989 if (Tx_status & 0x08) {
993 self->stats.tx_errors++; 990 self->netdev->stats.tx_errors++;
994 self->stats.tx_fifo_errors++; 991 self->netdev->stats.tx_fifo_errors++;
995 hwreset(self); 992 hwreset(self);
996// how to clear underrrun ? 993// how to clear underrrun ?
997 } else { 994 } else {
998 self->stats.tx_packets++; 995 self->netdev->stats.tx_packets++;
999 ResetChip(iobase, 3); 996 ResetChip(iobase, 3);
1000 ResetChip(iobase, 4); 997 ResetChip(iobase, 4);
1001 } 998 }
@@ -1119,8 +1116,8 @@ static int via_ircc_dma_receive_complete(struct via_ircc_cb *self,
1119 } 1116 }
1120 // Move to next frame 1117 // Move to next frame
1121 self->rx_buff.data += len; 1118 self->rx_buff.data += len;
1122 self->stats.rx_bytes += len; 1119 self->netdev->stats.rx_bytes += len;
1123 self->stats.rx_packets++; 1120 self->netdev->stats.rx_packets++;
1124 skb->dev = self->netdev; 1121 skb->dev = self->netdev;
1125 skb_reset_mac_header(skb); 1122 skb_reset_mac_header(skb);
1126 skb->protocol = htons(ETH_P_IRDA); 1123 skb->protocol = htons(ETH_P_IRDA);
@@ -1180,7 +1177,7 @@ F01_E */
1180 */ 1177 */
1181 if ((skb == NULL) || (skb->data == NULL) 1178 if ((skb == NULL) || (skb->data == NULL)
1182 || (self->rx_buff.data == NULL) || (len < 6)) { 1179 || (self->rx_buff.data == NULL) || (len < 6)) {
1183 self->stats.rx_dropped++; 1180 self->netdev->stats.rx_dropped++;
1184 return TRUE; 1181 return TRUE;
1185 } 1182 }
1186 skb_reserve(skb, 1); 1183 skb_reserve(skb, 1);
@@ -1192,8 +1189,8 @@ F01_E */
1192 1189
1193 // Move to next frame 1190 // Move to next frame
1194 self->rx_buff.data += len; 1191 self->rx_buff.data += len;
1195 self->stats.rx_bytes += len; 1192 self->netdev->stats.rx_bytes += len;
1196 self->stats.rx_packets++; 1193 self->netdev->stats.rx_packets++;
1197 skb->dev = self->netdev; 1194 skb->dev = self->netdev;
1198 skb_reset_mac_header(skb); 1195 skb_reset_mac_header(skb);
1199 skb->protocol = htons(ETH_P_IRDA); 1196 skb->protocol = htons(ETH_P_IRDA);
@@ -1220,13 +1217,13 @@ static int upload_rxdata(struct via_ircc_cb *self, int iobase)
1220 IRDA_DEBUG(2, "%s(): len=%x\n", __func__, len); 1217 IRDA_DEBUG(2, "%s(): len=%x\n", __func__, len);
1221 1218
1222 if ((len - 4) < 2) { 1219 if ((len - 4) < 2) {
1223 self->stats.rx_dropped++; 1220 self->netdev->stats.rx_dropped++;
1224 return FALSE; 1221 return FALSE;
1225 } 1222 }
1226 1223
1227 skb = dev_alloc_skb(len + 1); 1224 skb = dev_alloc_skb(len + 1);
1228 if (skb == NULL) { 1225 if (skb == NULL) {
1229 self->stats.rx_dropped++; 1226 self->netdev->stats.rx_dropped++;
1230 return FALSE; 1227 return FALSE;
1231 } 1228 }
1232 skb_reserve(skb, 1); 1229 skb_reserve(skb, 1);
@@ -1238,8 +1235,8 @@ static int upload_rxdata(struct via_ircc_cb *self, int iobase)
1238 st_fifo->tail = 0; 1235 st_fifo->tail = 0;
1239 // Move to next frame 1236 // Move to next frame
1240 self->rx_buff.data += len; 1237 self->rx_buff.data += len;
1241 self->stats.rx_bytes += len; 1238 self->netdev->stats.rx_bytes += len;
1242 self->stats.rx_packets++; 1239 self->netdev->stats.rx_packets++;
1243 skb->dev = self->netdev; 1240 skb->dev = self->netdev;
1244 skb_reset_mac_header(skb); 1241 skb_reset_mac_header(skb);
1245 skb->protocol = htons(ETH_P_IRDA); 1242 skb->protocol = htons(ETH_P_IRDA);
@@ -1295,7 +1292,7 @@ static int RxTimerHandler(struct via_ircc_cb *self, int iobase)
1295 */ 1292 */
1296 if ((skb == NULL) || (skb->data == NULL) 1293 if ((skb == NULL) || (skb->data == NULL)
1297 || (self->rx_buff.data == NULL) || (len < 6)) { 1294 || (self->rx_buff.data == NULL) || (len < 6)) {
1298 self->stats.rx_dropped++; 1295 self->netdev->stats.rx_dropped++;
1299 continue; 1296 continue;
1300 } 1297 }
1301 skb_reserve(skb, 1); 1298 skb_reserve(skb, 1);
@@ -1307,8 +1304,8 @@ static int RxTimerHandler(struct via_ircc_cb *self, int iobase)
1307 1304
1308 // Move to next frame 1305 // Move to next frame
1309 self->rx_buff.data += len; 1306 self->rx_buff.data += len;
1310 self->stats.rx_bytes += len; 1307 self->netdev->stats.rx_bytes += len;
1311 self->stats.rx_packets++; 1308 self->netdev->stats.rx_packets++;
1312 skb->dev = self->netdev; 1309 skb->dev = self->netdev;
1313 skb_reset_mac_header(skb); 1310 skb_reset_mac_header(skb);
1314 skb->protocol = htons(ETH_P_IRDA); 1311 skb->protocol = htons(ETH_P_IRDA);
@@ -1523,7 +1520,7 @@ static int via_ircc_net_open(struct net_device *dev)
1523 1520
1524 IRDA_ASSERT(dev != NULL, return -1;); 1521 IRDA_ASSERT(dev != NULL, return -1;);
1525 self = netdev_priv(dev); 1522 self = netdev_priv(dev);
1526 self->stats.rx_packets = 0; 1523 dev->stats.rx_packets = 0;
1527 IRDA_ASSERT(self != NULL, return 0;); 1524 IRDA_ASSERT(self != NULL, return 0;);
1528 iobase = self->io.fir_base; 1525 iobase = self->io.fir_base;
1529 if (request_irq(self->io.irq, via_ircc_interrupt, 0, dev->name, dev)) { 1526 if (request_irq(self->io.irq, via_ircc_interrupt, 0, dev->name, dev)) {
@@ -1660,14 +1657,6 @@ static int via_ircc_net_ioctl(struct net_device *dev, struct ifreq *rq,
1660 return ret; 1657 return ret;
1661} 1658}
1662 1659
1663static struct net_device_stats *via_ircc_net_get_stats(struct net_device
1664 *dev)
1665{
1666 struct via_ircc_cb *self = netdev_priv(dev);
1667
1668 return &self->stats;
1669}
1670
1671MODULE_AUTHOR("VIA Technologies,inc"); 1660MODULE_AUTHOR("VIA Technologies,inc");
1672MODULE_DESCRIPTION("VIA IrDA Device Driver"); 1661MODULE_DESCRIPTION("VIA IrDA Device Driver");
1673MODULE_LICENSE("GPL"); 1662MODULE_LICENSE("GPL");