aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/eepro100.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/eepro100.c')
-rw-r--r--drivers/net/eepro100.c54
1 files changed, 24 insertions, 30 deletions
diff --git a/drivers/net/eepro100.c b/drivers/net/eepro100.c
index 467fc861360..499e93b31f5 100644
--- a/drivers/net/eepro100.c
+++ b/drivers/net/eepro100.c
@@ -87,7 +87,6 @@ static int options[] = {-1, -1, -1, -1, -1, -1, -1, -1};
87/* Size of an pre-allocated Rx buffer: <Ethernet MTU> + slack.*/ 87/* Size of an pre-allocated Rx buffer: <Ethernet MTU> + slack.*/
88#define PKT_BUF_SZ 1536 88#define PKT_BUF_SZ 1536
89 89
90#include <linux/config.h>
91#include <linux/module.h> 90#include <linux/module.h>
92 91
93#include <linux/kernel.h> 92#include <linux/kernel.h>
@@ -278,11 +277,6 @@ having to sign an Intel NDA when I'm helping Intel sell their own product!
278 277
279static int speedo_found1(struct pci_dev *pdev, void __iomem *ioaddr, int fnd_cnt, int acpi_idle_state); 278static int speedo_found1(struct pci_dev *pdev, void __iomem *ioaddr, int fnd_cnt, int acpi_idle_state);
280 279
281enum pci_flags_bit {
282 PCI_USES_IO=1, PCI_USES_MEM=2, PCI_USES_MASTER=4,
283 PCI_ADDR0=0x10<<0, PCI_ADDR1=0x10<<1, PCI_ADDR2=0x10<<2, PCI_ADDR3=0x10<<3,
284};
285
286/* Offsets to the various registers. 280/* Offsets to the various registers.
287 All accesses need not be longword aligned. */ 281 All accesses need not be longword aligned. */
288enum speedo_offsets { 282enum speedo_offsets {
@@ -500,9 +494,9 @@ static struct net_device_stats *speedo_get_stats(struct net_device *dev);
500static int speedo_ioctl(struct net_device *dev, struct ifreq *rq, int cmd); 494static int speedo_ioctl(struct net_device *dev, struct ifreq *rq, int cmd);
501static void set_rx_mode(struct net_device *dev); 495static void set_rx_mode(struct net_device *dev);
502static void speedo_show_state(struct net_device *dev); 496static void speedo_show_state(struct net_device *dev);
503static struct ethtool_ops ethtool_ops; 497static const struct ethtool_ops ethtool_ops;
498
504 499
505
506 500
507#ifdef honor_default_port 501#ifdef honor_default_port
508/* Optional driver feature to allow forcing the transceiver setting. 502/* Optional driver feature to allow forcing the transceiver setting.
@@ -561,12 +555,12 @@ static int __devinit eepro100_init_one (struct pci_dev *pdev,
561 555
562 if (!request_region(pci_resource_start(pdev, 1), 556 if (!request_region(pci_resource_start(pdev, 1),
563 pci_resource_len(pdev, 1), "eepro100")) { 557 pci_resource_len(pdev, 1), "eepro100")) {
564 printk (KERN_ERR "eepro100: cannot reserve I/O ports\n"); 558 dev_err(&pdev->dev, "eepro100: cannot reserve I/O ports\n");
565 goto err_out_none; 559 goto err_out_none;
566 } 560 }
567 if (!request_mem_region(pci_resource_start(pdev, 0), 561 if (!request_mem_region(pci_resource_start(pdev, 0),
568 pci_resource_len(pdev, 0), "eepro100")) { 562 pci_resource_len(pdev, 0), "eepro100")) {
569 printk (KERN_ERR "eepro100: cannot reserve MMIO region\n"); 563 dev_err(&pdev->dev, "eepro100: cannot reserve MMIO region\n");
570 goto err_out_free_pio_region; 564 goto err_out_free_pio_region;
571 } 565 }
572 566
@@ -579,7 +573,7 @@ static int __devinit eepro100_init_one (struct pci_dev *pdev,
579 573
580 ioaddr = pci_iomap(pdev, pci_bar, 0); 574 ioaddr = pci_iomap(pdev, pci_bar, 0);
581 if (!ioaddr) { 575 if (!ioaddr) {
582 printk (KERN_ERR "eepro100: cannot remap IO\n"); 576 dev_err(&pdev->dev, "eepro100: cannot remap IO\n");
583 goto err_out_free_mmio_region; 577 goto err_out_free_mmio_region;
584 } 578 }
585 579
@@ -652,7 +646,7 @@ static int __devinit speedo_found1(struct pci_dev *pdev,
652 option = 0; 646 option = 0;
653 647
654 rtnl_lock(); 648 rtnl_lock();
655 if (dev_alloc_name(dev, dev->name) < 0) 649 if (dev_alloc_name(dev, dev->name) < 0)
656 goto err_free_unlock; 650 goto err_free_unlock;
657 651
658 /* Read the station address EEPROM before doing the reset. 652 /* Read the station address EEPROM before doing the reset.
@@ -831,10 +825,10 @@ static int __devinit speedo_found1(struct pci_dev *pdev,
831 sp->mii_if.dev = dev; 825 sp->mii_if.dev = dev;
832 sp->mii_if.mdio_read = mdio_read; 826 sp->mii_if.mdio_read = mdio_read;
833 sp->mii_if.mdio_write = mdio_write; 827 sp->mii_if.mdio_write = mdio_write;
834 828
835 sp->rx_bug = (eeprom[3] & 0x03) == 3 ? 0 : 1; 829 sp->rx_bug = (eeprom[3] & 0x03) == 3 ? 0 : 1;
836 if (((pdev->device > 0x1030 && (pdev->device < 0x103F))) 830 if (((pdev->device > 0x1030 && (pdev->device < 0x103F)))
837 || (pdev->device == 0x2449) || (pdev->device == 0x2459) 831 || (pdev->device == 0x2449) || (pdev->device == 0x2459)
838 || (pdev->device == 0x245D)) { 832 || (pdev->device == 0x245D)) {
839 sp->chip_id = 1; 833 sp->chip_id = 1;
840 } 834 }
@@ -983,7 +977,7 @@ speedo_open(struct net_device *dev)
983 sp->in_interrupt = 0; 977 sp->in_interrupt = 0;
984 978
985 /* .. we can safely take handler calls during init. */ 979 /* .. we can safely take handler calls during init. */
986 retval = request_irq(dev->irq, &speedo_interrupt, SA_SHIRQ, dev->name, dev); 980 retval = request_irq(dev->irq, &speedo_interrupt, IRQF_SHARED, dev->name, dev);
987 if (retval) { 981 if (retval) {
988 return retval; 982 return retval;
989 } 983 }
@@ -1214,7 +1208,7 @@ static void speedo_show_state(struct net_device *dev)
1214 int i; 1208 int i;
1215 1209
1216 if (netif_msg_pktdata(sp)) { 1210 if (netif_msg_pktdata(sp)) {
1217 printk(KERN_DEBUG "%s: Tx ring dump, Tx queue %u / %u:\n", 1211 printk(KERN_DEBUG "%s: Tx ring dump, Tx queue %u / %u:\n",
1218 dev->name, sp->cur_tx, sp->dirty_tx); 1212 dev->name, sp->cur_tx, sp->dirty_tx);
1219 for (i = 0; i < TX_RING_SIZE; i++) 1213 for (i = 0; i < TX_RING_SIZE; i++)
1220 printk(KERN_DEBUG "%s: %c%c%2d %8.8x.\n", dev->name, 1214 printk(KERN_DEBUG "%s: %c%c%2d %8.8x.\n", dev->name,
@@ -1592,7 +1586,7 @@ static irqreturn_t speedo_interrupt(int irq, void *dev_instance, struct pt_regs
1592 1586
1593 /* Always check if all rx buffers are allocated. --SAW */ 1587 /* Always check if all rx buffers are allocated. --SAW */
1594 speedo_refill_rx_buffers(dev, 0); 1588 speedo_refill_rx_buffers(dev, 0);
1595 1589
1596 spin_lock(&sp->lock); 1590 spin_lock(&sp->lock);
1597 /* 1591 /*
1598 * The chip may have suspended reception for various reasons. 1592 * 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
1613 /* these are all reserved values */ 1607 /* these are all reserved values */
1614 break; 1608 break;
1615 } 1609 }
1616 1610
1617 1611
1618 /* User interrupt, Command/Tx unit interrupt or CU not active. */ 1612 /* User interrupt, Command/Tx unit interrupt or CU not active. */
1619 if (status & 0xA400) { 1613 if (status & 0xA400) {
1620 speedo_tx_buffer_gc(dev); 1614 speedo_tx_buffer_gc(dev);
@@ -1625,7 +1619,7 @@ static irqreturn_t speedo_interrupt(int irq, void *dev_instance, struct pt_regs
1625 netif_wake_queue(dev); /* Attention: under a spinlock. --SAW */ 1619 netif_wake_queue(dev); /* Attention: under a spinlock. --SAW */
1626 } 1620 }
1627 } 1621 }
1628 1622
1629 spin_unlock(&sp->lock); 1623 spin_unlock(&sp->lock);
1630 1624
1631 if (--boguscnt < 0) { 1625 if (--boguscnt < 0) {
@@ -2021,7 +2015,7 @@ static void speedo_set_msglevel(struct net_device *dev, u32 v)
2021 sp->msg_enable = v; 2015 sp->msg_enable = v;
2022} 2016}
2023 2017
2024static struct ethtool_ops ethtool_ops = { 2018static const struct ethtool_ops ethtool_ops = {
2025 .get_drvinfo = speedo_get_drvinfo, 2019 .get_drvinfo = speedo_get_drvinfo,
2026 .get_settings = speedo_get_settings, 2020 .get_settings = speedo_get_settings,
2027 .set_settings = speedo_set_settings, 2021 .set_settings = speedo_set_settings,
@@ -2269,7 +2263,7 @@ static void set_rx_mode(struct net_device *dev)
2269 2263
2270 sp->rx_mode = new_rx_mode; 2264 sp->rx_mode = new_rx_mode;
2271} 2265}
2272 2266
2273#ifdef CONFIG_PM 2267#ifdef CONFIG_PM
2274static int eepro100_suspend(struct pci_dev *pdev, pm_message_t state) 2268static int eepro100_suspend(struct pci_dev *pdev, pm_message_t state)
2275{ 2269{
@@ -2281,12 +2275,12 @@ static int eepro100_suspend(struct pci_dev *pdev, pm_message_t state)
2281 2275
2282 if (!netif_running(dev)) 2276 if (!netif_running(dev))
2283 return 0; 2277 return 0;
2284 2278
2285 del_timer_sync(&sp->timer); 2279 del_timer_sync(&sp->timer);
2286 2280
2287 netif_device_detach(dev); 2281 netif_device_detach(dev);
2288 iowrite32(PortPartialReset, ioaddr + SCBPort); 2282 iowrite32(PortPartialReset, ioaddr + SCBPort);
2289 2283
2290 /* XXX call pci_set_power_state ()? */ 2284 /* XXX call pci_set_power_state ()? */
2291 pci_disable_device(pdev); 2285 pci_disable_device(pdev);
2292 pci_set_power_state (pdev, PCI_D3hot); 2286 pci_set_power_state (pdev, PCI_D3hot);
@@ -2330,7 +2324,7 @@ static void __devexit eepro100_remove_one (struct pci_dev *pdev)
2330{ 2324{
2331 struct net_device *dev = pci_get_drvdata (pdev); 2325 struct net_device *dev = pci_get_drvdata (pdev);
2332 struct speedo_private *sp = netdev_priv(dev); 2326 struct speedo_private *sp = netdev_priv(dev);
2333 2327
2334 unregister_netdev(dev); 2328 unregister_netdev(dev);
2335 2329
2336 release_region(pci_resource_start(pdev, 1), pci_resource_len(pdev, 1)); 2330 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)
2343 pci_disable_device(pdev); 2337 pci_disable_device(pdev);
2344 free_netdev(dev); 2338 free_netdev(dev);
2345} 2339}
2346 2340
2347static struct pci_device_id eepro100_pci_tbl[] = { 2341static struct pci_device_id eepro100_pci_tbl[] = {
2348 { PCI_VENDOR_ID_INTEL, 0x1229, PCI_ANY_ID, PCI_ANY_ID, }, 2342 { PCI_VENDOR_ID_INTEL, 0x1229, PCI_ANY_ID, PCI_ANY_ID, },
2349 { PCI_VENDOR_ID_INTEL, 0x1209, PCI_ANY_ID, PCI_ANY_ID, }, 2343 { PCI_VENDOR_ID_INTEL, 0x1209, PCI_ANY_ID, PCI_ANY_ID, },
@@ -2374,7 +2368,7 @@ static struct pci_device_id eepro100_pci_tbl[] = {
2374 { 0,} 2368 { 0,}
2375}; 2369};
2376MODULE_DEVICE_TABLE(pci, eepro100_pci_tbl); 2370MODULE_DEVICE_TABLE(pci, eepro100_pci_tbl);
2377 2371
2378static struct pci_driver eepro100_driver = { 2372static struct pci_driver eepro100_driver = {
2379 .name = "eepro100", 2373 .name = "eepro100",
2380 .id_table = eepro100_pci_tbl, 2374 .id_table = eepro100_pci_tbl,
@@ -2391,7 +2385,7 @@ static int __init eepro100_init_module(void)
2391#ifdef MODULE 2385#ifdef MODULE
2392 printk(version); 2386 printk(version);
2393#endif 2387#endif
2394 return pci_module_init(&eepro100_driver); 2388 return pci_register_driver(&eepro100_driver);
2395} 2389}
2396 2390
2397static void __exit eepro100_cleanup_module(void) 2391static void __exit eepro100_cleanup_module(void)
@@ -2401,7 +2395,7 @@ static void __exit eepro100_cleanup_module(void)
2401 2395
2402module_init(eepro100_init_module); 2396module_init(eepro100_init_module);
2403module_exit(eepro100_cleanup_module); 2397module_exit(eepro100_cleanup_module);
2404 2398
2405/* 2399/*
2406 * Local variables: 2400 * Local variables:
2407 * 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`" 2401 * 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`"