diff options
Diffstat (limited to 'drivers/net/irda/w83977af_ir.c')
-rw-r--r-- | drivers/net/irda/w83977af_ir.c | 62 |
1 files changed, 26 insertions, 36 deletions
diff --git a/drivers/net/irda/w83977af_ir.c b/drivers/net/irda/w83977af_ir.c index 002a6d769f2..dc0a2e4d830 100644 --- a/drivers/net/irda/w83977af_ir.c +++ b/drivers/net/irda/w83977af_ir.c @@ -102,7 +102,6 @@ static int w83977af_is_receiving(struct w83977af_ir *self); static int w83977af_net_open(struct net_device *dev); static int w83977af_net_close(struct net_device *dev); static int w83977af_net_ioctl(struct net_device *dev, struct ifreq *rq, int cmd); -static struct net_device_stats *w83977af_net_get_stats(struct net_device *dev); /* * Function w83977af_init () @@ -147,8 +146,8 @@ static void __exit w83977af_cleanup(void) * Open driver instance * */ -int w83977af_open(int i, unsigned int iobase, unsigned int irq, - unsigned int dma) +static int w83977af_open(int i, unsigned int iobase, unsigned int irq, + unsigned int dma) { struct net_device *dev; struct w83977af_ir *self; @@ -178,7 +177,7 @@ int w83977af_open(int i, unsigned int iobase, unsigned int irq, goto err_out; } - self = dev->priv; + self = netdev_priv(dev); spin_lock_init(&self->lock); @@ -237,7 +236,6 @@ int w83977af_open(int i, unsigned int iobase, unsigned int irq, dev->open = w83977af_net_open; dev->stop = w83977af_net_close; dev->do_ioctl = w83977af_net_ioctl; - dev->get_stats = w83977af_net_get_stats; err = register_netdev(dev); if (err) { @@ -310,7 +308,7 @@ static int w83977af_close(struct w83977af_ir *self) return 0; } -int w83977af_probe( int iobase, int irq, int dma) +static int w83977af_probe(int iobase, int irq, int dma) { int version; int i; @@ -409,7 +407,7 @@ int w83977af_probe( int iobase, int irq, int dma) return -1; } -void w83977af_change_speed(struct w83977af_ir *self, __u32 speed) +static void w83977af_change_speed(struct w83977af_ir *self, __u32 speed) { int ir_mode = HCR_SIR; int iobase; @@ -489,7 +487,7 @@ void w83977af_change_speed(struct w83977af_ir *self, __u32 speed) * Sets up a DMA transfer to send the current frame. * */ -int w83977af_hard_xmit(struct sk_buff *skb, struct net_device *dev) +static int w83977af_hard_xmit(struct sk_buff *skb, struct net_device *dev) { struct w83977af_ir *self; __s32 speed; @@ -497,7 +495,7 @@ int w83977af_hard_xmit(struct sk_buff *skb, struct net_device *dev) __u8 set; int mtt; - self = (struct w83977af_ir *) dev->priv; + self = netdev_priv(dev); iobase = self->io.fir_base; @@ -702,13 +700,13 @@ static void w83977af_dma_xmit_complete(struct w83977af_ir *self) if (inb(iobase+AUDR) & AUDR_UNDR) { IRDA_DEBUG(0, "%s(), Transmit underrun!\n", __func__ ); - self->stats.tx_errors++; - self->stats.tx_fifo_errors++; + self->netdev->stats.tx_errors++; + self->netdev->stats.tx_fifo_errors++; /* Clear bit, by writing 1 to it */ outb(AUDR_UNDR, iobase+AUDR); } else - self->stats.tx_packets++; + self->netdev->stats.tx_packets++; if (self->new_speed) { @@ -731,7 +729,7 @@ static void w83977af_dma_xmit_complete(struct w83977af_ir *self) * if it starts to receive a frame. * */ -int w83977af_dma_receive(struct w83977af_ir *self) +static int w83977af_dma_receive(struct w83977af_ir *self) { int iobase; __u8 set; @@ -803,7 +801,7 @@ int w83977af_dma_receive(struct w83977af_ir *self) * Finished with receiving a frame * */ -int w83977af_dma_receive_complete(struct w83977af_ir *self) +static int w83977af_dma_receive_complete(struct w83977af_ir *self) { struct sk_buff *skb; struct st_fifo *st_fifo; @@ -846,28 +844,28 @@ int w83977af_dma_receive_complete(struct w83977af_ir *self) if (status & FS_FO_ERR_MSK) { if (status & FS_FO_LST_FR) { /* Add number of lost frames to stats */ - self->stats.rx_errors += len; + self->netdev->stats.rx_errors += len; } else { /* Skip frame */ - self->stats.rx_errors++; + self->netdev->stats.rx_errors++; self->rx_buff.data += len; if (status & FS_FO_MX_LEX) - self->stats.rx_length_errors++; + self->netdev->stats.rx_length_errors++; if (status & FS_FO_PHY_ERR) - self->stats.rx_frame_errors++; + self->netdev->stats.rx_frame_errors++; if (status & FS_FO_CRC_ERR) - self->stats.rx_crc_errors++; + self->netdev->stats.rx_crc_errors++; } /* The errors below can be reported in both cases */ if (status & FS_FO_RX_OV) - self->stats.rx_fifo_errors++; + self->netdev->stats.rx_fifo_errors++; if (status & FS_FO_FSF_OV) - self->stats.rx_fifo_errors++; + self->netdev->stats.rx_fifo_errors++; } else { /* Check if we have transferred all data to memory */ @@ -917,13 +915,12 @@ int w83977af_dma_receive_complete(struct w83977af_ir *self) /* Move to next frame */ self->rx_buff.data += len; - self->stats.rx_packets++; + self->netdev->stats.rx_packets++; skb->dev = self->netdev; skb_reset_mac_header(skb); skb->protocol = htons(ETH_P_IRDA); netif_rx(skb); - self->netdev->last_rx = jiffies; } } /* Restore set register */ @@ -952,7 +949,7 @@ static void w83977af_pio_receive(struct w83977af_ir *self) /* Receive all characters in Rx FIFO */ do { byte = inb(iobase+RBR); - async_unwrap_char(self->netdev, &self->stats, &self->rx_buff, + async_unwrap_char(self->netdev, &self->netdev->stats, &self->rx_buff, byte); } while (inb(iobase+USR) & USR_RDR); /* Data available */ } @@ -995,7 +992,7 @@ static __u8 w83977af_sir_interrupt(struct w83977af_ir *self, int isr) outb(AUDR_SFEND, iobase+AUDR); outb(set, iobase+SSR); - self->stats.tx_packets++; + self->netdev->stats.tx_packets++; /* Feed me more packets */ netif_wake_queue(self->netdev); @@ -1119,7 +1116,7 @@ static irqreturn_t w83977af_interrupt(int irq, void *dev_id) __u8 set, icr, isr; int iobase; - self = dev->priv; + self = netdev_priv(dev); iobase = self->io.fir_base; @@ -1192,7 +1189,7 @@ static int w83977af_net_open(struct net_device *dev) IRDA_DEBUG(0, "%s()\n", __func__ ); IRDA_ASSERT(dev != NULL, return -1;); - self = (struct w83977af_ir *) dev->priv; + self = netdev_priv(dev); IRDA_ASSERT(self != NULL, return 0;); @@ -1256,7 +1253,7 @@ static int w83977af_net_close(struct net_device *dev) IRDA_ASSERT(dev != NULL, return -1;); - self = (struct w83977af_ir *) dev->priv; + self = netdev_priv(dev); IRDA_ASSERT(self != NULL, return 0;); @@ -1303,7 +1300,7 @@ static int w83977af_net_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) IRDA_ASSERT(dev != NULL, return -1;); - self = dev->priv; + self = netdev_priv(dev); IRDA_ASSERT(self != NULL, return -1;); @@ -1337,13 +1334,6 @@ out: return ret; } -static struct net_device_stats *w83977af_net_get_stats(struct net_device *dev) -{ - struct w83977af_ir *self = (struct w83977af_ir *) dev->priv; - - return &self->stats; -} - MODULE_AUTHOR("Dag Brattli <dagb@cs.uit.no>"); MODULE_DESCRIPTION("Winbond W83977AF IrDA Device Driver"); MODULE_LICENSE("GPL"); |