Skip to content

Commit

Permalink
macintosh: therm_windtunnel: drop using attach_adapter
Browse files Browse the repository at this point in the history
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 <[email protected]>
Acked-by: Michael Ellerman <[email protected]>
  • Loading branch information
Wolfram Sang committed Aug 24, 2018
1 parent 33e1787 commit 3e7bed5
Showing 1 changed file with 23 additions and 2 deletions.
25 changes: 23 additions & 2 deletions drivers/macintosh/therm_windtunnel.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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
Expand Down

0 comments on commit 3e7bed5

Please sign in to comment.