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/pxaficp_ir.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/pxaficp_ir.c')
-rw-r--r-- | drivers/net/irda/pxaficp_ir.c | 52 |
1 files changed, 22 insertions, 30 deletions
diff --git a/drivers/net/irda/pxaficp_ir.c b/drivers/net/irda/pxaficp_ir.c index 004a9aab3a50..31794c2363ec 100644 --- a/drivers/net/irda/pxaficp_ir.c +++ b/drivers/net/irda/pxaficp_ir.c | |||
@@ -108,7 +108,6 @@ struct pxa_irda { | |||
108 | int txdma; | 108 | int txdma; |
109 | int rxdma; | 109 | int rxdma; |
110 | 110 | ||
111 | struct net_device_stats stats; | ||
112 | struct irlap_cb *irlap; | 111 | struct irlap_cb *irlap; |
113 | struct qos_info qos; | 112 | struct qos_info qos; |
114 | 113 | ||
@@ -258,14 +257,15 @@ static irqreturn_t pxa_irda_sir_irq(int irq, void *dev_id) | |||
258 | data = STRBR; | 257 | data = STRBR; |
259 | if (lsr & (LSR_OE | LSR_PE | LSR_FE | LSR_BI)) { | 258 | if (lsr & (LSR_OE | LSR_PE | LSR_FE | LSR_BI)) { |
260 | printk(KERN_DEBUG "pxa_ir: sir receiving error\n"); | 259 | printk(KERN_DEBUG "pxa_ir: sir receiving error\n"); |
261 | si->stats.rx_errors++; | 260 | dev->stats.rx_errors++; |
262 | if (lsr & LSR_FE) | 261 | if (lsr & LSR_FE) |
263 | si->stats.rx_frame_errors++; | 262 | dev->stats.rx_frame_errors++; |
264 | if (lsr & LSR_OE) | 263 | if (lsr & LSR_OE) |
265 | si->stats.rx_fifo_errors++; | 264 | dev->stats.rx_fifo_errors++; |
266 | } else { | 265 | } else { |
267 | si->stats.rx_bytes++; | 266 | dev->stats.rx_bytes++; |
268 | async_unwrap_char(dev, &si->stats, &si->rx_buff, data); | 267 | async_unwrap_char(dev, &dev->stats, |
268 | &si->rx_buff, data); | ||
269 | } | 269 | } |
270 | lsr = STLSR; | 270 | lsr = STLSR; |
271 | } | 271 | } |
@@ -277,8 +277,8 @@ static irqreturn_t pxa_irda_sir_irq(int irq, void *dev_id) | |||
277 | 277 | ||
278 | case 0x0C: /* Character Timeout Indication */ | 278 | case 0x0C: /* Character Timeout Indication */ |
279 | do { | 279 | do { |
280 | si->stats.rx_bytes++; | 280 | dev->stats.rx_bytes++; |
281 | async_unwrap_char(dev, &si->stats, &si->rx_buff, STRBR); | 281 | async_unwrap_char(dev, &dev->stats, &si->rx_buff, STRBR); |
282 | } while (STLSR & LSR_DR); | 282 | } while (STLSR & LSR_DR); |
283 | si->last_oscr = OSCR; | 283 | si->last_oscr = OSCR; |
284 | break; | 284 | break; |
@@ -290,9 +290,8 @@ static irqreturn_t pxa_irda_sir_irq(int irq, void *dev_id) | |||
290 | } | 290 | } |
291 | 291 | ||
292 | if (si->tx_buff.len == 0) { | 292 | if (si->tx_buff.len == 0) { |
293 | si->stats.tx_packets++; | 293 | dev->stats.tx_packets++; |
294 | si->stats.tx_bytes += si->tx_buff.data - | 294 | dev->stats.tx_bytes += si->tx_buff.data - si->tx_buff.head; |
295 | si->tx_buff.head; | ||
296 | 295 | ||
297 | /* We need to ensure that the transmitter has finished. */ | 296 | /* We need to ensure that the transmitter has finished. */ |
298 | while ((STLSR & LSR_TEMT) == 0) | 297 | while ((STLSR & LSR_TEMT) == 0) |
@@ -343,10 +342,10 @@ static void pxa_irda_fir_dma_tx_irq(int channel, void *data) | |||
343 | DCSR(channel) = dcsr & ~DCSR_RUN; | 342 | DCSR(channel) = dcsr & ~DCSR_RUN; |
344 | 343 | ||
345 | if (dcsr & DCSR_ENDINTR) { | 344 | if (dcsr & DCSR_ENDINTR) { |
346 | si->stats.tx_packets++; | 345 | dev->stats.tx_packets++; |
347 | si->stats.tx_bytes += si->dma_tx_buff_len; | 346 | dev->stats.tx_bytes += si->dma_tx_buff_len; |
348 | } else { | 347 | } else { |
349 | si->stats.tx_errors++; | 348 | dev->stats.tx_errors++; |
350 | } | 349 | } |
351 | 350 | ||
352 | while (ICSR1 & ICSR1_TBY) | 351 | while (ICSR1 & ICSR1_TBY) |
@@ -392,14 +391,14 @@ static void pxa_irda_fir_irq_eif(struct pxa_irda *si, struct net_device *dev, in | |||
392 | data = ICDR; | 391 | data = ICDR; |
393 | 392 | ||
394 | if (stat & (ICSR1_CRE | ICSR1_ROR)) { | 393 | if (stat & (ICSR1_CRE | ICSR1_ROR)) { |
395 | si->stats.rx_errors++; | 394 | dev->stats.rx_errors++; |
396 | if (stat & ICSR1_CRE) { | 395 | if (stat & ICSR1_CRE) { |
397 | printk(KERN_DEBUG "pxa_ir: fir receive CRC error\n"); | 396 | printk(KERN_DEBUG "pxa_ir: fir receive CRC error\n"); |
398 | si->stats.rx_crc_errors++; | 397 | dev->stats.rx_crc_errors++; |
399 | } | 398 | } |
400 | if (stat & ICSR1_ROR) { | 399 | if (stat & ICSR1_ROR) { |
401 | printk(KERN_DEBUG "pxa_ir: fir receive overrun\n"); | 400 | printk(KERN_DEBUG "pxa_ir: fir receive overrun\n"); |
402 | si->stats.rx_over_errors++; | 401 | dev->stats.rx_over_errors++; |
403 | } | 402 | } |
404 | } else { | 403 | } else { |
405 | si->dma_rx_buff[len++] = data; | 404 | si->dma_rx_buff[len++] = data; |
@@ -415,14 +414,14 @@ static void pxa_irda_fir_irq_eif(struct pxa_irda *si, struct net_device *dev, in | |||
415 | 414 | ||
416 | if (icsr0 & ICSR0_FRE) { | 415 | if (icsr0 & ICSR0_FRE) { |
417 | printk(KERN_ERR "pxa_ir: dropping erroneous frame\n"); | 416 | printk(KERN_ERR "pxa_ir: dropping erroneous frame\n"); |
418 | si->stats.rx_dropped++; | 417 | dev->stats.rx_dropped++; |
419 | return; | 418 | return; |
420 | } | 419 | } |
421 | 420 | ||
422 | skb = alloc_skb(len+1,GFP_ATOMIC); | 421 | skb = alloc_skb(len+1,GFP_ATOMIC); |
423 | if (!skb) { | 422 | if (!skb) { |
424 | printk(KERN_ERR "pxa_ir: fir out of memory for receive skb\n"); | 423 | printk(KERN_ERR "pxa_ir: fir out of memory for receive skb\n"); |
425 | si->stats.rx_dropped++; | 424 | dev->stats.rx_dropped++; |
426 | return; | 425 | return; |
427 | } | 426 | } |
428 | 427 | ||
@@ -437,8 +436,8 @@ static void pxa_irda_fir_irq_eif(struct pxa_irda *si, struct net_device *dev, in | |||
437 | skb->protocol = htons(ETH_P_IRDA); | 436 | skb->protocol = htons(ETH_P_IRDA); |
438 | netif_rx(skb); | 437 | netif_rx(skb); |
439 | 438 | ||
440 | si->stats.rx_packets++; | 439 | dev->stats.rx_packets++; |
441 | si->stats.rx_bytes += len; | 440 | dev->stats.rx_bytes += len; |
442 | } | 441 | } |
443 | } | 442 | } |
444 | 443 | ||
@@ -457,10 +456,10 @@ static irqreturn_t pxa_irda_fir_irq(int irq, void *dev_id) | |||
457 | if (icsr0 & (ICSR0_FRE | ICSR0_RAB)) { | 456 | if (icsr0 & (ICSR0_FRE | ICSR0_RAB)) { |
458 | if (icsr0 & ICSR0_FRE) { | 457 | if (icsr0 & ICSR0_FRE) { |
459 | printk(KERN_DEBUG "pxa_ir: fir receive frame error\n"); | 458 | printk(KERN_DEBUG "pxa_ir: fir receive frame error\n"); |
460 | si->stats.rx_frame_errors++; | 459 | dev->stats.rx_frame_errors++; |
461 | } else { | 460 | } else { |
462 | printk(KERN_DEBUG "pxa_ir: fir receive abort\n"); | 461 | printk(KERN_DEBUG "pxa_ir: fir receive abort\n"); |
463 | si->stats.rx_errors++; | 462 | dev->stats.rx_errors++; |
464 | } | 463 | } |
465 | ICSR0 = icsr0 & (ICSR0_FRE | ICSR0_RAB); | 464 | ICSR0 = icsr0 & (ICSR0_FRE | ICSR0_RAB); |
466 | } | 465 | } |
@@ -589,12 +588,6 @@ static int pxa_irda_ioctl(struct net_device *dev, struct ifreq *ifreq, int cmd) | |||
589 | return ret; | 588 | return ret; |
590 | } | 589 | } |
591 | 590 | ||
592 | static struct net_device_stats *pxa_irda_stats(struct net_device *dev) | ||
593 | { | ||
594 | struct pxa_irda *si = netdev_priv(dev); | ||
595 | return &si->stats; | ||
596 | } | ||
597 | |||
598 | static void pxa_irda_startup(struct pxa_irda *si) | 591 | static void pxa_irda_startup(struct pxa_irda *si) |
599 | { | 592 | { |
600 | /* Disable STUART interrupts */ | 593 | /* Disable STUART interrupts */ |
@@ -857,7 +850,6 @@ static int pxa_irda_probe(struct platform_device *pdev) | |||
857 | dev->open = pxa_irda_start; | 850 | dev->open = pxa_irda_start; |
858 | dev->stop = pxa_irda_stop; | 851 | dev->stop = pxa_irda_stop; |
859 | dev->do_ioctl = pxa_irda_ioctl; | 852 | dev->do_ioctl = pxa_irda_ioctl; |
860 | dev->get_stats = pxa_irda_stats; | ||
861 | 853 | ||
862 | irda_init_max_qos_capabilies(&si->qos); | 854 | irda_init_max_qos_capabilies(&si->qos); |
863 | 855 | ||