changes:
* enable-device and other pci cleanup
* a few s/ERRNO/-ERRNO/ changes
* fix build and lame-o problems in pcnet32
* toshoboe irda driver gets better initcall setup
* skge small misc cleanups (unnecessary memset, for example)
--
Jeff Garzik | Liberty is always dangerous, but
Building 1024 | it is the safest thing we have.
MandrakeSoft, Inc. | -- Harry Emerson Fosdick
diff -urN vanilla/linux-2.3.99-pre10-pre3/drivers/net/aironet4500_card.c
linux_2_3/drivers/net/aironet4500_card.c
--- vanilla/linux-2.3.99-pre10-pre3/drivers/net/aironet4500_card.c Sat Apr 29
02:00:05 2000
+++ linux_2_3/drivers/net/aironet4500_card.c Thu May 25 06:19:22 2000
@@ -98,6 +98,8 @@
pdev = pci_find_slot(awc_pci_bus, awc_pci_dev);
if (!pdev)
continue;
+ if (pci_enable_device(pdev))
+ continue;
vendor = pdev->vendor;
device = pdev->device;
pci_irq_line = pdev->irq;
diff -urN vanilla/linux-2.3.99-pre10-pre3/drivers/net/defxx.c
linux_2_3/drivers/net/defxx.c
--- vanilla/linux-2.3.99-pre10-pre3/drivers/net/defxx.c Tue Apr 11 02:09:01 2000
+++ linux_2_3/drivers/net/defxx.c Thu May 25 06:19:22 2000
@@ -500,6 +500,9 @@
printk(version); /* we
only display this string ONCE */
}
+ if (pci_enable_device(pdev))
+ continue;
+
/* Verify that I/O enable bit is set (PCI slot is enabled) */
pci_read_config_word(pdev, PCI_COMMAND, &command);
@@ -515,7 +518,7 @@
/* Get I/O base address from PCI Configuration Space */
- port = pdev->resource[1].start;
+ port = pci_resource_start (pdev, 1);
/* Verify port address range is not already being used
*/
diff -urN vanilla/linux-2.3.99-pre10-pre3/drivers/net/dmfe.c
linux_2_3/drivers/net/dmfe.c
--- vanilla/linux-2.3.99-pre10-pre3/drivers/net/dmfe.c Sat Apr 29 02:00:05 2000
+++ linux_2_3/drivers/net/dmfe.c Thu May 25 06:19:22 2000
@@ -359,15 +359,16 @@
if (pci_read_config_dword(net_dev, PCI_VENDOR_ID, &pci_id) !=
DMFE_SUCC)
continue;
- if ((pci_id != PCI_DM9102_ID) && (pci_id != PCI_DM9132_ID))
+ if ((net_dev->device != PCI_DM9102_ID) && (net_dev->device !=
+PCI_DM9132_ID))
continue;
- pci_iobase = net_dev->resource[0].start;
+ pci_iobase = pci_resource_start (net_dev, 0);
pci_irqline = net_dev->irq;
/* Enable Master/IO access, Disable memory access */
- pci_enable_device (net_dev); /* XXX check return val */
+ if (pci_enable_device(net_dev))
+ continue;
pci_set_master(net_dev);
/* Set Latency Timer 80h */
diff -urN vanilla/linux-2.3.99-pre10-pre3/drivers/net/fc/iph5526.c
linux_2_3/drivers/net/fc/iph5526.c
--- vanilla/linux-2.3.99-pre10-pre3/drivers/net/fc/iph5526.c Mon Feb 28 10:16:54
2000
+++ linux_2_3/drivers/net/fc/iph5526.c Thu May 25 06:19:24 2000
@@ -3771,7 +3771,9 @@
for (i = 0; i < clone_list[i].vendor_id != 0; i++)
while ((pdev = pci_find_device(clone_list[i].vendor_id,
clone_list[i].device_id, pdev))) {
- unsigned short pci_command;
+ unsigned short pci_command;
+ if (pci_enable_device(pdev))
+ continue;
if (count < MAX_FC_CARDS) {
fc[count] = kmalloc(sizeof(struct fc_info), GFP_ATOMIC);
if (fc[count] == NULL) {
diff -urN vanilla/linux-2.3.99-pre10-pre3/drivers/net/ioc3-eth.c
linux_2_3/drivers/net/ioc3-eth.c
--- vanilla/linux-2.3.99-pre10-pre3/drivers/net/ioc3-eth.c Sat May 13 11:29:40
2000
+++ linux_2_3/drivers/net/ioc3-eth.c Thu May 25 06:19:22 2000
@@ -905,6 +905,8 @@
struct pci_dev *dev = NULL;
while ((dev = pci_find_device(PCI_VENDOR_ID_SGI, 0x0003, dev))) {
+ if (pci_enable_device(dev))
+ continue;
ioc3_init(&p, dev);
}
diff -urN vanilla/linux-2.3.99-pre10-pre3/drivers/net/irda/toshoboe.c
linux_2_3/drivers/net/irda/toshoboe.c
--- vanilla/linux-2.3.99-pre10-pre3/drivers/net/irda/toshoboe.c Tue Mar 21 14:17:28
2000
+++ linux_2_3/drivers/net/irda/toshoboe.c Thu May 25 08:03:31 2000
@@ -717,7 +717,7 @@
self->open = 0;
self->stopped = 0;
self->pdev = pci_dev;
- self->base = pci_dev->resource[0].start;
+ self->base = pci_resource_start (pci_dev, 0);
self->io.sir_base = self->base;
self->io.irq = pci_dev->irq;
@@ -900,7 +900,6 @@
static void
toshoboe_wakeup (struct toshoboe_cb *self)
{
- struct net_device *dev = self->netdev;
unsigned long flags;
if (!self->stopped)
@@ -952,36 +951,26 @@
struct pci_dev *pci_dev = NULL;
int found = 0;
- do
- {
- pci_dev = pci_find_device (PCI_VENDOR_ID_TOSHIBA,
- PCI_DEVICE_ID_FIR701, pci_dev);
- if (pci_dev)
- {
+ while ((pci_dev = pci_find_device (PCI_VENDOR_ID_TOSHIBA,
+ PCI_DEVICE_ID_FIR701, pci_dev)) != NULL) {
+ if (pci_enable_device(pci_dev))
+ continue;
printk (KERN_WARNING "ToshOboe: Found 701 chip at 0x%0lx irq %d\n",
- pci_dev->resource[0].start,
+ pci_resource_start (pci_dev, 0),
pci_dev->irq);
if (!toshoboe_open (pci_dev))
found++;
- }
-
- }
- while (pci_dev);
-
+ }
if (found)
- {
return 0;
- }
return -ENODEV;
}
-#ifdef MODULE
-static void
-toshoboe_cleanup (void)
+static void __exit toshoboe_cleanup (void)
{
int i;
@@ -997,19 +986,8 @@
}
-
-int
-init_module (void)
-{
- return toshoboe_init ();
-}
-
-
-void
-cleanup_module (void)
-{
- toshoboe_cleanup ();
-}
-
-
+#ifdef MODULE
+module_init(toshoboe_init);
#endif
+module_exit(toshoboe_cleanup);
+
diff -urN vanilla/linux-2.3.99-pre10-pre3/drivers/net/lance.c
linux_2_3/drivers/net/lance.c
--- vanilla/linux-2.3.99-pre10-pre3/drivers/net/lance.c Wed May 3 04:45:18 2000
+++ linux_2_3/drivers/net/lance.c Thu May 25 08:03:31 2000
@@ -361,7 +361,6 @@
lance_need_isa_bounce_buffers = 0;
#if defined(CONFIG_PCI)
- if (pci_present())
{
struct pci_dev *pdev = NULL;
if (lance_debug > 1)
@@ -369,20 +368,12 @@
while ((pdev = pci_find_device(PCI_VENDOR_ID_AMD,
PCI_DEVICE_ID_AMD_LANCE, pdev))) {
unsigned int pci_ioaddr;
- unsigned short pci_command;
+ if (pci_enable_device(pdev))
+ continue;
+ pci_set_master(pdev);
pci_irq_line = pdev->irq;
- pci_ioaddr = pdev->resource[0].start;
- /* PCI Spec 2.1 states that it is either the driver or PCI
card's
- * responsibility to set the PCI Master Enable Bit if needed.
- * (From Mark Stockton
<[EMAIL PROTECTED]>)
- */
- pci_read_config_word(pdev, PCI_COMMAND, &pci_command);
- if ( ! (pci_command & PCI_COMMAND_MASTER)) {
- printk("PCI Master Bit has not been set.
Setting...\n");
- pci_command |= PCI_COMMAND_MASTER;
- pci_write_config_word(pdev, PCI_COMMAND, pci_command);
- }
+ pci_ioaddr = pci_resource_start (pdev, 0);
printk("Found PCnet/PCI at %#x, irq %d.\n",
pci_ioaddr, pci_irq_line);
result = lance_probe1(dev, pci_ioaddr, pci_irq_line, 0);
diff -urN vanilla/linux-2.3.99-pre10-pre3/drivers/net/ne.c linux_2_3/drivers/net/ne.c
--- vanilla/linux-2.3.99-pre10-pre3/drivers/net/ne.c Tue May 2 15:40:59 2000
+++ linux_2_3/drivers/net/ne.c Thu May 25 06:19:23 2000
@@ -195,7 +195,7 @@
if (base_addr > 0x1ff) /* Check a single specified location. */
return ne_probe1(dev, base_addr);
else if (base_addr != 0) /* Don't probe at all. */
- return ENXIO;
+ return -ENXIO;
#ifdef CONFIG_PCI
/* Then look for any installed PCI clones */
@@ -218,7 +218,7 @@
}
#endif
- return ENODEV;
+ return -ENODEV;
}
#endif
@@ -232,7 +232,9 @@
unsigned int pci_ioaddr;
while ((pdev = pci_find_device(pci_clone_list[i].vendor,
pci_clone_list[i].dev_id, pdev))) {
- pci_ioaddr = pdev->resource[0].start;
+ if (pci_enable_device(pdev))
+ continue;
+ pci_ioaddr = pci_resource_start (pdev, 0);
/* Avoid already found cards from previous calls */
if (check_region(pci_ioaddr, NE_IO_EXTENT))
continue;
@@ -309,7 +311,7 @@
static unsigned version_printed = 0;
if (reg0 == 0xFF)
- return ENODEV;
+ return -ENODEV;
/* Do a preliminary verification that we have a 8390. */
{
@@ -322,7 +324,7 @@
if (inb_p(ioaddr + EN0_COUNTER0) != 0) {
outb_p(reg0, ioaddr);
outb_p(regd, ioaddr + 0x0d); /* Restore the old values. */
- return ENODEV;
+ return -ENODEV;
}
}
@@ -364,7 +366,7 @@
break;
} else {
printk(" not found (no reset ack).\n");
- return ENODEV;
+ return -ENODEV;
}
}
@@ -466,11 +468,11 @@
{
printk(" not found (invalid signature %2.2x %2.2x).\n",
SA_prom[14], SA_prom[15]);
- return ENXIO;
+ return -ENXIO;
}
#else
printk(" not found.\n");
- return ENXIO;
+ return -ENXIO;
#endif
}
@@ -496,7 +498,7 @@
if (! dev->irq) {
printk(" failed to detect IRQ line.\n");
- return EAGAIN;
+ return -EAGAIN;
}
/* Allocate dev->priv and fill in 8390 specific dev fields. */
@@ -516,7 +518,7 @@
printk (" unable to get IRQ %d (irqval=%d).\n", dev->irq,
irqval);
kfree(dev->priv);
dev->priv = NULL;
- return EAGAIN;
+ return -EAGAIN;
}
}
dev->base_addr = ioaddr;
diff -urN vanilla/linux-2.3.99-pre10-pre3/drivers/net/pcnet32.c
linux_2_3/drivers/net/pcnet32.c
--- vanilla/linux-2.3.99-pre10-pre3/drivers/net/pcnet32.c Sat May 13 11:19:21
2000
+++ linux_2_3/drivers/net/pcnet32.c Thu May 25 08:03:31 2000
@@ -311,21 +311,6 @@
int (*probe1) (unsigned long, unsigned char, int, int, struct pci_dev *);
};
-static struct pcnet32_pci_id_info pcnet32_tbl[] = {
- { "AMD PCnetPCI series",
- PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_LANCE, 0, 0,
- PCI_USES_IO|PCI_USES_MASTER, PCNET32_TOTAL_SIZE,
- pcnet32_probe1},
- { "AMD PCnetPCI series (IBM)",
- PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_LANCE, 0x1014, 0x2000,
- PCI_USES_IO|PCI_USES_MASTER, PCNET32_TOTAL_SIZE,
- pcnet32_probe1},
- { "AMD PCnetHome series",
- PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_PCNETHOME, 0, 0,
- PCI_USES_IO|PCI_USES_MASTER, PCNET32_TOTAL_SIZE,
- pcnet32_probe1},
- {0,}
-};
/*
* PCI device identifiers for "new style" Linux PCI Device Drivers
@@ -751,7 +736,7 @@
}
if (pcnet32_debug > 0)
- printk(KERN_INFO, version);
+ printk(KERN_INFO "%s", version);
/* The PCNET32-specific entries in the device structure. */
dev->open = &pcnet32_open;
@@ -1257,8 +1242,7 @@
lp->stats.rx_errors++;
} else {
int rx_in_place = 0;
- dma_addr_t rx_dma_addr = lp->rx_dma_addr[entry];
-
+
if (pkt_len > rx_copybreak) {
struct sk_buff *newskb;
@@ -1524,7 +1508,7 @@
/* find the PCI devices */
#define USE_PCI_REGISTER_DRIVER
#ifdef USE_PCI_REGISTER_DRIVER
- if (err = pci_module_init(&pcnet32_driver) < 0 )
+ if ((err = pci_module_init(&pcnet32_driver)) < 0 )
return err;
#else
{
diff -urN vanilla/linux-2.3.99-pre10-pre3/drivers/net/rcpci45.c
linux_2_3/drivers/net/rcpci45.c
--- vanilla/linux-2.3.99-pre10-pre3/drivers/net/rcpci45.c Tue May 2 15:41:00
2000
+++ linux_2_3/drivers/net/rcpci45.c Thu May 25 06:19:23 2000
@@ -205,7 +205,7 @@
!((pdev = pci_find_slot(pci_bus, pci_device_fn))))
break;
pci_irq_line = pdev->irq;
- pci_ioaddr = pdev->resource[0].start;
+ pci_ioaddr = pci_resource_start (pdev, 0);
#ifdef RCDEBUG
printk("rc: Found RedCreek PCI adapter\n");
@@ -214,6 +214,8 @@
printk("rc: pci_ioaddr = 0x%x\n", pci_ioaddr);
#endif
+ if (pci_enable_device(pdev))
+ break;
pci_set_master(pdev);
if (!RCfound_device(pci_ioaddr, pci_irq_line,
diff -urN vanilla/linux-2.3.99-pre10-pre3/drivers/net/rrunner.c
linux_2_3/drivers/net/rrunner.c
--- vanilla/linux-2.3.99-pre10-pre3/drivers/net/rrunner.c Fri Apr 21 19:08:45
2000
+++ linux_2_3/drivers/net/rrunner.c Thu May 25 06:19:23 2000
@@ -146,6 +146,9 @@
PCI_DEVICE_ID_ESSENTIAL_ROADRUNNER,
pdev)))
{
+ if (pci_enable_device(pdev))
+ continue;
+
if (pdev == opdev)
return 0;
diff -urN vanilla/linux-2.3.99-pre10-pre3/drivers/net/rtl8129.c
linux_2_3/drivers/net/rtl8129.c
--- vanilla/linux-2.3.99-pre10-pre3/drivers/net/rtl8129.c Fri Apr 21 19:08:52
2000
+++ linux_2_3/drivers/net/rtl8129.c Thu May 25 06:19:23 2000
@@ -356,6 +356,9 @@
ioaddr = pdev->resource[0].start;
irq = pdev->irq;
+ if (pci_enable_device(pdev))
+ continue;
+
if ((pci_tbl[chip_idx].flags & PCI_USES_IO) &&
check_region(ioaddr, pci_tbl[chip_idx].io_size))
continue;
diff -urN vanilla/linux-2.3.99-pre10-pre3/drivers/net/sk98lin/skge.c
linux_2_3/drivers/net/sk98lin/skge.c
--- vanilla/linux-2.3.99-pre10-pre3/drivers/net/sk98lin/skge.c Mon Mar 27 13:35:56
2000
+++ linux_2_3/drivers/net/sk98lin/skge.c Thu May 25 06:19:24 2000
@@ -369,24 +369,18 @@
if (!pci_present()) /* is PCI support present? */
return -ENODEV;
- while((pdev = pci_find_class(PCI_CLASS_NETWORK_ETHERNET << 8, pdev)))
- {
- dev = NULL;
-
- if (pdev->vendor != PCI_VENDOR_ID_SYSKONNECT ||
- pdev->device != PCI_DEVICE_ID_SYSKONNECT_GE) {
+ while((pdev = pci_find_device(PCI_VENDOR_ID_SYSKONNECT,
+ PCI_DEVICE_ID_SYSKONNECT_GE, pdev)) != NULL) {
+ if (pci_enable_device(pdev))
continue;
- }
dev = init_etherdev(dev, sizeof(SK_AC));
- if (dev == NULL || dev->priv == NULL){
+ if (dev == NULL) {
printk(KERN_ERR "Unable to allocate etherdev "
"structure!\n");
break;
}
- memset(dev->priv, 0, sizeof(SK_AC));
-
pAC = dev->priv;
pAC->PciDev = *pdev;
pAC->PciDevId = pdev->device;
@@ -412,7 +406,7 @@
pci_set_master(pdev);
- base_address = pdev->resource[0].start;
+ base_address = pci_resource_start (pdev, 0);
#ifdef SK_BIG_ENDIAN
/*
diff -urN vanilla/linux-2.3.99-pre10-pre3/drivers/net/tlan.c
linux_2_3/drivers/net/tlan.c
--- vanilla/linux-2.3.99-pre10-pre3/drivers/net/tlan.c Wed Mar 22 12:38:14 2000
+++ linux_2_3/drivers/net/tlan.c Thu May 25 06:19:23 2000
@@ -495,8 +495,11 @@
TLanAdapterList[dl_index].deviceId
);
+ if (pci_enable_device(pdev))
+ continue;
+
*pci_irq = pdev->irq;
- *pci_io_base = pdev->resource[0].start;
+ *pci_io_base = pci_resource_start (pdev, 0);
*pci_dfn = pdev->devfn;
pci_read_config_byte ( pdev, PCI_REVISION_ID, pci_rev);
pci_read_config_word ( pdev, PCI_COMMAND, &pci_command);
diff -urN vanilla/linux-2.3.99-pre10-pre3/drivers/net/tokenring/lanstreamer.c
linux_2_3/drivers/net/tokenring/lanstreamer.c
--- vanilla/linux-2.3.99-pre10-pre3/drivers/net/tokenring/lanstreamer.c Tue Mar 21
17:43:39 2000
+++ linux_2_3/drivers/net/tokenring/lanstreamer.c Thu May 25 06:19:24 2000
@@ -207,12 +207,14 @@
{
while ((pci_device = pci_find_device(PCI_VENDOR_ID_IBM,
PCI_DEVICE_ID_IBM_TR, pci_device)))
{
+ if (pci_enable_device(pci_device))
+ continue;
pci_set_master(pci_device);
/* Check to see if io has been allocated, if so, we've already
done this card,
so continue on the card discovery loop */
- if (check_region(pci_device->resource[0].start & (~3),
STREAMER_IO_SPACE))
+ if (check_region(pci_resource_start(pci_device,0),
+STREAMER_IO_SPACE))
{
card_no++;
continue;
diff -urN vanilla/linux-2.3.99-pre10-pre3/drivers/net/tokenring/olympic.c
linux_2_3/drivers/net/tokenring/olympic.c
--- vanilla/linux-2.3.99-pre10-pre3/drivers/net/tokenring/olympic.c Wed Mar 15
14:28:28 2000
+++ linux_2_3/drivers/net/tokenring/olympic.c Thu May 25 06:19:24 2000
@@ -170,12 +170,14 @@
while((pci_device=pci_find_device(PCI_VENDOR_ID_IBM,
PCI_DEVICE_ID_IBM_TR_WAKE, pci_device))) {
+ if (pci_enable_device(pci_device))
+ continue;
pci_set_master(pci_device);
/* Check to see if io has been allocated, if so, we've already
done this card,
so continue on the card discovery loop */
- if (check_region(pci_device->resource[0].start,
OLYMPIC_IO_SPACE)) {
+ if (check_region(pci_resource_start(pci_device, 0),
+OLYMPIC_IO_SPACE)) {
card_no++ ;
continue ;
}
diff -urN vanilla/linux-2.3.99-pre10-pre3/drivers/net/wan/sdladrv.c
linux_2_3/drivers/net/wan/sdladrv.c
--- vanilla/linux-2.3.99-pre10-pre3/drivers/net/wan/sdladrv.c Wed Apr 12 12:38:57
2000
+++ linux_2_3/drivers/net/wan/sdladrv.c Thu May 25 06:19:24 2000
@@ -1983,8 +1983,9 @@
while ((pci_dev = pci_find_device(V3_VENDOR_ID, V3_DEVICE_ID, pci_dev))
!= NULL) {
- pci_read_config_word(pci_dev, PCI_SUBSYS_VENDOR_WORD,
- &PCI_subsys_vendor);
+ if (pci_enable_device(pci_dev))
+ continue;
+ PCI_subsys_vendor = pci_dev->subsystem_vendor;
if(PCI_subsys_vendor != SANGOMA_SUBSYS_VENDOR)
continue;
hw->pci_dev = pci_dev;