diff mbox

[RFC] powerpc/pasemi: Remove hardcoded bus numbers on smbus

Message ID 48a33908b3a.5917bc37@auth.smtp.1and1.co.uk (mailing list archive)
State RFC
Headers show

Commit Message

Darren Stevens Aug. 13, 2016, 6:42 p.m. UTC
The pasemi smbus controller uses PCI_FUNC(dev->devfn) to define which
number bus to attach to, however this fails when something else is 
probed first, for example an ATI Radeon graphics card will claim 9 or
10 busses, including the ones the pasemi wants.
Patch the driver to call i2c_add_adapter rather than
i2c_add_numbered_adapter.

Signed-off-by: Darren Stevens <darren@stevens-zone.net>

---

I've tested this on my X1000, and can now see the pasemi busses when I
run i2cdetect, and can even see devices on bus 0, but as this is probably
the first time we've had this working, more testing will be needed.

I don't know why the bus tries to use bus numbers 0-2, I couldn't see
any reason, maybe Olof has an idea?

Regards
Darren
diff mbox

Patch

diff --git a/drivers/i2c/busses/i2c-pasemi.c b/drivers/i2c/busses/i2c-pasemi.c
index df1dbc9..ecce83e 100644
--- a/drivers/i2c/busses/i2c-pasemi.c
+++ b/drivers/i2c/busses/i2c-pasemi.c
@@ -365,7 +365,7 @@  static int pasemi_smb_probe(struct pci_dev *dev,
 	smbus->adapter.class = I2C_CLASS_HWMON | I2C_CLASS_SPD;
 	smbus->adapter.algo = &smbus_algorithm;
 	smbus->adapter.algo_data = smbus;
-	smbus->adapter.nr = PCI_FUNC(dev->devfn);
+	smbus->adapter.nr = -1;
 
 	/* set up the sysfs linkage to our parent device */
 	smbus->adapter.dev.parent = &dev->dev;
@@ -373,7 +373,7 @@  static int pasemi_smb_probe(struct pci_dev *dev,
 	reg_write(smbus, REG_CTL, (CTL_MTR | CTL_MRR |
 		  (CLK_100K_DIV & CTL_CLK_M)));
 
-	error = i2c_add_numbered_adapter(&smbus->adapter);
+	error = i2c_add_adapter(&smbus->adapter);
 	if (error)
 		goto out_release_region;