Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

macintosh: therm_windtunnel: drop using attach_adapter

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>

+23 -2
+23 -2
drivers/macintosh/therm_windtunnel.c
··· 432 432 .driver = { 433 433 .name = "therm_windtunnel", 434 434 }, 435 - .attach_adapter = do_attach, 436 435 .probe = do_probe, 437 436 .remove = do_remove, 438 437 .id_table = therm_windtunnel_id, ··· 444 445 445 446 static int therm_of_probe(struct platform_device *dev) 446 447 { 447 - return i2c_add_driver( &g4fan_driver ); 448 + struct i2c_adapter *adap; 449 + int ret, i = 0; 450 + 451 + adap = i2c_get_adapter(0); 452 + if (!adap) 453 + return -EPROBE_DEFER; 454 + 455 + ret = i2c_add_driver(&g4fan_driver); 456 + if (ret) { 457 + i2c_put_adapter(adap); 458 + return ret; 459 + } 460 + 461 + /* We assume Macs have consecutive I2C bus numbers starting at 0 */ 462 + while (adap) { 463 + do_attach(adap); 464 + if (x.running) 465 + return 0; 466 + i2c_put_adapter(adap); 467 + adap = i2c_get_adapter(++i); 468 + } 469 + 470 + return -ENODEV; 448 471 } 449 472 450 473 static int