X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=drivers%2Fnet%2Feepro100.c;h=e28bb1e38f8d84c57376fa1c15ef9f604916024a;hb=97bf2856c6014879bd04983a3e9dfcdac1e7fe85;hp=8c62ced2c9b2304a99808f07a26ecb61ee0ce169;hpb=76828883507a47dae78837ab5dec5a5b4513c667;p=linux-2.6.git diff --git a/drivers/net/eepro100.c b/drivers/net/eepro100.c index 8c62ced2c..e28bb1e38 100644 --- a/drivers/net/eepro100.c +++ b/drivers/net/eepro100.c @@ -27,7 +27,7 @@ rx_align support: enables rx DMA without causing unaligned accesses. */ -static const char *version = +static const char * const version = "eepro100.c:v1.09j-t 9/29/99 Donald Becker http://www.scyld.com/network/eepro100.html\n" "eepro100.c: $Revision: 1.36 $ 2000/11/17 Modified by Andrey V. Savochkin and others\n"; @@ -87,7 +87,6 @@ static int options[] = {-1, -1, -1, -1, -1, -1, -1, -1}; /* Size of an pre-allocated Rx buffer: + slack.*/ #define PKT_BUF_SZ 1536 -#include #include #include @@ -278,11 +277,6 @@ having to sign an Intel NDA when I'm helping Intel sell their own product! static int speedo_found1(struct pci_dev *pdev, void __iomem *ioaddr, int fnd_cnt, int acpi_idle_state); -enum pci_flags_bit { - PCI_USES_IO=1, PCI_USES_MEM=2, PCI_USES_MASTER=4, - PCI_ADDR0=0x10<<0, PCI_ADDR1=0x10<<1, PCI_ADDR2=0x10<<2, PCI_ADDR3=0x10<<3, -}; - /* Offsets to the various registers. All accesses need not be longword aligned. */ enum speedo_offsets { @@ -469,7 +463,7 @@ static const char i82558_config_cmd[CONFIG_DATA_SIZE] = { 0x31, 0x05, }; /* PHY media interface chips. */ -static const char *phys[] = { +static const char * const phys[] = { "None", "i82553-A/B", "i82553-C", "i82503", "DP83840", "80c240", "80c24", "i82555", "unknown-8", "unknown-9", "DP83840A", "unknown-11", @@ -494,15 +488,15 @@ static int speedo_start_xmit(struct sk_buff *skb, struct net_device *dev); static void speedo_refill_rx_buffers(struct net_device *dev, int force); static int speedo_rx(struct net_device *dev); static void speedo_tx_buffer_gc(struct net_device *dev); -static irqreturn_t speedo_interrupt(int irq, void *dev_instance, struct pt_regs *regs); +static irqreturn_t speedo_interrupt(int irq, void *dev_instance); static int speedo_close(struct net_device *dev); static struct net_device_stats *speedo_get_stats(struct net_device *dev); static int speedo_ioctl(struct net_device *dev, struct ifreq *rq, int cmd); static void set_rx_mode(struct net_device *dev); static void speedo_show_state(struct net_device *dev); -static struct ethtool_ops ethtool_ops; +static const struct ethtool_ops ethtool_ops; + - #ifdef honor_default_port /* Optional driver feature to allow forcing the transceiver setting. @@ -561,12 +555,12 @@ static int __devinit eepro100_init_one (struct pci_dev *pdev, if (!request_region(pci_resource_start(pdev, 1), pci_resource_len(pdev, 1), "eepro100")) { - printk (KERN_ERR "eepro100: cannot reserve I/O ports\n"); + dev_err(&pdev->dev, "eepro100: cannot reserve I/O ports\n"); goto err_out_none; } if (!request_mem_region(pci_resource_start(pdev, 0), pci_resource_len(pdev, 0), "eepro100")) { - printk (KERN_ERR "eepro100: cannot reserve MMIO region\n"); + dev_err(&pdev->dev, "eepro100: cannot reserve MMIO region\n"); goto err_out_free_pio_region; } @@ -579,7 +573,7 @@ static int __devinit eepro100_init_one (struct pci_dev *pdev, ioaddr = pci_iomap(pdev, pci_bar, 0); if (!ioaddr) { - printk (KERN_ERR "eepro100: cannot remap IO\n"); + dev_err(&pdev->dev, "eepro100: cannot remap IO\n"); goto err_out_free_mmio_region; } @@ -612,7 +606,7 @@ static void poll_speedo (struct net_device *dev) /* disable_irq is not very nice, but with the funny lockless design we have no other choice. */ disable_irq(dev->irq); - speedo_interrupt (dev->irq, dev, NULL); + speedo_interrupt (dev->irq, dev); enable_irq(dev->irq); } #endif @@ -652,7 +646,7 @@ static int __devinit speedo_found1(struct pci_dev *pdev, option = 0; rtnl_lock(); - if (dev_alloc_name(dev, dev->name) < 0) + if (dev_alloc_name(dev, dev->name) < 0) goto err_free_unlock; /* Read the station address EEPROM before doing the reset. @@ -831,10 +825,10 @@ static int __devinit speedo_found1(struct pci_dev *pdev, sp->mii_if.dev = dev; sp->mii_if.mdio_read = mdio_read; sp->mii_if.mdio_write = mdio_write; - + sp->rx_bug = (eeprom[3] & 0x03) == 3 ? 0 : 1; - if (((pdev->device > 0x1030 && (pdev->device < 0x103F))) - || (pdev->device == 0x2449) || (pdev->device == 0x2459) + if (((pdev->device > 0x1030 && (pdev->device < 0x103F))) + || (pdev->device == 0x2449) || (pdev->device == 0x2459) || (pdev->device == 0x245D)) { sp->chip_id = 1; } @@ -983,7 +977,7 @@ speedo_open(struct net_device *dev) sp->in_interrupt = 0; /* .. we can safely take handler calls during init. */ - retval = request_irq(dev->irq, &speedo_interrupt, SA_SHIRQ, dev->name, dev); + retval = request_irq(dev->irq, &speedo_interrupt, IRQF_SHARED, dev->name, dev); if (retval) { return retval; } @@ -1214,7 +1208,7 @@ static void speedo_show_state(struct net_device *dev) int i; if (netif_msg_pktdata(sp)) { - printk(KERN_DEBUG "%s: Tx ring dump, Tx queue %u / %u:\n", + printk(KERN_DEBUG "%s: Tx ring dump, Tx queue %u / %u:\n", dev->name, sp->cur_tx, sp->dirty_tx); for (i = 0; i < TX_RING_SIZE; i++) printk(KERN_DEBUG "%s: %c%c%2d %8.8x.\n", dev->name, @@ -1547,7 +1541,7 @@ static void speedo_tx_buffer_gc(struct net_device *dev) /* The interrupt handler does all of the Rx thread work and cleans up after the Tx thread. */ -static irqreturn_t speedo_interrupt(int irq, void *dev_instance, struct pt_regs *regs) +static irqreturn_t speedo_interrupt(int irq, void *dev_instance) { struct net_device *dev = (struct net_device *)dev_instance; struct speedo_private *sp; @@ -1592,7 +1586,7 @@ static irqreturn_t speedo_interrupt(int irq, void *dev_instance, struct pt_regs /* Always check if all rx buffers are allocated. --SAW */ speedo_refill_rx_buffers(dev, 0); - + spin_lock(&sp->lock); /* * The chip may have suspended reception for various reasons. @@ -1613,8 +1607,8 @@ static irqreturn_t speedo_interrupt(int irq, void *dev_instance, struct pt_regs /* these are all reserved values */ break; } - - + + /* User interrupt, Command/Tx unit interrupt or CU not active. */ if (status & 0xA400) { speedo_tx_buffer_gc(dev); @@ -1625,7 +1619,7 @@ static irqreturn_t speedo_interrupt(int irq, void *dev_instance, struct pt_regs netif_wake_queue(dev); /* Attention: under a spinlock. --SAW */ } } - + spin_unlock(&sp->lock); if (--boguscnt < 0) { @@ -2021,7 +2015,7 @@ static void speedo_set_msglevel(struct net_device *dev, u32 v) sp->msg_enable = v; } -static struct ethtool_ops ethtool_ops = { +static const struct ethtool_ops ethtool_ops = { .get_drvinfo = speedo_get_drvinfo, .get_settings = speedo_get_settings, .set_settings = speedo_set_settings, @@ -2269,7 +2263,7 @@ static void set_rx_mode(struct net_device *dev) sp->rx_mode = new_rx_mode; } - + #ifdef CONFIG_PM static int eepro100_suspend(struct pci_dev *pdev, pm_message_t state) { @@ -2281,12 +2275,12 @@ static int eepro100_suspend(struct pci_dev *pdev, pm_message_t state) if (!netif_running(dev)) return 0; - + del_timer_sync(&sp->timer); netif_device_detach(dev); iowrite32(PortPartialReset, ioaddr + SCBPort); - + /* XXX call pci_set_power_state ()? */ pci_disable_device(pdev); pci_set_power_state (pdev, PCI_D3hot); @@ -2330,7 +2324,7 @@ static void __devexit eepro100_remove_one (struct pci_dev *pdev) { struct net_device *dev = pci_get_drvdata (pdev); struct speedo_private *sp = netdev_priv(dev); - + unregister_netdev(dev); release_region(pci_resource_start(pdev, 1), pci_resource_len(pdev, 1)); @@ -2343,7 +2337,7 @@ static void __devexit eepro100_remove_one (struct pci_dev *pdev) pci_disable_device(pdev); free_netdev(dev); } - + static struct pci_device_id eepro100_pci_tbl[] = { { PCI_VENDOR_ID_INTEL, 0x1229, PCI_ANY_ID, PCI_ANY_ID, }, { PCI_VENDOR_ID_INTEL, 0x1209, PCI_ANY_ID, PCI_ANY_ID, }, @@ -2374,7 +2368,7 @@ static struct pci_device_id eepro100_pci_tbl[] = { { 0,} }; MODULE_DEVICE_TABLE(pci, eepro100_pci_tbl); - + static struct pci_driver eepro100_driver = { .name = "eepro100", .id_table = eepro100_pci_tbl, @@ -2391,7 +2385,7 @@ static int __init eepro100_init_module(void) #ifdef MODULE printk(version); #endif - return pci_module_init(&eepro100_driver); + return pci_register_driver(&eepro100_driver); } static void __exit eepro100_cleanup_module(void) @@ -2401,7 +2395,7 @@ static void __exit eepro100_cleanup_module(void) module_init(eepro100_init_module); module_exit(eepro100_cleanup_module); - + /* * Local variables: * compile-command: "gcc -DMODULE -D__KERNEL__ -I/usr/src/linux/net/inet -Wall -Wstrict-prototypes -O6 -c eepro100.c `[ -f /usr/include/linux/modversions.h ] && echo -DMODVERSIONS`"