From 3616de915e5006609a8872924f7cd148b227088d Mon Sep 17 00:00:00 2001 From: Michael Brown Date: Wed, 13 Apr 2005 00:21:59 +0000 Subject: [PATCH] Hand-finished --- src/drivers/net/via-rhine.c | 28 ++++++++++++++------------ src/drivers/net/w89c840.c | 39 ++++++++++++++++++++----------------- 2 files changed, 37 insertions(+), 30 deletions(-) diff --git a/src/drivers/net/via-rhine.c b/src/drivers/net/via-rhine.c index 716e5360..7a2f4ba3 100644 --- a/src/drivers/net/via-rhine.c +++ b/src/drivers/net/via-rhine.c @@ -950,27 +950,23 @@ void rhine_irq ( struct nic *nic, irq_action_t action ) { } } +static struct nic_operations rhine_operations; +static struct pci_driver rhine_driver; + static int rhine_probe ( struct dev *dev ) { - struct nic *nic = nic_device ( dev ); - struct pci_device *pci = pci_device ( dev ); struct rhine_private *tp = (struct rhine_private *) nic->priv_data; + + if ( ! find_pci_device ( pci, &rhine_driver ) ) + return 0; + if (!pci->ioaddr) return 0; rhine_probe1 (nic, pci, pci->ioaddr, pci->dev_id, -1); - adjust_pci_device(pci); rhine_reset (nic); -static struct nic_operations rhine_operations; -static struct nic_operations rhine_operations = { - .connect = dummy_connect, - .poll = rhine_poll, - .transmit = rhine_transmit, - .irq = rhine_irq, - .disable = rhine_disable, -}; nic->nic_op = &rhine_operations; nic->irqno = pci->irq; nic->ioaddr = tp->ioaddr; @@ -997,7 +993,7 @@ rhine_probe1 (struct nic *nic, struct pci_device *pci, int ioaddr, int chip_id, { struct rhine_private *tp; static int did_version = 0; /* Already printed version info. */ - int i, ww; + unsigned int i, ww; unsigned int timeout; int FDXFlag; int byMIIvalue, LineSpeed, MIICRbak; @@ -1410,6 +1406,14 @@ rhine_transmit (struct nic *nic, /*tp->tx_skbuff[entry] = 0; */ } +static struct nic_operations rhine_operations = { + .connect = dummy_connect, + .poll = rhine_poll, + .transmit = rhine_transmit, + .irq = rhine_irq, + .disable = rhine_disable, +}; + static struct pci_id rhine_nics[] = { PCI_ROM(0x1106, 0x3065, "dlink-530tx", "VIA 6102"), PCI_ROM(0x1106, 0x3106, "via-rhine-6105", "VIA 6105"), diff --git a/src/drivers/net/w89c840.c b/src/drivers/net/w89c840.c index 0d4c0567..fdc7f031 100644 --- a/src/drivers/net/w89c840.c +++ b/src/drivers/net/w89c840.c @@ -604,14 +604,32 @@ static void w89c840_irq(struct nic *nic __unused, irq_action_t action __unused) } } +static struct nic_operations w89c840_operations = { + .connect = dummy_connect, + .poll = w89c840_poll, + .transmit = w89c840_transmit, + .irq = w89c840_irq, + .disable = w89c840_disable, +}; + +static struct pci_id w89c840_nics[] = { +PCI_ROM(0x1050, 0x0840, "winbond840", "Winbond W89C840F"), +PCI_ROM(0x11f6, 0x2011, "compexrl100atx", "Compex RL100ATX"), +}; + +static struct pci_driver w89c840_driver = + PCI_DRIVER ( "W89C840F", w89c840_nics, PCI_NO_CLASS ); + /************************************************************************** w89c840_probe - Look for an adapter, this routine's visible to the outside ***************************************************************************/ static int w89c840_probe ( struct dev *dev ) { - struct nic *nic = nic_device ( dev ); - struct pci_device *p = pci_device ( dev ); + + if ( ! find_pci_device ( p, &w89c840_driver ) ) + return 0; + u16 sum = 0; int i, j; unsigned short value; @@ -698,14 +716,7 @@ static int w89c840_probe ( struct dev *dev ) { } /* point to NIC specific routines */ -static struct nic_operations w89c840_operations; -static struct nic_operations w89c840_operations = { - .connect = dummy_connect, - .poll = w89c840_poll, - .transmit = w89c840_transmit, - .irq = w89c840_irq, - .disable = w89c840_disable, -}; nic->nic_op = &w89c840_operations; + nic->nic_op = &w89c840_operations; w89c840_reset(nic); @@ -947,12 +958,4 @@ static void init_ring(void) } -static struct pci_id w89c840_nics[] = { -PCI_ROM(0x1050, 0x0840, "winbond840", "Winbond W89C840F"), -PCI_ROM(0x11f6, 0x2011, "compexrl100atx", "Compex RL100ATX"), -}; - -static struct pci_driver w89c840_driver = - PCI_DRIVER ( "W89C840F", w89c840_nics, PCI_NO_CLASS ); - BOOT_DRIVER ( "W89C840F", w89c840_probe );