aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/r6040.c
diff options
context:
space:
mode:
authorFrancois Romieu <romieu@fr.zoreil.com>2007-11-28 17:02:33 -0500
committerDavid S. Miller <davem@davemloft.net>2008-01-28 18:04:16 -0500
commit5ac5d616327bdbdf632bdf4dc9ae09477f79b6b3 (patch)
tree4c118a77b2b185833ed06ada6838ab1113c74551 /drivers/net/r6040.c
parente6a9ea105222ad588d680b5e67dddb02dad3667a (diff)
r6040: cleanups
- whitespaces vs tabs - use 80 cols - use if_mii - use netdev_priv - remove useless cast to void * - PCI device id does not need to be globally available Signed-off-by: Francois Romieu <romieu@fr.zoreil.com>
Diffstat (limited to 'drivers/net/r6040.c')
-rw-r--r--drivers/net/r6040.c33
1 files changed, 13 insertions, 20 deletions
diff --git a/drivers/net/r6040.c b/drivers/net/r6040.c
index 71aa4783efd9..2334f4ebf907 100644
--- a/drivers/net/r6040.c
+++ b/drivers/net/r6040.c
@@ -3,7 +3,7 @@
3 * 3 *
4 * Copyright (C) 2004 Sten Wang <sten.wang@rdc.com.tw> 4 * Copyright (C) 2004 Sten Wang <sten.wang@rdc.com.tw>
5 * Copyright (C) 2007 5 * Copyright (C) 2007
6 * Daniel Gimpelevich <daniel@gimpelevich.san-francisco.ca.us> 6 * Daniel Gimpelevich <daniel@gimpelevich.san-francisco.ca.us>
7 * Florian Fainelli <florian@openwrt.org> 7 * Florian Fainelli <florian@openwrt.org>
8 * 8 *
9 * This program is free software; you can redistribute it and/or 9 * This program is free software; you can redistribute it and/or
@@ -60,7 +60,7 @@
60#define PHY_CAP 0x01E1 /* PHY CHIP Register 4 */ 60#define PHY_CAP 0x01E1 /* PHY CHIP Register 4 */
61 61
62/* Time in jiffies before concluding the transmitter is hung. */ 62/* Time in jiffies before concluding the transmitter is hung. */
63#define TX_TIMEOUT (6000 * HZ / 1000) 63#define TX_TIMEOUT (6000 * HZ / 1000)
64#define TIMER_WUT (jiffies + HZ * 1)/* timer wakeup time : 1 second */ 64#define TIMER_WUT (jiffies + HZ * 1)/* timer wakeup time : 1 second */
65 65
66/* RDC MAC I/O Size */ 66/* RDC MAC I/O Size */
@@ -235,8 +235,7 @@ static void mdio_write(struct net_device *dev, int mii_id, int reg, int val)
235 phy_write(ioaddr, lp->phy_addr, reg, val); 235 phy_write(ioaddr, lp->phy_addr, reg, val);
236} 236}
237 237
238static void 238static void r6040_tx_timeout(struct net_device *dev)
239r6040_tx_timeout(struct net_device *dev)
240{ 239{
241 struct r6040_private *priv = netdev_priv(dev); 240 struct r6040_private *priv = netdev_priv(dev);
242 241
@@ -341,8 +340,7 @@ static void r6040_down(struct net_device *dev)
341 pci_free_consistent(pdev, TX_DESC_SIZE, lp->tx_ring, lp->tx_ring_dma); 340 pci_free_consistent(pdev, TX_DESC_SIZE, lp->tx_ring, lp->tx_ring_dma);
342} 341}
343 342
344static int 343static int r6040_close(struct net_device *dev)
345r6040_close(struct net_device *dev)
346{ 344{
347 struct r6040_private *lp = netdev_priv(dev); 345 struct r6040_private *lp = netdev_priv(dev);
348 346
@@ -405,7 +403,7 @@ static void r6040_set_carrier(struct mii_if_info *mii)
405static int r6040_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) 403static int r6040_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
406{ 404{
407 struct r6040_private *lp = netdev_priv(dev); 405 struct r6040_private *lp = netdev_priv(dev);
408 struct mii_ioctl_data *data = (struct mii_ioctl_data *) &rq->ifr_data; 406 struct mii_ioctl_data *data = if_mii(rq);
409 int rc; 407 int rc;
410 408
411 if (!netif_running(dev)) 409 if (!netif_running(dev))
@@ -574,12 +572,11 @@ static irqreturn_t r6040_interrupt(int irq, void *dev_id)
574static void r6040_poll_controller(struct net_device *dev) 572static void r6040_poll_controller(struct net_device *dev)
575{ 573{
576 disable_irq(dev->irq); 574 disable_irq(dev->irq);
577 r6040_interrupt(dev->irq, (void *)dev); 575 r6040_interrupt(dev->irq, dev);
578 enable_irq(dev->irq); 576 enable_irq(dev->irq);
579} 577}
580#endif 578#endif
581 579
582
583static void r6040_init_ring_desc(struct r6040_descriptor *desc_ring, 580static void r6040_init_ring_desc(struct r6040_descriptor *desc_ring,
584 dma_addr_t desc_dma, int size) 581 dma_addr_t desc_dma, int size)
585{ 582{
@@ -716,10 +713,9 @@ static void r6040_mac_address(struct net_device *dev)
716 iowrite16(adrp[2], ioaddr + MID_0H); 713 iowrite16(adrp[2], ioaddr + MID_0H);
717} 714}
718 715
719static int 716static int r6040_open(struct net_device *dev)
720r6040_open(struct net_device *dev)
721{ 717{
722 struct r6040_private *lp = dev->priv; 718 struct r6040_private *lp = netdev_priv(dev);
723 int ret; 719 int ret;
724 720
725 /* Request IRQ and Register interrupt handler */ 721 /* Request IRQ and Register interrupt handler */
@@ -761,8 +757,7 @@ r6040_open(struct net_device *dev)
761 return 0; 757 return 0;
762} 758}
763 759
764static int 760static int r6040_start_xmit(struct sk_buff *skb, struct net_device *dev)
765r6040_start_xmit(struct sk_buff *skb, struct net_device *dev)
766{ 761{
767 struct r6040_private *lp = netdev_priv(dev); 762 struct r6040_private *lp = netdev_priv(dev);
768 struct r6040_descriptor *descptr; 763 struct r6040_descriptor *descptr;
@@ -810,8 +805,7 @@ r6040_start_xmit(struct sk_buff *skb, struct net_device *dev)
810 return ret; 805 return ret;
811} 806}
812 807
813static void 808static void r6040_multicast_list(struct net_device *dev)
814r6040_multicast_list(struct net_device *dev)
815{ 809{
816 struct r6040_private *lp = netdev_priv(dev); 810 struct r6040_private *lp = netdev_priv(dev);
817 void __iomem *ioaddr = lp->base; 811 void __iomem *ioaddr = lp->base;
@@ -938,7 +932,6 @@ static struct ethtool_ops netdev_ethtool_ops = {
938 .get_link = netdev_get_link, 932 .get_link = netdev_get_link,
939}; 933};
940 934
941
942static int __devinit r6040_init_one(struct pci_dev *pdev, 935static int __devinit r6040_init_one(struct pci_dev *pdev,
943 const struct pci_device_id *ent) 936 const struct pci_device_id *ent)
944{ 937{
@@ -1075,13 +1068,13 @@ static void __devexit r6040_remove_one(struct pci_dev *pdev)
1075 1068
1076 1069
1077static struct pci_device_id r6040_pci_tbl[] = { 1070static struct pci_device_id r6040_pci_tbl[] = {
1078 { PCI_DEVICE(PCI_VENDOR_ID_RDC, PCI_DEVICE_ID_RDC_R6040) }, 1071 { PCI_DEVICE(PCI_VENDOR_ID_RDC, 0x6040) },
1079 {0 } 1072 { 0 }
1080}; 1073};
1081MODULE_DEVICE_TABLE(pci, r6040_pci_tbl); 1074MODULE_DEVICE_TABLE(pci, r6040_pci_tbl);
1082 1075
1083static struct pci_driver r6040_driver = { 1076static struct pci_driver r6040_driver = {
1084 .name = "r6040", 1077 .name = DRV_NAME,
1085 .id_table = r6040_pci_tbl, 1078 .id_table = r6040_pci_tbl,
1086 .probe = r6040_init_one, 1079 .probe = r6040_init_one,
1087 .remove = __devexit_p(r6040_remove_one), 1080 .remove = __devexit_p(r6040_remove_one),