2001-07-12 14:20:50

by Ion Badulescu

[permalink] [raw]
Subject: [PATCH] one more starfire net driver fix for 2.4.7pre6

Hi,

This patch reverses the MII hunk from the previous patch, which was
apparently breaking some cards. It also fixes an incorrect comment.

Please apply.

Thanks,
Ion

--
It is better to keep your mouth shut and be thought a fool,
than to open it and remove all doubt.
---------------------------------
--- linux-2.4/drivers/net/starfire.c.orig Thu Jul 12 10:15:18 2001
+++ linux-2.4/drivers/net/starfire.c Thu Jul 12 10:17:30 2001
@@ -87,8 +87,7 @@

LK1.3.3 (Ion Badulescu)
- Initialize the TxMode register properly
- - Set the MII registers _after_ resetting it
- - Don't dereference dev->priv after unregister_netdev() has freed it
+ - Don't dereference dev->priv after freeing it

TODO:
- implement tx_timeout() properly
@@ -987,12 +986,12 @@
struct netdev_private *np = dev->priv;
u16 reg0;

+ mdio_write(dev, np->phys[0], MII_ADVERTISE, np->advertising);
mdio_write(dev, np->phys[0], MII_BMCR, BMCR_RESET);
udelay(500);
while (mdio_read(dev, np->phys[0], MII_BMCR) & BMCR_RESET);

reg0 = mdio_read(dev, np->phys[0], MII_BMCR);
- mdio_write(dev, np->phys[0], MII_ADVERTISE, np->advertising);

if (np->autoneg) {
reg0 |= BMCR_ANENABLE | BMCR_ANRESTART;
@@ -1939,12 +1938,12 @@
pci_free_consistent(pdev, PAGE_SIZE,
np->rx_ring, np->rx_ring_dma);

- unregister_netdev(dev); /* Will also free np!! */
+ unregister_netdev(dev);
iounmap((char *)dev->base_addr);
pci_release_regions(pdev);

pci_set_drvdata(pdev, NULL);
- kfree(dev);
+ kfree(dev); /* Will also free np!! */
}