linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] fix bug 923 for sis900 driver
@ 2003-08-20 22:37 Greg KH
  2003-08-20 23:21 ` Jeff Garzik
  2003-08-26 23:37 ` Jeff Garzik
  0 siblings, 2 replies; 3+ messages in thread
From: Greg KH @ 2003-08-20 22:37 UTC (permalink / raw)
  To: Jeff Garzik; +Cc: linux-kernel

Hi,

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.

thanks,

greg k-h


diff -Nru a/drivers/net/sis900.c b/drivers/net/sis900.c
--- a/drivers/net/sis900.c	Wed Aug 20 15:29:35 2003
+++ b/drivers/net/sis900.c	Wed Aug 20 15:29:35 2003
@@ -169,6 +169,7 @@
 	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>");
@@ -367,6 +368,7 @@
 {
 	struct sis900_private *sis_priv;
 	struct net_device *net_dev;
+	struct pci_dev *dev;
 	dma_addr_t ring_dma;
 	void *ring_space;
 	long ioaddr;
@@ -473,6 +475,11 @@
 		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);
@@ -1108,18 +1115,12 @@
 {
 	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);
@@ -1142,7 +1143,8 @@
 		}
 		/* 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
@@ -1157,7 +1159,8 @@
 	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);

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] fix bug 923 for sis900 driver
  2003-08-20 22:37 [PATCH] fix bug 923 for sis900 driver Greg KH
@ 2003-08-20 23:21 ` Jeff Garzik
  2003-08-26 23:37 ` Jeff Garzik
  1 sibling, 0 replies; 3+ messages in thread
From: Jeff Garzik @ 2003-08-20 23:21 UTC (permalink / raw)
  To: Greg KH; +Cc: linux-kernel

Greg KH wrote:
> Hi,
> 
> 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.
> 
> thanks,
> 
> greg k-h
> 
> 
> diff -Nru a/drivers/net/sis900.c b/drivers/net/sis900.c
> --- a/drivers/net/sis900.c	Wed Aug 20 15:29:35 2003
> +++ b/drivers/net/sis900.c	Wed Aug 20 15:29:35 2003


Looks good, will apply later on today.

Thanks,

	Jeff



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] fix bug 923 for sis900 driver
  2003-08-20 22:37 [PATCH] fix bug 923 for sis900 driver Greg KH
  2003-08-20 23:21 ` Jeff Garzik
@ 2003-08-26 23:37 ` Jeff Garzik
  1 sibling, 0 replies; 3+ messages in thread
From: Jeff Garzik @ 2003-08-26 23:37 UTC (permalink / raw)
  To: Greg KH; +Cc: linux-kernel

thanks, applied to 2.4 and 2.5


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2003-08-26 23:38 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-08-20 22:37 [PATCH] fix bug 923 for sis900 driver Greg KH
2003-08-20 23:21 ` Jeff Garzik
2003-08-26 23:37 ` Jeff Garzik

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).