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

macintosh: windfarm: fix MODINFO regression

Commit af503716ac14 made sure OF devices get an OF style modalias with
I2C events. It assumed all in-tree users were converted, yet it missed
some Macintosh drivers.

Add an OF module device table for all windfarm drivers to make them
automatically load again.

Fixes: af503716ac14 ("i2c: core: report OF style module alias for devices registered via OF")
Link: https://bugzilla.kernel.org/show_bug.cgi?id=199471
Reported-by: Erhard Furtner <erhard_f@mailbox.org>
Tested-by: Erhard Furtner <erhard_f@mailbox.org>
Acked-by: Michael Ellerman <mpe@ellerman.id.au> (powerpc)
Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
Cc: stable@kernel.org # v4.17+

+50 -1
+7
drivers/macintosh/windfarm_ad7417_sensor.c
··· 312 312 }; 313 313 MODULE_DEVICE_TABLE(i2c, wf_ad7417_id); 314 314 315 + static const struct of_device_id wf_ad7417_of_id[] = { 316 + { .compatible = "ad7417", }, 317 + { } 318 + }; 319 + MODULE_DEVICE_TABLE(of, wf_ad7417_of_id); 320 + 315 321 static struct i2c_driver wf_ad7417_driver = { 316 322 .driver = { 317 323 .name = "wf_ad7417", 324 + .of_match_table = wf_ad7417_of_id, 318 325 }, 319 326 .probe = wf_ad7417_probe, 320 327 .remove = wf_ad7417_remove,
+7
drivers/macintosh/windfarm_fcu_controls.c
··· 580 580 }; 581 581 MODULE_DEVICE_TABLE(i2c, wf_fcu_id); 582 582 583 + static const struct of_device_id wf_fcu_of_id[] = { 584 + { .compatible = "fcu", }, 585 + { } 586 + }; 587 + MODULE_DEVICE_TABLE(of, wf_fcu_of_id); 588 + 583 589 static struct i2c_driver wf_fcu_driver = { 584 590 .driver = { 585 591 .name = "wf_fcu", 592 + .of_match_table = wf_fcu_of_id, 586 593 }, 587 594 .probe = wf_fcu_probe, 588 595 .remove = wf_fcu_remove,
+15 -1
drivers/macintosh/windfarm_lm75_sensor.c
··· 14 14 #include <linux/init.h> 15 15 #include <linux/wait.h> 16 16 #include <linux/i2c.h> 17 + #include <linux/of_device.h> 17 18 #include <asm/prom.h> 18 19 #include <asm/machdep.h> 19 20 #include <asm/io.h> ··· 92 91 const struct i2c_device_id *id) 93 92 { 94 93 struct wf_lm75_sensor *lm; 95 - int rc, ds1775 = id->driver_data; 94 + int rc, ds1775; 96 95 const char *name, *loc; 96 + 97 + if (id) 98 + ds1775 = id->driver_data; 99 + else 100 + ds1775 = !!of_device_get_match_data(&client->dev); 97 101 98 102 DBG("wf_lm75: creating %s device at address 0x%02x\n", 99 103 ds1775 ? "ds1775" : "lm75", client->addr); ··· 170 164 }; 171 165 MODULE_DEVICE_TABLE(i2c, wf_lm75_id); 172 166 167 + static const struct of_device_id wf_lm75_of_id[] = { 168 + { .compatible = "lm75", .data = (void *)0}, 169 + { .compatible = "ds1775", .data = (void *)1 }, 170 + { } 171 + }; 172 + MODULE_DEVICE_TABLE(of, wf_lm75_of_id); 173 + 173 174 static struct i2c_driver wf_lm75_driver = { 174 175 .driver = { 175 176 .name = "wf_lm75", 177 + .of_match_table = wf_lm75_of_id, 176 178 }, 177 179 .probe = wf_lm75_probe, 178 180 .remove = wf_lm75_remove,
+7
drivers/macintosh/windfarm_lm87_sensor.c
··· 166 166 }; 167 167 MODULE_DEVICE_TABLE(i2c, wf_lm87_id); 168 168 169 + static const struct of_device_id wf_lm87_of_id[] = { 170 + { .compatible = "lm87cimt", }, 171 + { } 172 + }; 173 + MODULE_DEVICE_TABLE(of, wf_lm87_of_id); 174 + 169 175 static struct i2c_driver wf_lm87_driver = { 170 176 .driver = { 171 177 .name = "wf_lm87", 178 + .of_match_table = wf_lm87_of_id, 172 179 }, 173 180 .probe = wf_lm87_probe, 174 181 .remove = wf_lm87_remove,
+7
drivers/macintosh/windfarm_max6690_sensor.c
··· 120 120 }; 121 121 MODULE_DEVICE_TABLE(i2c, wf_max6690_id); 122 122 123 + static const struct of_device_id wf_max6690_of_id[] = { 124 + { .compatible = "max6690", }, 125 + { } 126 + }; 127 + MODULE_DEVICE_TABLE(of, wf_max6690_of_id); 128 + 123 129 static struct i2c_driver wf_max6690_driver = { 124 130 .driver = { 125 131 .name = "wf_max6690", 132 + .of_match_table = wf_max6690_of_id, 126 133 }, 127 134 .probe = wf_max6690_probe, 128 135 .remove = wf_max6690_remove,
+7
drivers/macintosh/windfarm_smu_sat.c
··· 341 341 }; 342 342 MODULE_DEVICE_TABLE(i2c, wf_sat_id); 343 343 344 + static const struct of_device_id wf_sat_of_id[] = { 345 + { .compatible = "smu-sat", }, 346 + { } 347 + }; 348 + MODULE_DEVICE_TABLE(of, wf_sat_of_id); 349 + 344 350 static struct i2c_driver wf_sat_driver = { 345 351 .driver = { 346 352 .name = "wf_smu_sat", 353 + .of_match_table = wf_sat_of_id, 347 354 }, 348 355 .probe = wf_sat_probe, 349 356 .remove = wf_sat_remove,