linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [RESEND PATCH] i2c/busses/pasemi: Remove hardcoded bus numbers on smbus
@ 2017-12-31 20:53 Darren Stevens
  2018-08-20  9:07 ` Wolfram Sang
  0 siblings, 1 reply; 3+ messages in thread
From: Darren Stevens @ 2017-12-31 20:53 UTC (permalink / raw)
  To: wsa, linux-i2c, linux-kernel; +Cc: linuxppc-dev

[-- Attachment #1: Type: text/plain, Size: 178 bytes --]

  AmigaOS...........: http://yam.ch/
  Unix/MacOS/Windows: http://www.mozilla.com/thunderbird/

General information about MIME can be found at:
http://en.wikipedia.org/wiki/MIME

[-- Attachment #2: Type: text/plain, Size: 398 bytes --]

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>

---


[-- Attachment #3: i2c.patch --]
[-- Type: text/plain, Size: 826 bytes --]

diff --git a/drivers/i2c/busses/i2c-pasemi.c b/drivers/i2c/busses/i2c-pasemi.c
index df1dbc9..05847fd 100644
--- a/drivers/i2c/busses/i2c-pasemi.c
+++ b/drivers/i2c/busses/i2c-pasemi.c
@@ -365,7 +365,6 @@ 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);
 
 	/* set up the sysfs linkage to our parent device */
 	smbus->adapter.dev.parent = &dev->dev;
@@ -373,7 +372,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;
 

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

* Re: [RESEND PATCH] i2c/busses/pasemi: Remove hardcoded bus numbers on smbus
  2017-12-31 20:53 [RESEND PATCH] i2c/busses/pasemi: Remove hardcoded bus numbers on smbus Darren Stevens
@ 2018-08-20  9:07 ` Wolfram Sang
  0 siblings, 0 replies; 3+ messages in thread
From: Wolfram Sang @ 2018-08-20  9:07 UTC (permalink / raw)
  To: Darren Stevens; +Cc: linux-i2c, linux-kernel, linuxppc-dev

[-- Attachment #1: Type: text/plain, Size: 815 bytes --]

On Sun, Dec 31, 2017 at 08:53:55PM +0000, Darren Stevens wrote:
> 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>
> 

Applied to for-next, thanks!

Disclaimer: I usually do not like to change the bus numbering because
some people may rely on that. But numbering based on PCI functions seems
really weak and all known users of pasemi seem to have issues here, so I
make an exception.

Thanks to Michael Ellerman for the additional info.


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

* [RESEND PATCH] i2c/busses/pasemi: Remove hardcoded bus numbers on smbus
@ 2017-02-26 21:49 Darren Stevens
  0 siblings, 0 replies; 3+ messages in thread
From: Darren Stevens @ 2017-02-26 21:49 UTC (permalink / raw)
  To: wsa, linux-i2c, linux-kernel; +Cc: linuxppc-dev

[-- Attachment #1: Type: text/plain, Size: 178 bytes --]

  AmigaOS...........: http://yam.ch/
  Unix/MacOS/Windows: http://www.mozilla.com/thunderbird/

General information about MIME can be found at:
http://en.wikipedia.org/wiki/MIME

[-- Attachment #2: Type: text/plain, Size: 463 bytes --]

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>

---
Resent as it doesn't seem to have reached linux-i2c mailing list.

[-- Attachment #3: i2c.patch --]
[-- Type: text/plain, Size: 826 bytes --]

diff --git a/drivers/i2c/busses/i2c-pasemi.c b/drivers/i2c/busses/i2c-pasemi.c
index df1dbc9..05847fd 100644
--- a/drivers/i2c/busses/i2c-pasemi.c
+++ b/drivers/i2c/busses/i2c-pasemi.c
@@ -365,7 +365,6 @@ 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);
 
 	/* set up the sysfs linkage to our parent device */
 	smbus->adapter.dev.parent = &dev->dev;
@@ -373,7 +372,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;
 

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

end of thread, other threads:[~2018-08-20  9:16 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-12-31 20:53 [RESEND PATCH] i2c/busses/pasemi: Remove hardcoded bus numbers on smbus Darren Stevens
2018-08-20  9:07 ` Wolfram Sang
  -- strict thread matches above, loose matches on Subject: below --
2017-02-26 21:49 Darren Stevens

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).