--- zzzz-none-000/linux-3.10.107/drivers/net/ethernet/sis/sis900.c 2017-06-27 09:49:32.000000000 +0000 +++ scorpion-7490-727/linux-3.10.107/drivers/net/ethernet/sis/sis900.c 2021-02-04 17:41:59.000000000 +0000 @@ -106,7 +106,8 @@ "SiS 900 PCI Fast Ethernet", "SiS 7016 PCI Fast Ethernet" }; -static DEFINE_PCI_DEVICE_TABLE(sis900_pci_tbl) = { + +static const struct pci_device_id sis900_pci_tbl[] = { {PCI_VENDOR_ID_SI, PCI_DEVICE_ID_SI_900, PCI_ANY_ID, PCI_ANY_ID, 0, 0, SIS_900}, {PCI_VENDOR_ID_SI, PCI_DEVICE_ID_SI_7016, @@ -576,7 +577,6 @@ err_out_unmap: pci_iounmap(pci_dev, ioaddr); err_out_cleardev: - pci_set_drvdata(pci_dev, NULL); pci_release_regions(pci_dev); err_out: free_netdev(net_dev); @@ -1309,23 +1309,9 @@ struct sis900_private *sis_priv = netdev_priv(net_dev); struct mii_phy *mii_phy = sis_priv->mii; static const int next_tick = 5*HZ; + int speed = 0, duplex = 0; u16 status; - if (!sis_priv->autong_complete){ - int uninitialized_var(speed), duplex = 0; - - sis900_read_mode(net_dev, &speed, &duplex); - if (duplex){ - sis900_set_mode(sis_priv, speed, duplex); - sis630_set_eq(net_dev, sis_priv->chipset_rev); - netif_start_queue(net_dev); - } - - sis_priv->timer.expires = jiffies + HZ; - add_timer(&sis_priv->timer); - return; - } - status = mdio_read(net_dev, sis_priv->cur_phy, MII_STATUS); status = mdio_read(net_dev, sis_priv->cur_phy, MII_STATUS); @@ -1336,9 +1322,15 @@ status = sis900_default_phy(net_dev); mii_phy = sis_priv->mii; - if (status & MII_STAT_LINK){ - sis900_check_mode(net_dev, mii_phy); - netif_carrier_on(net_dev); + if (status & MII_STAT_LINK) { + WARN_ON(!(status & MII_STAT_AUTO_DONE)); + + sis900_read_mode(net_dev, &speed, &duplex); + if (duplex) { + sis900_set_mode(sis_priv, speed, duplex); + sis630_set_eq(net_dev, sis_priv->chipset_rev); + netif_carrier_on(net_dev); + } } } else { /* Link ON -> OFF */ @@ -1612,12 +1604,6 @@ unsigned int index_cur_tx, index_dirty_tx; unsigned int count_dirty_tx; - /* Don't transmit data before the complete of auto-negotiation */ - if(!sis_priv->autong_complete){ - netif_stop_queue(net_dev); - return NETDEV_TX_BUSY; - } - spin_lock_irqsave(&sis_priv->lock, flags); /* Calculate the next Tx descriptor entry. */ @@ -1629,7 +1615,7 @@ skb->data, skb->len, PCI_DMA_TODEVICE); if (unlikely(pci_dma_mapping_error(sis_priv->pci_dev, sis_priv->tx_ring[entry].bufptr))) { - dev_kfree_skb(skb); + dev_kfree_skb_any(skb); sis_priv->tx_skbuff[entry] = NULL; net_dev->stats.tx_dropped++; spin_unlock_irqrestore(&sis_priv->lock, flags); @@ -1723,7 +1709,7 @@ if(netif_msg_intr(sis_priv)) printk(KERN_DEBUG "%s: exiting interrupt, " - "interrupt status = 0x%#8.8x.\n", + "interrupt status = %#8.8x\n", net_dev->name, sr32(isr)); spin_unlock (&sis_priv->lock); @@ -2273,7 +2259,6 @@ case IF_PORT_100BASEFX: /* 100BaseFx */ /* These Modes are not supported (are they?)*/ return -EOPNOTSUPP; - break; default: return -EINVAL; @@ -2441,7 +2426,6 @@ pci_iounmap(pci_dev, sis_priv->ioaddr); free_netdev(net_dev); pci_release_regions(pci_dev); - pci_set_drvdata(pci_dev, NULL); } #ifdef CONFIG_PM