Skip to content

Commit 3481551

Browse files
Camel Guogroeck
authored andcommitted
hwmon: (tmp401) Add OF device ID table
This driver doesn't have of_match_table. This makes the kernel module tmp401.ko lack alias patterns (e.g: of:N*T*Cti,tmp411) to match DT node of the supported devices hence this kernel module will not be automatically loaded. After adding of_match_table to this driver, the folllowing alias will be added into tmp401.ko. $ modinfo drivers/hwmon/tmp401.ko filename: drivers/hwmon/tmp401.ko ...... author: Hans de Goede <[email protected]> alias: of:N*T*Cti,tmp435C* alias: of:N*T*Cti,tmp435 alias: of:N*T*Cti,tmp432C* alias: of:N*T*Cti,tmp432 alias: of:N*T*Cti,tmp431C* alias: of:N*T*Cti,tmp431 alias: of:N*T*Cti,tmp411C* alias: of:N*T*Cti,tmp411 alias: of:N*T*Cti,tmp401C* alias: of:N*T*Cti,tmp401 ...... Fixes: af50371 ("i2c: core: report OF style module alias for devices registered via OF") Signed-off-by: Camel Guo <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Guenter Roeck <[email protected]>
1 parent 08da09f commit 3481551

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

drivers/hwmon/tmp401.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -708,10 +708,21 @@ static int tmp401_probe(struct i2c_client *client)
708708
return 0;
709709
}
710710

711+
static const struct of_device_id __maybe_unused tmp4xx_of_match[] = {
712+
{ .compatible = "ti,tmp401", },
713+
{ .compatible = "ti,tmp411", },
714+
{ .compatible = "ti,tmp431", },
715+
{ .compatible = "ti,tmp432", },
716+
{ .compatible = "ti,tmp435", },
717+
{ },
718+
};
719+
MODULE_DEVICE_TABLE(of, tmp4xx_of_match);
720+
711721
static struct i2c_driver tmp401_driver = {
712722
.class = I2C_CLASS_HWMON,
713723
.driver = {
714724
.name = "tmp401",
725+
.of_match_table = of_match_ptr(tmp4xx_of_match),
715726
},
716727
.probe_new = tmp401_probe,
717728
.id_table = tmp401_id,

0 commit comments

Comments
 (0)