Skip to content

Commit bcf3588

Browse files
author
Wolfram Sang
committed
macintosh: windfarm: fix MODINFO regression
Commit af50371 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: af50371 ("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 <[email protected]> Tested-by: Erhard Furtner <[email protected]> Acked-by: Michael Ellerman <[email protected]> (powerpc) Signed-off-by: Wolfram Sang <[email protected]> Cc: [email protected] # v4.17+
1 parent 9be8bc4 commit bcf3588

File tree

6 files changed

+50
-1
lines changed

6 files changed

+50
-1
lines changed

drivers/macintosh/windfarm_ad7417_sensor.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -312,9 +312,16 @@ static const struct i2c_device_id wf_ad7417_id[] = {
312312
};
313313
MODULE_DEVICE_TABLE(i2c, wf_ad7417_id);
314314

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+
315321
static struct i2c_driver wf_ad7417_driver = {
316322
.driver = {
317323
.name = "wf_ad7417",
324+
.of_match_table = wf_ad7417_of_id,
318325
},
319326
.probe = wf_ad7417_probe,
320327
.remove = wf_ad7417_remove,

drivers/macintosh/windfarm_fcu_controls.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -580,9 +580,16 @@ static const struct i2c_device_id wf_fcu_id[] = {
580580
};
581581
MODULE_DEVICE_TABLE(i2c, wf_fcu_id);
582582

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+
583589
static struct i2c_driver wf_fcu_driver = {
584590
.driver = {
585591
.name = "wf_fcu",
592+
.of_match_table = wf_fcu_of_id,
586593
},
587594
.probe = wf_fcu_probe,
588595
.remove = wf_fcu_remove,

drivers/macintosh/windfarm_lm75_sensor.c

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
#include <linux/init.h>
1515
#include <linux/wait.h>
1616
#include <linux/i2c.h>
17+
#include <linux/of_device.h>
1718
#include <asm/prom.h>
1819
#include <asm/machdep.h>
1920
#include <asm/io.h>
@@ -91,9 +92,14 @@ static int wf_lm75_probe(struct i2c_client *client,
9192
const struct i2c_device_id *id)
9293
{
9394
struct wf_lm75_sensor *lm;
94-
int rc, ds1775 = id->driver_data;
95+
int rc, ds1775;
9596
const char *name, *loc;
9697

98+
if (id)
99+
ds1775 = id->driver_data;
100+
else
101+
ds1775 = !!of_device_get_match_data(&client->dev);
102+
97103
DBG("wf_lm75: creating %s device at address 0x%02x\n",
98104
ds1775 ? "ds1775" : "lm75", client->addr);
99105

@@ -164,9 +170,17 @@ static const struct i2c_device_id wf_lm75_id[] = {
164170
};
165171
MODULE_DEVICE_TABLE(i2c, wf_lm75_id);
166172

173+
static const struct of_device_id wf_lm75_of_id[] = {
174+
{ .compatible = "lm75", .data = (void *)0},
175+
{ .compatible = "ds1775", .data = (void *)1 },
176+
{ }
177+
};
178+
MODULE_DEVICE_TABLE(of, wf_lm75_of_id);
179+
167180
static struct i2c_driver wf_lm75_driver = {
168181
.driver = {
169182
.name = "wf_lm75",
183+
.of_match_table = wf_lm75_of_id,
170184
},
171185
.probe = wf_lm75_probe,
172186
.remove = wf_lm75_remove,

drivers/macintosh/windfarm_lm87_sensor.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,9 +166,16 @@ static const struct i2c_device_id wf_lm87_id[] = {
166166
};
167167
MODULE_DEVICE_TABLE(i2c, wf_lm87_id);
168168

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+
169175
static struct i2c_driver wf_lm87_driver = {
170176
.driver = {
171177
.name = "wf_lm87",
178+
.of_match_table = wf_lm87_of_id,
172179
},
173180
.probe = wf_lm87_probe,
174181
.remove = wf_lm87_remove,

drivers/macintosh/windfarm_max6690_sensor.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,9 +120,16 @@ static const struct i2c_device_id wf_max6690_id[] = {
120120
};
121121
MODULE_DEVICE_TABLE(i2c, wf_max6690_id);
122122

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+
123129
static struct i2c_driver wf_max6690_driver = {
124130
.driver = {
125131
.name = "wf_max6690",
132+
.of_match_table = wf_max6690_of_id,
126133
},
127134
.probe = wf_max6690_probe,
128135
.remove = wf_max6690_remove,

drivers/macintosh/windfarm_smu_sat.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -341,9 +341,16 @@ static const struct i2c_device_id wf_sat_id[] = {
341341
};
342342
MODULE_DEVICE_TABLE(i2c, wf_sat_id);
343343

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+
344350
static struct i2c_driver wf_sat_driver = {
345351
.driver = {
346352
.name = "wf_smu_sat",
353+
.of_match_table = wf_sat_of_id,
347354
},
348355
.probe = wf_sat_probe,
349356
.remove = wf_sat_remove,

0 commit comments

Comments
 (0)