aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/depca.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/depca.c')
-rw-r--r--drivers/net/depca.c54
1 files changed, 28 insertions, 26 deletions
diff --git a/drivers/net/depca.c b/drivers/net/depca.c
index ace39ec0a367..e4cef491dc73 100644
--- a/drivers/net/depca.c
+++ b/drivers/net/depca.c
@@ -573,7 +573,6 @@ static int __init depca_hw_init (struct net_device *dev, struct device *device)
573 s16 nicsr; 573 s16 nicsr;
574 u_long ioaddr; 574 u_long ioaddr;
575 u_long mem_start; 575 u_long mem_start;
576 DECLARE_MAC_BUF(mac);
577 576
578 /* 577 /*
579 * We are now supposed to enter this function with the 578 * We are now supposed to enter this function with the
@@ -601,7 +600,7 @@ static int __init depca_hw_init (struct net_device *dev, struct device *device)
601 return -ENXIO; 600 return -ENXIO;
602 } 601 }
603 602
604 lp = (struct depca_private *) dev->priv; 603 lp = netdev_priv(dev);
605 mem_start = lp->mem_start; 604 mem_start = lp->mem_start;
606 605
607 if (!mem_start || lp->adapter < DEPCA || lp->adapter >=unknown) 606 if (!mem_start || lp->adapter < DEPCA || lp->adapter >=unknown)
@@ -633,7 +632,7 @@ static int __init depca_hw_init (struct net_device *dev, struct device *device)
633 632
634 printk(", h/w address "); 633 printk(", h/w address ");
635 status = get_hw_addr(dev); 634 status = get_hw_addr(dev);
636 printk("%s", print_mac(mac, dev->dev_addr)); 635 printk("%pM", dev->dev_addr);
637 if (status != 0) { 636 if (status != 0) {
638 printk(" which has an Ethernet PROM CRC error.\n"); 637 printk(" which has an Ethernet PROM CRC error.\n");
639 return -ENXIO; 638 return -ENXIO;
@@ -821,7 +820,7 @@ out_priv:
821 820
822static int depca_open(struct net_device *dev) 821static int depca_open(struct net_device *dev)
823{ 822{
824 struct depca_private *lp = (struct depca_private *) dev->priv; 823 struct depca_private *lp = netdev_priv(dev);
825 u_long ioaddr = dev->base_addr; 824 u_long ioaddr = dev->base_addr;
826 s16 nicsr; 825 s16 nicsr;
827 int status = 0; 826 int status = 0;
@@ -866,7 +865,7 @@ static int depca_open(struct net_device *dev)
866/* Initialize the lance Rx and Tx descriptor rings. */ 865/* Initialize the lance Rx and Tx descriptor rings. */
867static void depca_init_ring(struct net_device *dev) 866static void depca_init_ring(struct net_device *dev)
868{ 867{
869 struct depca_private *lp = (struct depca_private *) dev->priv; 868 struct depca_private *lp = netdev_priv(dev);
870 u_int i; 869 u_int i;
871 u_long offset; 870 u_long offset;
872 871
@@ -924,7 +923,7 @@ static void depca_tx_timeout(struct net_device *dev)
924*/ 923*/
925static int depca_start_xmit(struct sk_buff *skb, struct net_device *dev) 924static int depca_start_xmit(struct sk_buff *skb, struct net_device *dev)
926{ 925{
927 struct depca_private *lp = (struct depca_private *) dev->priv; 926 struct depca_private *lp = netdev_priv(dev);
928 u_long ioaddr = dev->base_addr; 927 u_long ioaddr = dev->base_addr;
929 int status = 0; 928 int status = 0;
930 929
@@ -972,7 +971,7 @@ static irqreturn_t depca_interrupt(int irq, void *dev_id)
972 return IRQ_NONE; 971 return IRQ_NONE;
973 } 972 }
974 973
975 lp = (struct depca_private *) dev->priv; 974 lp = netdev_priv(dev);
976 ioaddr = dev->base_addr; 975 ioaddr = dev->base_addr;
977 976
978 spin_lock(&lp->lock); 977 spin_lock(&lp->lock);
@@ -1010,7 +1009,7 @@ static irqreturn_t depca_interrupt(int irq, void *dev_id)
1010/* Called with lp->lock held */ 1009/* Called with lp->lock held */
1011static int depca_rx(struct net_device *dev) 1010static int depca_rx(struct net_device *dev)
1012{ 1011{
1013 struct depca_private *lp = (struct depca_private *) dev->priv; 1012 struct depca_private *lp = netdev_priv(dev);
1014 int i, entry; 1013 int i, entry;
1015 s32 status; 1014 s32 status;
1016 1015
@@ -1057,7 +1056,6 @@ static int depca_rx(struct net_device *dev)
1057 /* 1056 /*
1058 ** Update stats 1057 ** Update stats
1059 */ 1058 */
1060 dev->last_rx = jiffies;
1061 dev->stats.rx_packets++; 1059 dev->stats.rx_packets++;
1062 dev->stats.rx_bytes += pkt_len; 1060 dev->stats.rx_bytes += pkt_len;
1063 for (i = 1; i < DEPCA_PKT_STAT_SZ - 1; i++) { 1061 for (i = 1; i < DEPCA_PKT_STAT_SZ - 1; i++) {
@@ -1108,7 +1106,7 @@ static int depca_rx(struct net_device *dev)
1108*/ 1106*/
1109static int depca_tx(struct net_device *dev) 1107static int depca_tx(struct net_device *dev)
1110{ 1108{
1111 struct depca_private *lp = (struct depca_private *) dev->priv; 1109 struct depca_private *lp = netdev_priv(dev);
1112 int entry; 1110 int entry;
1113 s32 status; 1111 s32 status;
1114 u_long ioaddr = dev->base_addr; 1112 u_long ioaddr = dev->base_addr;
@@ -1149,7 +1147,7 @@ static int depca_tx(struct net_device *dev)
1149 1147
1150static int depca_close(struct net_device *dev) 1148static int depca_close(struct net_device *dev)
1151{ 1149{
1152 struct depca_private *lp = (struct depca_private *) dev->priv; 1150 struct depca_private *lp = netdev_priv(dev);
1153 s16 nicsr; 1151 s16 nicsr;
1154 u_long ioaddr = dev->base_addr; 1152 u_long ioaddr = dev->base_addr;
1155 1153
@@ -1185,7 +1183,7 @@ static int depca_close(struct net_device *dev)
1185 1183
1186static void LoadCSRs(struct net_device *dev) 1184static void LoadCSRs(struct net_device *dev)
1187{ 1185{
1188 struct depca_private *lp = (struct depca_private *) dev->priv; 1186 struct depca_private *lp = netdev_priv(dev);
1189 u_long ioaddr = dev->base_addr; 1187 u_long ioaddr = dev->base_addr;
1190 1188
1191 outw(CSR1, DEPCA_ADDR); /* initialisation block address LSW */ 1189 outw(CSR1, DEPCA_ADDR); /* initialisation block address LSW */
@@ -1202,7 +1200,7 @@ static void LoadCSRs(struct net_device *dev)
1202 1200
1203static int InitRestartDepca(struct net_device *dev) 1201static int InitRestartDepca(struct net_device *dev)
1204{ 1202{
1205 struct depca_private *lp = (struct depca_private *) dev->priv; 1203 struct depca_private *lp = netdev_priv(dev);
1206 u_long ioaddr = dev->base_addr; 1204 u_long ioaddr = dev->base_addr;
1207 int i, status = 0; 1205 int i, status = 0;
1208 1206
@@ -1234,7 +1232,7 @@ static int InitRestartDepca(struct net_device *dev)
1234*/ 1232*/
1235static void set_multicast_list(struct net_device *dev) 1233static void set_multicast_list(struct net_device *dev)
1236{ 1234{
1237 struct depca_private *lp = (struct depca_private *) dev->priv; 1235 struct depca_private *lp = netdev_priv(dev);
1238 u_long ioaddr = dev->base_addr; 1236 u_long ioaddr = dev->base_addr;
1239 1237
1240 netif_stop_queue(dev); 1238 netif_stop_queue(dev);
@@ -1263,7 +1261,7 @@ static void set_multicast_list(struct net_device *dev)
1263*/ 1261*/
1264static void SetMulticastFilter(struct net_device *dev) 1262static void SetMulticastFilter(struct net_device *dev)
1265{ 1263{
1266 struct depca_private *lp = (struct depca_private *) dev->priv; 1264 struct depca_private *lp = netdev_priv(dev);
1267 struct dev_mc_list *dmi = dev->mc_list; 1265 struct dev_mc_list *dmi = dev->mc_list;
1268 char *addrs; 1266 char *addrs;
1269 int i, j, bit, byte; 1267 int i, j, bit, byte;
@@ -1431,7 +1429,7 @@ static int __init depca_mca_probe(struct device *device)
1431 1429
1432 dev->irq = irq; 1430 dev->irq = irq;
1433 dev->base_addr = iobase; 1431 dev->base_addr = iobase;
1434 lp = dev->priv; 1432 lp = netdev_priv(dev);
1435 lp->depca_bus = DEPCA_BUS_MCA; 1433 lp->depca_bus = DEPCA_BUS_MCA;
1436 lp->adapter = depca_mca_adapter_type[mdev->index]; 1434 lp->adapter = depca_mca_adapter_type[mdev->index];
1437 lp->mem_start = mem_start; 1435 lp->mem_start = mem_start;
@@ -1534,7 +1532,7 @@ static int __init depca_isa_probe (struct platform_device *device)
1534 dev->base_addr = ioaddr; 1532 dev->base_addr = ioaddr;
1535 dev->irq = irq; /* Use whatever value the user gave 1533 dev->irq = irq; /* Use whatever value the user gave
1536 * us, and 0 if he didn't. */ 1534 * us, and 0 if he didn't. */
1537 lp = dev->priv; 1535 lp = netdev_priv(dev);
1538 lp->depca_bus = DEPCA_BUS_ISA; 1536 lp->depca_bus = DEPCA_BUS_ISA;
1539 lp->adapter = adapter; 1537 lp->adapter = adapter;
1540 lp->mem_start = mem_start; 1538 lp->mem_start = mem_start;
@@ -1558,6 +1556,7 @@ static int __init depca_isa_probe (struct platform_device *device)
1558#ifdef CONFIG_EISA 1556#ifdef CONFIG_EISA
1559static int __init depca_eisa_probe (struct device *device) 1557static int __init depca_eisa_probe (struct device *device)
1560{ 1558{
1559 enum depca_type adapter = unknown;
1561 struct eisa_device *edev; 1560 struct eisa_device *edev;
1562 struct net_device *dev; 1561 struct net_device *dev;
1563 struct depca_private *lp; 1562 struct depca_private *lp;
@@ -1576,11 +1575,15 @@ static int __init depca_eisa_probe (struct device *device)
1576 * the EISA configuration structures (yet... :-), just rely on 1575 * the EISA configuration structures (yet... :-), just rely on
1577 * the ISA probing to sort it out... */ 1576 * the ISA probing to sort it out... */
1578 1577
1579 depca_shmem_probe (&mem_start); 1578 adapter = depca_shmem_probe (&mem_start);
1579 if (adapter == unknown) {
1580 status = -ENODEV;
1581 goto out_free;
1582 }
1580 1583
1581 dev->base_addr = ioaddr; 1584 dev->base_addr = ioaddr;
1582 dev->irq = irq; 1585 dev->irq = irq;
1583 lp = dev->priv; 1586 lp = netdev_priv(dev);
1584 lp->depca_bus = DEPCA_BUS_EISA; 1587 lp->depca_bus = DEPCA_BUS_EISA;
1585 lp->adapter = edev->id.driver_data; 1588 lp->adapter = edev->id.driver_data;
1586 lp->mem_start = mem_start; 1589 lp->mem_start = mem_start;
@@ -1605,7 +1608,7 @@ static int __devexit depca_device_remove (struct device *device)
1605 int bus; 1608 int bus;
1606 1609
1607 dev = device->driver_data; 1610 dev = device->driver_data;
1608 lp = dev->priv; 1611 lp = netdev_priv(dev);
1609 1612
1610 unregister_netdev (dev); 1613 unregister_netdev (dev);
1611 iounmap (lp->sh_mem); 1614 iounmap (lp->sh_mem);
@@ -1747,7 +1750,7 @@ static int __init DevicePresent(u_long ioaddr)
1747static int __init get_hw_addr(struct net_device *dev) 1750static int __init get_hw_addr(struct net_device *dev)
1748{ 1751{
1749 u_long ioaddr = dev->base_addr; 1752 u_long ioaddr = dev->base_addr;
1750 struct depca_private *lp = dev->priv; 1753 struct depca_private *lp = netdev_priv(dev);
1751 int i, k, tmp, status = 0; 1754 int i, k, tmp, status = 0;
1752 u_short j, x, chksum; 1755 u_short j, x, chksum;
1753 1756
@@ -1782,7 +1785,7 @@ static int __init get_hw_addr(struct net_device *dev)
1782*/ 1785*/
1783static int load_packet(struct net_device *dev, struct sk_buff *skb) 1786static int load_packet(struct net_device *dev, struct sk_buff *skb)
1784{ 1787{
1785 struct depca_private *lp = (struct depca_private *) dev->priv; 1788 struct depca_private *lp = netdev_priv(dev);
1786 int i, entry, end, len, status = 0; 1789 int i, entry, end, len, status = 0;
1787 1790
1788 entry = lp->tx_new; /* Ring around buffer number. */ 1791 entry = lp->tx_new; /* Ring around buffer number. */
@@ -1837,11 +1840,10 @@ static int load_packet(struct net_device *dev, struct sk_buff *skb)
1837 1840
1838static void depca_dbg_open(struct net_device *dev) 1841static void depca_dbg_open(struct net_device *dev)
1839{ 1842{
1840 struct depca_private *lp = (struct depca_private *) dev->priv; 1843 struct depca_private *lp = netdev_priv(dev);
1841 u_long ioaddr = dev->base_addr; 1844 u_long ioaddr = dev->base_addr;
1842 struct depca_init *p = &lp->init_block; 1845 struct depca_init *p = &lp->init_block;
1843 int i; 1846 int i;
1844 DECLARE_MAC_BUF(mac);
1845 1847
1846 if (depca_debug > 1) { 1848 if (depca_debug > 1) {
1847 /* Do not copy the shadow init block into shared memory */ 1849 /* Do not copy the shadow init block into shared memory */
@@ -1880,7 +1882,7 @@ static void depca_dbg_open(struct net_device *dev)
1880 printk("...0x%8.8x\n", readl(&lp->tx_ring[i].base)); 1882 printk("...0x%8.8x\n", readl(&lp->tx_ring[i].base));
1881 printk("Initialisation block at 0x%8.8lx(Phys)\n", lp->mem_start); 1883 printk("Initialisation block at 0x%8.8lx(Phys)\n", lp->mem_start);
1882 printk(" mode: 0x%4.4x\n", p->mode); 1884 printk(" mode: 0x%4.4x\n", p->mode);
1883 printk(" physical address: %s\n", print_mac(mac, p->phys_addr)); 1885 printk(" physical address: %pM\n", p->phys_addr);
1884 printk(" multicast hash table: "); 1886 printk(" multicast hash table: ");
1885 for (i = 0; i < (HASH_TABLE_LEN >> 3) - 1; i++) { 1887 for (i = 0; i < (HASH_TABLE_LEN >> 3) - 1; i++) {
1886 printk("%2.2x:", p->mcast_table[i]); 1888 printk("%2.2x:", p->mcast_table[i]);
@@ -1909,7 +1911,7 @@ static void depca_dbg_open(struct net_device *dev)
1909*/ 1911*/
1910static int depca_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) 1912static int depca_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
1911{ 1913{
1912 struct depca_private *lp = (struct depca_private *) dev->priv; 1914 struct depca_private *lp = netdev_priv(dev);
1913 struct depca_ioctl *ioc = (struct depca_ioctl *) &rq->ifr_ifru; 1915 struct depca_ioctl *ioc = (struct depca_ioctl *) &rq->ifr_ifru;
1914 int i, status = 0; 1916 int i, status = 0;
1915 u_long ioaddr = dev->base_addr; 1917 u_long ioaddr = dev->base_addr;