Commit f15151bd authored by Greg Kroah-Hartman's avatar Greg Kroah-Hartman

[netdrvr sis900] don't call pci_find_device from irq context

I realized that I've had this patch in my tree for a while, and forgot
to send it to you and lkml.  The patch below fixes bug number 923:
	http://bugme.osdl.org/show_bug.cgi?id=923
(basically keeps us from calling pci_find_device from interrupt
context.)

It's been tested by a few people with this device, and they say it works
just fine for them.  Please forward it on up the food chain.
parent 966d8cdb
......@@ -169,6 +169,7 @@ struct sis900_private {
dma_addr_t rx_ring_dma;
unsigned int tx_full; /* The Tx queue is full. */
u8 host_bridge_rev;
};
MODULE_AUTHOR("Jim Huang <cmhuang@sis.com.tw>, Ollie Lho <ollie@sis.com.tw>");
......@@ -368,6 +369,7 @@ static int __devinit sis900_probe (struct pci_dev *pci_dev, const struct pci_dev
{
struct sis900_private *sis_priv;
struct net_device *net_dev;
struct pci_dev *dev;
dma_addr_t ring_dma;
void *ring_space;
long ioaddr;
......@@ -475,6 +477,11 @@ static int __devinit sis900_probe (struct pci_dev *pci_dev, const struct pci_dev
goto err_out_unregister;
}
/* save our host bridge revision */
dev = pci_find_device(PCI_VENDOR_ID_SI, PCI_DEVICE_ID_SI_630, NULL);
if (dev)
pci_read_config_byte(dev, PCI_CLASS_REVISION, &sis_priv->host_bridge_rev);
/* print some information about our NIC */
printk(KERN_INFO "%s: %s at %#lx, IRQ %d, ", net_dev->name,
card_name, ioaddr, net_dev->irq);
......@@ -1110,18 +1117,12 @@ static void sis630_set_eq(struct net_device *net_dev, u8 revision)
{
struct sis900_private *sis_priv = net_dev->priv;
u16 reg14h, eq_value=0, max_value=0, min_value=0;
u8 host_bridge_rev;
int i, maxcount=10;
struct pci_dev *dev=NULL;
if ( !(revision == SIS630E_900_REV || revision == SIS630EA1_900_REV ||
revision == SIS630A_900_REV || revision == SIS630ET_900_REV) )
return;
dev = pci_find_device(PCI_VENDOR_ID_SI, PCI_DEVICE_ID_SI_630, dev);
if (dev)
pci_read_config_byte(dev, PCI_CLASS_REVISION, &host_bridge_rev);
if (netif_carrier_ok(net_dev)) {
reg14h=mdio_read(net_dev, sis_priv->cur_phy, MII_RESV);
mdio_write(net_dev, sis_priv->cur_phy, MII_RESV, (0x2200 | reg14h) & 0xBFFF);
......@@ -1144,7 +1145,8 @@ static void sis630_set_eq(struct net_device *net_dev, u8 revision)
}
/* 630B0&B1 rule to determine the equalizer value */
if (revision == SIS630A_900_REV &&
(host_bridge_rev == SIS630B0 || host_bridge_rev == SIS630B1)) {
(sis_priv->host_bridge_rev == SIS630B0 ||
sis_priv->host_bridge_rev == SIS630B1)) {
if (max_value == 0)
eq_value=3;
else
......@@ -1159,7 +1161,8 @@ static void sis630_set_eq(struct net_device *net_dev, u8 revision)
else {
reg14h=mdio_read(net_dev, sis_priv->cur_phy, MII_RESV);
if (revision == SIS630A_900_REV &&
(host_bridge_rev == SIS630B0 || host_bridge_rev == SIS630B1))
(sis_priv->host_bridge_rev == SIS630B0 ||
sis_priv->host_bridge_rev == SIS630B1))
mdio_write(net_dev, sis_priv->cur_phy, MII_RESV, (reg14h | 0x2200) & 0xBFFF);
else
mdio_write(net_dev, sis_priv->cur_phy, MII_RESV, (reg14h | 0x2000) & 0xBFFF);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment