From 738e1e694bf6d9e965ba0ce2667a1bec5780a172 Mon Sep 17 00:00:00 2001 From: Petr Vandrovec Date: Sun, 12 Oct 2008 20:58:29 -0700 Subject: r8169: NULL pointer dereference on r8169 load mmio_addr in r8169 needs to be initialized before use Maybe that all tp-> initialization should be moved before rtl_init_mac_address call, but this is enough to get rid of crash in rtl_rar_set due to mmio_addr being uninitialized. Signed-off-by: Petr Vandrovec Signed-off-by: David S. Miller --- drivers/net/r8169.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'drivers/net') diff --git a/drivers/net/r8169.c b/drivers/net/r8169.c index bdae2c5..c821da2 100644 --- a/drivers/net/r8169.c +++ b/drivers/net/r8169.c @@ -2154,6 +2154,8 @@ rtl8169_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) spin_lock_init(&tp->lock); + tp->mmio_addr = ioaddr; + rtl_init_mac_address(tp, ioaddr); /* Get MAC address */ @@ -2186,7 +2188,6 @@ rtl8169_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) #endif tp->intr_mask = 0xffff; - tp->mmio_addr = ioaddr; tp->align = cfg->align; tp->hw_start = cfg->hw_start; tp->intr_event = cfg->intr_event; -- cgit v1.1 From 9d731d77c9794bb0a264f58d35949a1ab6dcc41c Mon Sep 17 00:00:00 2001 From: "Rafael J. Wysocki" Date: Sun, 12 Oct 2008 20:59:48 -0700 Subject: sky2: Fix WOL regression Since dev->power.should_wakeup bit is used by the PCI core to decide whether the device should wake up the system from sleep states, set/unset this bit whenever WOL is enabled/disabled using sky2_set_wol(). Remove an open-coded reference to the standard PCI PM registers that is not used any more. Signed-off-by: Rafael J. Wysocki Signed-off-by: David S. Miller --- drivers/net/sky2.c | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) (limited to 'drivers/net') diff --git a/drivers/net/sky2.c b/drivers/net/sky2.c index 3805b93..3813d15 100644 --- a/drivers/net/sky2.c +++ b/drivers/net/sky2.c @@ -3034,7 +3034,8 @@ static int sky2_set_wol(struct net_device *dev, struct ethtool_wolinfo *wol) struct sky2_port *sky2 = netdev_priv(dev); struct sky2_hw *hw = sky2->hw; - if (wol->wolopts & ~sky2_wol_supported(sky2->hw)) + if ((wol->wolopts & ~sky2_wol_supported(sky2->hw)) + || !device_can_wakeup(&hw->pdev->dev)) return -EOPNOTSUPP; sky2->wol = wol->wolopts; @@ -3045,6 +3046,8 @@ static int sky2_set_wol(struct net_device *dev, struct ethtool_wolinfo *wol) sky2_write32(hw, B0_CTST, sky2->wol ? Y2_HW_WOL_ON : Y2_HW_WOL_OFF); + device_set_wakeup_enable(&hw->pdev->dev, sky2->wol); + if (!netif_running(dev)) sky2_wol_init(sky2); return 0; @@ -4179,18 +4182,6 @@ static int __devinit sky2_test_msi(struct sky2_hw *hw) return err; } -static int __devinit pci_wake_enabled(struct pci_dev *dev) -{ - int pm = pci_find_capability(dev, PCI_CAP_ID_PM); - u16 value; - - if (!pm) - return 0; - if (pci_read_config_word(dev, pm + PCI_PM_CTRL, &value)) - return 0; - return value & PCI_PM_CTRL_PME_ENABLE; -} - /* * Read and parse the first part of Vital Product Data */ @@ -4314,7 +4305,7 @@ static int __devinit sky2_probe(struct pci_dev *pdev, } } - wol_default = pci_wake_enabled(pdev) ? WAKE_MAGIC : 0; + wol_default = device_may_wakeup(&pdev->dev) ? WAKE_MAGIC : 0; err = -ENOMEM; hw = kzalloc(sizeof(*hw), GFP_KERNEL); -- cgit v1.1 From 51cf756c0a056dfb3d7ccdddff3b055cbf44a31c Mon Sep 17 00:00:00 2001 From: Adrian Bunk Date: Sun, 12 Oct 2008 21:01:53 -0700 Subject: net/tc35815.c: fix compilation Fix an obvious typo introduced by commit 298cf9beb9679522de995e249eccbd82f7c51999 (phylib: move to dynamic allocation of struct mii_bus). <-- snip --> ... CC drivers/net/tc35815.o drivers/net/tc35815.c: In function 'tc_mii_init': drivers/net/tc35815.c:799: error: 'err_out_free_mii_bus' undeclared (first use in this function) drivers/net/tc35815.c:799: error: (Each undeclared identifier is reported only once drivers/net/tc35815.c:799: error: for each function it appears in.) drivers/net/tc35815.c:781: error: label 'err_out_free_mii_bus' used but not defined make[3]: *** [drivers/net/tc35815.o] Error 1 <-- snip --> Signed-off-by: Adrian Bunk Signed-off-by: David S. Miller --- drivers/net/tc35815.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/net') diff --git a/drivers/net/tc35815.c b/drivers/net/tc35815.c index 4980b12..df20caf 100644 --- a/drivers/net/tc35815.c +++ b/drivers/net/tc35815.c @@ -796,7 +796,7 @@ err_out_unregister_bus: mdiobus_unregister(lp->mii_bus); err_out_free_mdio_irq: kfree(lp->mii_bus->irq); -err_out_free_mii_bus; +err_out_free_mii_bus: mdiobus_free(lp->mii_bus); err_out: return err; -- cgit v1.1 From 1210dde7b39fef3120464d9f3660631689d1c0ed Mon Sep 17 00:00:00 2001 From: Adrian Bunk Date: Sun, 12 Oct 2008 21:02:19 -0700 Subject: net/au1000_eth.c MDIO namespace fixes Commit 2e888103295f47b8fcbf7e9bb8c5da97dd2ecd76 (phylib: add mdiobus_{read,write}) causes the following compile error: <-- snip --> ... CC drivers/net/au1000_eth.o drivers/net/au1000_eth.c:252: error: conflicting types for 'mdiobus_read' include/linux/phy.h:130: error: previous declaration of 'mdiobus_read' was here drivers/net/au1000_eth.c:263: error: conflicting types for 'mdiobus_write' include/linux/phy.h:131: error: previous declaration of 'mdiobus_write' was here ... make[3]: *** [drivers/net/au1000_eth.o] Error 1 <-- snip --> This patch prefixes the driver functions with au1000_ Signed-off-by: Adrian Bunk Signed-off-by: David S. Miller --- drivers/net/au1000_eth.c | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) (limited to 'drivers/net') diff --git a/drivers/net/au1000_eth.c b/drivers/net/au1000_eth.c index 7b92201..019b13c 100644 --- a/drivers/net/au1000_eth.c +++ b/drivers/net/au1000_eth.c @@ -94,8 +94,8 @@ static irqreturn_t au1000_interrupt(int, void *); static void au1000_tx_timeout(struct net_device *); static void set_rx_mode(struct net_device *); static int au1000_ioctl(struct net_device *, struct ifreq *, int); -static int mdio_read(struct net_device *, int, int); -static void mdio_write(struct net_device *, int, int, u16); +static int au1000_mdio_read(struct net_device *, int, int); +static void au1000_mdio_write(struct net_device *, int, int, u16); static void au1000_adjust_link(struct net_device *); static void enable_mac(struct net_device *, int); @@ -191,7 +191,7 @@ struct au1000_private *au_macs[NUM_ETH_INTERFACES]; /* * MII operations */ -static int mdio_read(struct net_device *dev, int phy_addr, int reg) +static int au1000_mdio_read(struct net_device *dev, int phy_addr, int reg) { struct au1000_private *aup = (struct au1000_private *) dev->priv; volatile u32 *const mii_control_reg = &aup->mac->mii_control; @@ -225,7 +225,8 @@ static int mdio_read(struct net_device *dev, int phy_addr, int reg) return (int)*mii_data_reg; } -static void mdio_write(struct net_device *dev, int phy_addr, int reg, u16 value) +static void au1000_mdio_write(struct net_device *dev, int phy_addr, + int reg, u16 value) { struct au1000_private *aup = (struct au1000_private *) dev->priv; volatile u32 *const mii_control_reg = &aup->mac->mii_control; @@ -249,7 +250,7 @@ static void mdio_write(struct net_device *dev, int phy_addr, int reg, u16 value) *mii_control_reg = mii_control; } -static int mdiobus_read(struct mii_bus *bus, int phy_addr, int regnum) +static int au1000_mdiobus_read(struct mii_bus *bus, int phy_addr, int regnum) { /* WARNING: bus->phy_map[phy_addr].attached_dev == dev does * _NOT_ hold (e.g. when PHY is accessed through other MAC's MII bus) */ @@ -257,21 +258,21 @@ static int mdiobus_read(struct mii_bus *bus, int phy_addr, int regnum) enable_mac(dev, 0); /* make sure the MAC associated with this * mii_bus is enabled */ - return mdio_read(dev, phy_addr, regnum); + return au1000_mdio_read(dev, phy_addr, regnum); } -static int mdiobus_write(struct mii_bus *bus, int phy_addr, int regnum, - u16 value) +static int au1000_mdiobus_write(struct mii_bus *bus, int phy_addr, int regnum, + u16 value) { struct net_device *const dev = bus->priv; enable_mac(dev, 0); /* make sure the MAC associated with this * mii_bus is enabled */ - mdio_write(dev, phy_addr, regnum, value); + au1000_mdio_write(dev, phy_addr, regnum, value); return 0; } -static int mdiobus_reset(struct mii_bus *bus) +static int au1000_mdiobus_reset(struct mii_bus *bus) { struct net_device *const dev = bus->priv; @@ -703,9 +704,9 @@ static struct net_device * au1000_probe(int port_num) goto err_out; aup->mii_bus->priv = dev; - aup->mii_bus->read = mdiobus_read; - aup->mii_bus->write = mdiobus_write; - aup->mii_bus->reset = mdiobus_reset; + aup->mii_bus->read = au1000_mdiobus_read; + aup->mii_bus->write = au1000_mdiobus_write; + aup->mii_bus->reset = au1000_mdiobus_reset; aup->mii_bus->name = "au1000_eth_mii"; snprintf(aup->mii_bus->id, MII_BUS_ID_SIZE, "%x", aup->mac_id); aup->mii_bus->irq = kmalloc(sizeof(int)*PHY_MAX_ADDR, GFP_KERNEL); -- cgit v1.1 From 97e92d9d4b52c1257e7891715115e9d00c6b20bc Mon Sep 17 00:00:00 2001 From: Huang Weiyi Date: Sun, 12 Oct 2008 21:04:10 -0700 Subject: qlge: remove duplicated #include Removed duplicated include in files below drivers/net/qlge/qlge_ethtool.c drivers/net/qlge/qlge_main.c Signed-off-by: Huang Weiyi Signed-off-by: David S. Miller --- drivers/net/qlge/qlge_ethtool.c | 1 - drivers/net/qlge/qlge_main.c | 1 - 2 files changed, 2 deletions(-) (limited to 'drivers/net') diff --git a/drivers/net/qlge/qlge_ethtool.c b/drivers/net/qlge/qlge_ethtool.c index 6457f8c..b62fbd4 100644 --- a/drivers/net/qlge/qlge_ethtool.c +++ b/drivers/net/qlge/qlge_ethtool.c @@ -29,7 +29,6 @@ #include #include #include -#include #include #include #include diff --git a/drivers/net/qlge/qlge_main.c b/drivers/net/qlge/qlge_main.c index 3af822b..297877b 100644 --- a/drivers/net/qlge/qlge_main.c +++ b/drivers/net/qlge/qlge_main.c @@ -36,7 +36,6 @@ #include #include #include -#include #include #include #include -- cgit v1.1 From c6dcb8278876ebf266e2088b0b45b28aa66b7693 Mon Sep 17 00:00:00 2001 From: Guennadi Liakhovetski Date: Sun, 12 Oct 2008 21:05:14 -0700 Subject: smc911x: Add support for LAN921{5,7,8} chips from SMSC LAN92{5,7,8} chips from SMSC are register compatible with LAN911{5,6,7,8} controllers, and only add support for HP Auto-MDIX. LAN9218 doesn't have an external MII interface. Signed-off-by: Guennadi Liakhovetski Acked-by: Peter Korsgaard Signed-off-by: David S. Miller --- drivers/net/smc911x.c | 6 ++++-- drivers/net/smc911x.h | 14 ++++++++++---- 2 files changed, 14 insertions(+), 6 deletions(-) (limited to 'drivers/net') diff --git a/drivers/net/smc911x.c b/drivers/net/smc911x.c index 3d19d00..8aa7460 100644 --- a/drivers/net/smc911x.c +++ b/drivers/net/smc911x.c @@ -685,8 +685,10 @@ static void smc911x_phy_detect(struct net_device *dev) * PHY#1 to PHY#31, and then PHY#0 last. */ switch(lp->version) { - case 0x115: - case 0x117: + case CHIP_9115: + case CHIP_9117: + case CHIP_9215: + case CHIP_9217: cfg = SMC_GET_HW_CFG(lp); if (cfg & HW_CFG_EXT_PHY_DET_) { cfg &= ~HW_CFG_PHY_CLK_SEL_; diff --git a/drivers/net/smc911x.h b/drivers/net/smc911x.h index 2abfc28..bf6240f 100644 --- a/drivers/net/smc911x.h +++ b/drivers/net/smc911x.h @@ -666,10 +666,13 @@ smc_pxa_dma_outsl(struct smc911x_local *lp, u_long physaddr, #define LAN911X_INTERNAL_PHY_ID (0x0007C000) /* Chip ID values */ -#define CHIP_9115 0x115 -#define CHIP_9116 0x116 -#define CHIP_9117 0x117 -#define CHIP_9118 0x118 +#define CHIP_9115 0x0115 +#define CHIP_9116 0x0116 +#define CHIP_9117 0x0117 +#define CHIP_9118 0x0118 +#define CHIP_9215 0x115A +#define CHIP_9217 0x117A +#define CHIP_9218 0x118A struct chip_id { u16 id; @@ -681,6 +684,9 @@ static const struct chip_id chip_ids[] = { { CHIP_9116, "LAN9116" }, { CHIP_9117, "LAN9117" }, { CHIP_9118, "LAN9118" }, + { CHIP_9215, "LAN9215" }, + { CHIP_9217, "LAN9217" }, + { CHIP_9218, "LAN9218" }, { 0, NULL }, }; -- cgit v1.1 From 1947b36d8f7eb706972bd50fceb063d317d62570 Mon Sep 17 00:00:00 2001 From: Huang Weiyi Date: Sun, 12 Oct 2008 21:08:58 -0700 Subject: jme: remove unused #include The file(s) below do not use LINUX_VERSION_CODE nor KERNEL_VERSION. drivers/net/jme.c This patch removes the said #include . Signed-off-by: Huang Weiyi Signed-off-by: David S. Miller --- drivers/net/jme.c | 1 - 1 file changed, 1 deletion(-) (limited to 'drivers/net') diff --git a/drivers/net/jme.c b/drivers/net/jme.c index 5f9a131..156f159 100644 --- a/drivers/net/jme.c +++ b/drivers/net/jme.c @@ -21,7 +21,6 @@ * */ -#include #include #include #include -- cgit v1.1 From 0ed0563e14dcb9986241d30f08ecd33f9bcc3572 Mon Sep 17 00:00:00 2001 From: Adrian Bunk Date: Sun, 12 Oct 2008 21:15:17 -0700 Subject: net/bfin_mac.c MDIO namespace fixes Commit 2e888103295f47b8fcbf7e9bb8c5da97dd2ecd76 (phylib: add mdiobus_{read,write}) causes the following compile error: <-- snip --> ... CC drivers/net/bfin_mac.o drivers/net/bfin_mac.c:272: error: conflicting types for 'mdiobus_read' include/linux/phy.h:130: error: previous declaration of 'mdiobus_read' was here drivers/net/bfin_mac.c:287: error: conflicting types for 'mdiobus_write' include/linux/phy.h:131: error: previous declaration of 'mdiobus_write' was here make[3]: *** [drivers/net/bfin_mac.o] Error 1 <-- snip --> This patch prefixes the driver functions with bfin_ Signed-off-by: Adrian Bunk Signed-off-by: David S. Miller --- drivers/net/bfin_mac.c | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) (limited to 'drivers/net') diff --git a/drivers/net/bfin_mac.c b/drivers/net/bfin_mac.c index a0d41c5..b458d60 100644 --- a/drivers/net/bfin_mac.c +++ b/drivers/net/bfin_mac.c @@ -253,7 +253,7 @@ init_error: * MII operations */ /* Wait until the previous MDC/MDIO transaction has completed */ -static void mdio_poll(void) +static void bfin_mdio_poll(void) { int timeout_cnt = MAX_TIMEOUT_CNT; @@ -269,25 +269,25 @@ static void mdio_poll(void) } /* Read an off-chip register in a PHY through the MDC/MDIO port */ -static int mdiobus_read(struct mii_bus *bus, int phy_addr, int regnum) +static int bfin_mdiobus_read(struct mii_bus *bus, int phy_addr, int regnum) { - mdio_poll(); + bfin_mdio_poll(); /* read mode */ bfin_write_EMAC_STAADD(SET_PHYAD((u16) phy_addr) | SET_REGAD((u16) regnum) | STABUSY); - mdio_poll(); + bfin_mdio_poll(); return (int) bfin_read_EMAC_STADAT(); } /* Write an off-chip register in a PHY through the MDC/MDIO port */ -static int mdiobus_write(struct mii_bus *bus, int phy_addr, int regnum, - u16 value) +static int bfin_mdiobus_write(struct mii_bus *bus, int phy_addr, int regnum, + u16 value) { - mdio_poll(); + bfin_mdio_poll(); bfin_write_EMAC_STADAT((u32) value); @@ -297,12 +297,12 @@ static int mdiobus_write(struct mii_bus *bus, int phy_addr, int regnum, STAOP | STABUSY); - mdio_poll(); + bfin_mdio_poll(); return 0; } -static int mdiobus_reset(struct mii_bus *bus) +static int bfin_mdiobus_reset(struct mii_bus *bus) { return 0; } @@ -818,7 +818,7 @@ static void bfin_mac_enable(void) bfin_write_DMA1_CONFIG(rx_list_head->desc_a.config); /* Wait MII done */ - mdio_poll(); + bfin_mdio_poll(); /* We enable only RX here */ /* ASTP : Enable Automatic Pad Stripping @@ -1063,9 +1063,9 @@ static int __devinit bfin_mac_probe(struct platform_device *pdev) goto out_err_mdiobus_alloc; lp->mii_bus->priv = ndev; - lp->mii_bus->read = mdiobus_read; - lp->mii_bus->write = mdiobus_write; - lp->mii_bus->reset = mdiobus_reset; + lp->mii_bus->read = bfin_mdiobus_read; + lp->mii_bus->write = bfin_mdiobus_write; + lp->mii_bus->reset = bfin_mdiobus_reset; lp->mii_bus->name = "bfin_mac_mdio"; snprintf(lp->mii_bus->id, MII_BUS_ID_SIZE, "0"); lp->mii_bus->irq = kmalloc(sizeof(int)*PHY_MAX_ADDR, GFP_KERNEL); -- cgit v1.1