mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Mark M. Hoffman" <mhoffman@lightlink.com>
To: Linus Torvalds <torvalds@osdl.org>, Andrew Morton <akpm@osdl.org>
Cc: Adrian Bunk <bunk@stusta.de>,
	greg@kroah.com, linux-pci@atrey.karlin.mff.cuni.cz,
	linux-kernel@vger.kernel.org, Jean Delvare <khali@linux-fr.org>
Subject: [PATCH 2.6.20-rc4] i2c/pci: fix sis96x smbus quirk once and for all
Date: Mon, 8 Jan 2007 22:11:29 -0500	[thread overview]
Message-ID: <20070109031129.GA27550@jupiter.solarsys.private> (raw)
In-Reply-To: <20070109030226.GA2408@jupiter.solarsys.private>


The sis96x SMBus PCI device depends on two different quirks to run
in a specific order.  Apart from being fragile, this was found to
actually break on (at least) recent FC4, FC5, and FC6 kernels.  This
patch fixes the quirks so that they work without relying on the
compiler and/or linker to put them in any specific order.

http://lists.lm-sensors.org/pipermail/lm-sensors/2006-April/015962.html
https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=189719

I tested this patch.  Please apply.

Signed-off-by: Mark M. Hoffman <mhoffman@lightlink.com>

---
 drivers/pci/quirks.c |   14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

--- linux-2.6.orig/drivers/pci/quirks.c
+++ linux-2.6/drivers/pci/quirks.c
@@ -1117,10 +1117,11 @@ DECLARE_PCI_FIXUP_RESUME(PCI_VENDOR_ID_I
 static void quirk_sis_96x_smbus(struct pci_dev *dev)
 {
 	u8 val = 0;
-	printk(KERN_INFO "Enabling SiS 96x SMBus.\n");
-	pci_read_config_byte(dev, 0x77, &val);
-	pci_write_config_byte(dev, 0x77, val & ~0x10);
 	pci_read_config_byte(dev, 0x77, &val);
+	if (val & 0x10) {
+		printk(KERN_INFO "Enabling SiS 96x SMBus.\n");
+		pci_write_config_byte(dev, 0x77, val & ~0x10);
+	}
 }
 
 /*
@@ -1152,11 +1153,12 @@ static void quirk_sis_503(struct pci_dev
 	printk(KERN_WARNING "Uncovering SIS%x that hid as a SIS503 (compatible=%d)\n", devid, sis_96x_compatible);
 
 	/*
-	 * Ok, it now shows up as a 96x.. The 96x quirks are after
-	 * the 503 quirk in the quirk table, so they'll automatically
-	 * run and enable things like the SMBus device
+	 * Ok, it now shows up as a 96x.. run the 96x quirk by
+	 * hand in case it has already been processed.
+	 * (depends on link order, which is apparently not guaranteed)
 	 */
 	dev->device = devid;
+	quirk_sis_96x_smbus(dev);
 }
 
 static void __init quirk_sis_96x_compatible(struct pci_dev *dev)
-- 
Mark M. Hoffman
mhoffman@lightlink.com


  reply	other threads:[~2007-01-09  3:14 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-12-19  4:13 [-mm patch] drivers/pci/quirks.c: cleanup Adrian Bunk
2006-12-19  8:52 ` Matthew Wilcox
2006-12-19  9:57   ` Adrian Bunk
2007-01-05  8:52 ` Jean Delvare
2007-01-05 23:29   ` Adrian Bunk
2007-01-07 11:30     ` Jean Delvare
2007-01-07 15:40       ` Mark M. Hoffman
2007-01-14 13:46         ` [-mm patch] remove quirk_sis_96x_compatible() Adrian Bunk
2007-01-14 15:22           ` Mark M. Hoffman
2007-01-07 15:44   ` [-mm patch] drivers/pci/quirks.c: cleanup Mark M. Hoffman
2007-01-08 11:10     ` Jean Delvare
2007-01-09  3:02       ` Mark M. Hoffman
2007-01-09  3:11         ` Mark M. Hoffman [this message]
2007-01-09 13:17         ` Jean Delvare
2007-01-10  3:58           ` Mark M. Hoffman
2007-01-10  9:35             ` Jean Delvare

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20070109031129.GA27550@jupiter.solarsys.private \
    --to=mhoffman@lightlink.com \
    --cc=akpm@osdl.org \
    --cc=bunk@stusta.de \
    --cc=greg@kroah.com \
    --cc=khali@linux-fr.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@atrey.karlin.mff.cuni.cz \
    --cc=torvalds@osdl.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®