diff options
author | Stephen Hemminger <shemminger@vyatta.com> | 2009-01-06 13:40:43 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2009-01-06 13:40:43 -0500 |
commit | af0490810cfa159b4894ddecfc5eb2e4432fb976 (patch) | |
tree | 7c5074c11633b5c9cfa1489859d015974be5fe32 /drivers/net/irda/smsc-ircc2.c | |
parent | 46377bb311a7682f6240c954c48e81a1e4f51e66 (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/smsc-ircc2.c')
-rw-r--r-- | drivers/net/irda/smsc-ircc2.c | 38 |
1 files changed, 14 insertions, 24 deletions
diff --git a/drivers/net/irda/smsc-ircc2.c b/drivers/net/irda/smsc-ircc2.c index 5d09e157e15b..dd73cce10991 100644 --- a/drivers/net/irda/smsc-ircc2.c +++ b/drivers/net/irda/smsc-ircc2.c | |||
@@ -150,7 +150,6 @@ struct smsc_chip_address { | |||
150 | /* Private data for each instance */ | 150 | /* Private data for each instance */ |
151 | struct smsc_ircc_cb { | 151 | struct smsc_ircc_cb { |
152 | struct net_device *netdev; /* Yes! we are some kind of netdevice */ | 152 | struct net_device *netdev; /* Yes! we are some kind of netdevice */ |
153 | struct net_device_stats stats; | ||
154 | struct irlap_cb *irlap; /* The link layer we are binded to */ | 153 | struct irlap_cb *irlap; /* The link layer we are binded to */ |
155 | 154 | ||
156 | chipio_t io; /* IrDA controller information */ | 155 | chipio_t io; /* IrDA controller information */ |
@@ -215,7 +214,6 @@ static int smsc_ircc_net_ioctl(struct net_device *dev, struct ifreq *rq, int cm | |||
215 | #if SMSC_IRCC2_C_NET_TIMEOUT | 214 | #if SMSC_IRCC2_C_NET_TIMEOUT |
216 | static void smsc_ircc_timeout(struct net_device *dev); | 215 | static void smsc_ircc_timeout(struct net_device *dev); |
217 | #endif | 216 | #endif |
218 | static struct net_device_stats *smsc_ircc_net_get_stats(struct net_device *dev); | ||
219 | static int smsc_ircc_is_receiving(struct smsc_ircc_cb *self); | 217 | static int smsc_ircc_is_receiving(struct smsc_ircc_cb *self); |
220 | static void smsc_ircc_probe_transceiver(struct smsc_ircc_cb *self); | 218 | static void smsc_ircc_probe_transceiver(struct smsc_ircc_cb *self); |
221 | static void smsc_ircc_set_transceiver_for_speed(struct smsc_ircc_cb *self, u32 speed); | 219 | static void smsc_ircc_set_transceiver_for_speed(struct smsc_ircc_cb *self, u32 speed); |
@@ -529,7 +527,6 @@ static int __init smsc_ircc_open(unsigned int fir_base, unsigned int sir_base, u | |||
529 | dev->open = smsc_ircc_net_open; | 527 | dev->open = smsc_ircc_net_open; |
530 | dev->stop = smsc_ircc_net_close; | 528 | dev->stop = smsc_ircc_net_close; |
531 | dev->do_ioctl = smsc_ircc_net_ioctl; | 529 | dev->do_ioctl = smsc_ircc_net_ioctl; |
532 | dev->get_stats = smsc_ircc_net_get_stats; | ||
533 | 530 | ||
534 | self = netdev_priv(dev); | 531 | self = netdev_priv(dev); |
535 | self->netdev = dev; | 532 | self->netdev = dev; |
@@ -834,13 +831,6 @@ static int smsc_ircc_net_ioctl(struct net_device *dev, struct ifreq *rq, int cmd | |||
834 | return ret; | 831 | return ret; |
835 | } | 832 | } |
836 | 833 | ||
837 | static struct net_device_stats *smsc_ircc_net_get_stats(struct net_device *dev) | ||
838 | { | ||
839 | struct smsc_ircc_cb *self = netdev_priv(dev); | ||
840 | |||
841 | return &self->stats; | ||
842 | } | ||
843 | |||
844 | #if SMSC_IRCC2_C_NET_TIMEOUT | 834 | #if SMSC_IRCC2_C_NET_TIMEOUT |
845 | /* | 835 | /* |
846 | * Function smsc_ircc_timeout (struct net_device *dev) | 836 | * Function smsc_ircc_timeout (struct net_device *dev) |
@@ -920,7 +910,7 @@ static int smsc_ircc_hard_xmit_sir(struct sk_buff *skb, struct net_device *dev) | |||
920 | self->tx_buff.len = async_wrap_skb(skb, self->tx_buff.data, | 910 | self->tx_buff.len = async_wrap_skb(skb, self->tx_buff.data, |
921 | self->tx_buff.truesize); | 911 | self->tx_buff.truesize); |
922 | 912 | ||
923 | self->stats.tx_bytes += self->tx_buff.len; | 913 | dev->stats.tx_bytes += self->tx_buff.len; |
924 | 914 | ||
925 | /* Turn on transmit finished interrupt. Will fire immediately! */ | 915 | /* Turn on transmit finished interrupt. Will fire immediately! */ |
926 | outb(UART_IER_THRI, self->io.sir_base + UART_IER); | 916 | outb(UART_IER_THRI, self->io.sir_base + UART_IER); |
@@ -1320,16 +1310,16 @@ static void smsc_ircc_dma_xmit_complete(struct smsc_ircc_cb *self) | |||
1320 | /* Check for underrun! */ | 1310 | /* Check for underrun! */ |
1321 | register_bank(iobase, 0); | 1311 | register_bank(iobase, 0); |
1322 | if (inb(iobase + IRCC_LSR) & IRCC_LSR_UNDERRUN) { | 1312 | if (inb(iobase + IRCC_LSR) & IRCC_LSR_UNDERRUN) { |
1323 | self->stats.tx_errors++; | 1313 | self->netdev->stats.tx_errors++; |
1324 | self->stats.tx_fifo_errors++; | 1314 | self->netdev->stats.tx_fifo_errors++; |
1325 | 1315 | ||
1326 | /* Reset error condition */ | 1316 | /* Reset error condition */ |
1327 | register_bank(iobase, 0); | 1317 | register_bank(iobase, 0); |
1328 | outb(IRCC_MASTER_ERROR_RESET, iobase + IRCC_MASTER); | 1318 | outb(IRCC_MASTER_ERROR_RESET, iobase + IRCC_MASTER); |
1329 | outb(0x00, iobase + IRCC_MASTER); | 1319 | outb(0x00, iobase + IRCC_MASTER); |
1330 | } else { | 1320 | } else { |
1331 | self->stats.tx_packets++; | 1321 | self->netdev->stats.tx_packets++; |
1332 | self->stats.tx_bytes += self->tx_buff.len; | 1322 | self->netdev->stats.tx_bytes += self->tx_buff.len; |
1333 | } | 1323 | } |
1334 | 1324 | ||
1335 | /* Check if it's time to change the speed */ | 1325 | /* Check if it's time to change the speed */ |
@@ -1429,15 +1419,15 @@ static void smsc_ircc_dma_receive_complete(struct smsc_ircc_cb *self) | |||
1429 | 1419 | ||
1430 | /* Look for errors */ | 1420 | /* Look for errors */ |
1431 | if (lsr & (IRCC_LSR_FRAME_ERROR | IRCC_LSR_CRC_ERROR | IRCC_LSR_SIZE_ERROR)) { | 1421 | if (lsr & (IRCC_LSR_FRAME_ERROR | IRCC_LSR_CRC_ERROR | IRCC_LSR_SIZE_ERROR)) { |
1432 | self->stats.rx_errors++; | 1422 | self->netdev->stats.rx_errors++; |
1433 | if (lsr & IRCC_LSR_FRAME_ERROR) | 1423 | if (lsr & IRCC_LSR_FRAME_ERROR) |
1434 | self->stats.rx_frame_errors++; | 1424 | self->netdev->stats.rx_frame_errors++; |
1435 | if (lsr & IRCC_LSR_CRC_ERROR) | 1425 | if (lsr & IRCC_LSR_CRC_ERROR) |
1436 | self->stats.rx_crc_errors++; | 1426 | self->netdev->stats.rx_crc_errors++; |
1437 | if (lsr & IRCC_LSR_SIZE_ERROR) | 1427 | if (lsr & IRCC_LSR_SIZE_ERROR) |
1438 | self->stats.rx_length_errors++; | 1428 | self->netdev->stats.rx_length_errors++; |
1439 | if (lsr & (IRCC_LSR_UNDERRUN | IRCC_LSR_OVERRUN)) | 1429 | if (lsr & (IRCC_LSR_UNDERRUN | IRCC_LSR_OVERRUN)) |
1440 | self->stats.rx_length_errors++; | 1430 | self->netdev->stats.rx_length_errors++; |
1441 | return; | 1431 | return; |
1442 | } | 1432 | } |
1443 | 1433 | ||
@@ -1460,8 +1450,8 @@ static void smsc_ircc_dma_receive_complete(struct smsc_ircc_cb *self) | |||
1460 | skb_reserve(skb, 1); | 1450 | skb_reserve(skb, 1); |
1461 | 1451 | ||
1462 | memcpy(skb_put(skb, len), self->rx_buff.data, len); | 1452 | memcpy(skb_put(skb, len), self->rx_buff.data, len); |
1463 | self->stats.rx_packets++; | 1453 | self->netdev->stats.rx_packets++; |
1464 | self->stats.rx_bytes += len; | 1454 | self->netdev->stats.rx_bytes += len; |
1465 | 1455 | ||
1466 | skb->dev = self->netdev; | 1456 | skb->dev = self->netdev; |
1467 | skb_reset_mac_header(skb); | 1457 | skb_reset_mac_header(skb); |
@@ -1489,7 +1479,7 @@ static void smsc_ircc_sir_receive(struct smsc_ircc_cb *self) | |||
1489 | * async_unwrap_char will deliver all found frames | 1479 | * async_unwrap_char will deliver all found frames |
1490 | */ | 1480 | */ |
1491 | do { | 1481 | do { |
1492 | async_unwrap_char(self->netdev, &self->stats, &self->rx_buff, | 1482 | async_unwrap_char(self->netdev, &self->netdev->stats, &self->rx_buff, |
1493 | inb(iobase + UART_RX)); | 1483 | inb(iobase + UART_RX)); |
1494 | 1484 | ||
1495 | /* Make sure we don't stay here to long */ | 1485 | /* Make sure we don't stay here to long */ |
@@ -1992,7 +1982,7 @@ static void smsc_ircc_sir_write_wakeup(struct smsc_ircc_cb *self) | |||
1992 | /* Tell network layer that we want more frames */ | 1982 | /* Tell network layer that we want more frames */ |
1993 | netif_wake_queue(self->netdev); | 1983 | netif_wake_queue(self->netdev); |
1994 | } | 1984 | } |
1995 | self->stats.tx_packets++; | 1985 | self->netdev->stats.tx_packets++; |
1996 | 1986 | ||
1997 | if (self->io.speed <= 115200) { | 1987 | if (self->io.speed <= 115200) { |
1998 | /* | 1988 | /* |