[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Bug#741663: linux-image-3.13-1-powerpc-smp: therm_windtunnel does not load correctly



Hi Rick,

On Sun, Sep 09, 2018 at 02:55:42AM -0700, Rick Thomas wrote:
> 
> On Sep 9, 2018, at 1:59 AM, Wolfram Sang <wsa@the-dreams.de> wrote:
> 
> > On Sat, Sep 08, 2018 at 02:48:01PM -0700, Rick Thomas wrote:
> >> Thanks!  Yes, I’ll give it a try.
> > 
> > Note: You can either build the v4.19-rc1 tar ball which has the patch
> > already included. Or you can take your Debian kernel and add this patch:
> > 
> > http://patchwork.ozlabs.org/patch/960488/
> > 
> > You can download it as mbox there which gives you a file to apply.
> 
> Thank you!
> 
> Please remember, I’ve never done this before…  so I’ve still got a couple of questions:
> 
> How do I get a copy of the v4.19-rc1 tar ball, if I decide to go that way?  And once I’ve got it, which section of the kernel handbook do I look in for instructions to build it?
> 
> And supposing I decide to go the other way and add the patch to my current kernel (4.18.0-1-powerpc64) how do I get the patch in a form that I can add it to the kernel?  I’m assuming that section 4.2.2 “Simple patching and building” is where I go for instructions once I’ve got the patch?
> 
> Thanks, and really sorry for my ignorance!  

if you want to do the road as described in 4.2.2, please find
attached the extracted patch to use as argument to test-patches
script.

If you want instead to built 4.19-rc1 cf.
https://kernel-team.pages.debian.net/kernel-handbook/ch-common-tasks.html#s-kernel-org-package
.

Regards,
Salvatore
From: Wolfram Sang <wsa@the-dreams.de>
Date: Tue, 21 Aug 2018 17:02:39 +0200
Subject: macintosh: therm_windtunnel: drop using attach_adapter
Origin: https://git.kernel.org/linus/3e7bed52719de4b5b5fb900869e293eae0bc3f3e
Bug-Debian: https://bugs.debian.org/741663

As we now have deferred probing, we can use a custom mechanism and
finally get rid of the legacy interface from the i2c core.

Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
Acked-by: Michael Ellerman <mpe@ellerman.id.au>
---
 drivers/macintosh/therm_windtunnel.c | 25 +++++++++++++++++++++++--
 1 file changed, 23 insertions(+), 2 deletions(-)

diff --git a/drivers/macintosh/therm_windtunnel.c b/drivers/macintosh/therm_windtunnel.c
index 68dcbcb4fc5b..8c744578122a 100644
--- a/drivers/macintosh/therm_windtunnel.c
+++ b/drivers/macintosh/therm_windtunnel.c
@@ -432,7 +432,6 @@ static struct i2c_driver g4fan_driver = {
 	.driver = {
 		.name	= "therm_windtunnel",
 	},
-	.attach_adapter = do_attach,
 	.probe		= do_probe,
 	.remove		= do_remove,
 	.id_table	= therm_windtunnel_id,
@@ -445,7 +444,29 @@ static struct i2c_driver g4fan_driver = {
 
 static int therm_of_probe(struct platform_device *dev)
 {
-	return i2c_add_driver( &g4fan_driver );
+	struct i2c_adapter *adap;
+	int ret, i = 0;
+
+	adap = i2c_get_adapter(0);
+	if (!adap)
+		return -EPROBE_DEFER;
+
+	ret = i2c_add_driver(&g4fan_driver);
+	if (ret) {
+		i2c_put_adapter(adap);
+		return ret;
+	}
+
+	/* We assume Macs have consecutive I2C bus numbers starting at 0 */
+	while (adap) {
+		do_attach(adap);
+		if (x.running)
+			return 0;
+		i2c_put_adapter(adap);
+		adap = i2c_get_adapter(++i);
+	}
+
+	return -ENODEV;
 }
 
 static int
-- 
2.19.0.rc2


Reply to: