X-Git-Url: http://ftp.safe.ca/?a=blobdiff_plain;f=drivers%2Fnet%2F3c59x.c;h=c56698402420ab5493c83fed72dc3f2b44089f47;hb=71fd570b23ee74bca052beb9e88f8f57fb668ac7;hp=491ee16da5c13e27097d1dd58606ad15933af4bb;hpb=9a5d3414202a21ed4b053657345ea0fd492d513a;p=safe%2Fjmp%2Flinux-2.6 diff --git a/drivers/net/3c59x.c b/drivers/net/3c59x.c index 491ee16..c566984 100644 --- a/drivers/net/3c59x.c +++ b/drivers/net/3c59x.c @@ -90,7 +90,7 @@ static int vortex_debug = 1; #include #include #include -#include /* For NR_IRQS only. */ +#include /* For nr_irqs only. */ #include #include @@ -102,8 +102,8 @@ static int vortex_debug = 1; #include -static char version[] __devinitdata = -DRV_NAME ": Donald Becker and others.\n"; +static const char version[] __devinitconst = + DRV_NAME ": Donald Becker and others.\n"; MODULE_AUTHOR("Donald Becker "); MODULE_DESCRIPTION("3Com 3c59x/3c9xx ethernet driver "); @@ -803,7 +803,7 @@ static int vortex_suspend(struct pci_dev *pdev, pm_message_t state) { struct net_device *dev = pci_get_drvdata(pdev); - if (dev && dev->priv) { + if (dev && netdev_priv(dev)) { if (netif_running(dev)) { netif_device_detach(dev); vortex_down(dev, 1); @@ -992,6 +992,42 @@ out: return rc; } +static const struct net_device_ops boomrang_netdev_ops = { + .ndo_open = vortex_open, + .ndo_stop = vortex_close, + .ndo_start_xmit = boomerang_start_xmit, + .ndo_tx_timeout = vortex_tx_timeout, + .ndo_get_stats = vortex_get_stats, +#ifdef CONFIG_PCI + .ndo_do_ioctl = vortex_ioctl, +#endif + .ndo_set_multicast_list = set_rx_mode, + .ndo_change_mtu = eth_change_mtu, + .ndo_set_mac_address = eth_mac_addr, + .ndo_validate_addr = eth_validate_addr, +#ifdef CONFIG_NET_POLL_CONTROLLER + .ndo_poll_controller = poll_vortex, +#endif +}; + +static const struct net_device_ops vortex_netdev_ops = { + .ndo_open = vortex_open, + .ndo_stop = vortex_close, + .ndo_start_xmit = vortex_start_xmit, + .ndo_tx_timeout = vortex_tx_timeout, + .ndo_get_stats = vortex_get_stats, +#ifdef CONFIG_PCI + .ndo_do_ioctl = vortex_ioctl, +#endif + .ndo_set_multicast_list = set_rx_mode, + .ndo_change_mtu = eth_change_mtu, + .ndo_set_mac_address = eth_mac_addr, + .ndo_validate_addr = eth_validate_addr, +#ifdef CONFIG_NET_POLL_CONTROLLER + .ndo_poll_controller = poll_vortex, +#endif +}; + /* * Start up the PCI/EISA device which is described by *gendev. * Return 0 on success. @@ -1013,7 +1049,6 @@ static int __devinit vortex_probe1(struct device *gendev, const char *print_name = "3c59x"; struct pci_dev *pdev = NULL; struct eisa_device *edev = NULL; - DECLARE_MAC_BUF(mac); if (!printed_version) { printk (version); @@ -1026,7 +1061,7 @@ static int __devinit vortex_probe1(struct device *gendev, } if ((edev = DEVICE_EISA(gendev))) { - print_name = edev->dev.bus_id; + print_name = dev_name(&edev->dev); } } @@ -1206,7 +1241,7 @@ static int __devinit vortex_probe1(struct device *gendev, ((__be16 *)dev->dev_addr)[i] = htons(eeprom[i + 10]); memcpy(dev->perm_addr, dev->dev_addr, dev->addr_len); if (print_info) - printk(" %s", print_mac(mac, dev->dev_addr)); + printk(" %pM", dev->dev_addr); /* Unfortunately an all zero eeprom passes the checksum and this gets found in the wild in failure cases. Crypto is hard 8) */ if (!is_valid_ether_addr(dev->dev_addr)) { @@ -1221,7 +1256,7 @@ static int __devinit vortex_probe1(struct device *gendev, if (print_info) printk(", IRQ %d\n", dev->irq); /* Tell them about an invalid IRQ. */ - if (dev->irq <= 0 || dev->irq >= NR_IRQS) + if (dev->irq <= 0 || dev->irq >= nr_irqs) printk(KERN_WARNING " *** Warning: IRQ %d is unlikely to work! ***\n", dev->irq); @@ -1367,18 +1402,16 @@ static int __devinit vortex_probe1(struct device *gendev, } /* The 3c59x-specific entries in the device structure. */ - dev->open = vortex_open; if (vp->full_bus_master_tx) { - dev->hard_start_xmit = boomerang_start_xmit; + dev->netdev_ops = &boomrang_netdev_ops; /* Actually, it still should work with iommu. */ if (card_idx < MAX_UNITS && ((hw_checksums[card_idx] == -1 && (vp->drv_flags & HAS_HWCKSM)) || hw_checksums[card_idx] == 1)) { dev->features |= NETIF_F_IP_CSUM | NETIF_F_SG; } - } else { - dev->hard_start_xmit = vortex_start_xmit; - } + } else + dev->netdev_ops = &vortex_netdev_ops; if (print_info) { printk(KERN_INFO "%s: scatter/gather %sabled. h/w checksums %sabled\n", @@ -1387,18 +1420,9 @@ static int __devinit vortex_probe1(struct device *gendev, (dev->features & NETIF_F_IP_CSUM) ? "en":"dis"); } - dev->stop = vortex_close; - dev->get_stats = vortex_get_stats; -#ifdef CONFIG_PCI - dev->do_ioctl = vortex_ioctl; -#endif dev->ethtool_ops = &vortex_ethtool_ops; - dev->set_multicast_list = set_rx_mode; - dev->tx_timeout = vortex_tx_timeout; dev->watchdog_timeo = (watchdog * HZ) / 1000; -#ifdef CONFIG_NET_POLL_CONTROLLER - dev->poll_controller = poll_vortex; -#endif + if (pdev) { vp->pm_state_valid = 1; pci_save_state(VORTEX_PCI(vp)); @@ -2447,7 +2471,6 @@ static int vortex_rx(struct net_device *dev) iowrite16(RxDiscard, ioaddr + EL3_CMD); /* Pop top Rx packet. */ skb->protocol = eth_type_trans(skb, dev); netif_rx(skb); - dev->last_rx = jiffies; dev->stats.rx_packets++; /* Wait a limited time to go to next packet. */ for (i = 200; i >= 0; i--) @@ -2530,7 +2553,6 @@ boomerang_rx(struct net_device *dev) } } netif_rx(skb); - dev->last_rx = jiffies; dev->stats.rx_packets++; } entry = (++vp->cur_rx) % RX_RING_SIZE; @@ -2886,7 +2908,7 @@ static void vortex_get_drvinfo(struct net_device *dev, strcpy(info->bus_info, pci_name(VORTEX_PCI(vp))); } else { if (VORTEX_EISA(vp)) - sprintf(info->bus_info, vp->gendev->bus_id); + strcpy(info->bus_info, dev_name(vp->gendev)); else sprintf(info->bus_info, "EISA 0x%lx %d", dev->base_addr, dev->irq); @@ -3112,6 +3134,8 @@ static void acpi_set_WOL(struct net_device *dev) struct vortex_private *vp = netdev_priv(dev); void __iomem *ioaddr = vp->ioaddr; + device_set_wakeup_enable(vp->gendev, vp->enable_wol); + if (vp->enable_wol) { /* Power up on: 1==Downloaded Filter, 2==Magic Packets, 4==Link Status. */ EL3WINDOW(7); @@ -3217,7 +3241,7 @@ static void __exit vortex_eisa_cleanup(void) #endif if (compaq_net_device) { - vp = compaq_net_device->priv; + vp = netdev_priv(compaq_net_device); ioaddr = ioport_map(compaq_net_device->base_addr, VORTEX_TOTAL_SIZE);