hwmon: (tmp401) Add OF device ID table
PATCH v3 1/1 hwmon: (tmp401) Add OF device ID table
The driver doesn't have a struct of_device_id table but supported devices are registered via Device Trees. This is working on the assumption that a I2C device registered via OF will always match a legacy I2C device ID and that the MODALIAS reported will always be of the form i2c:<device>.
But this could change in the future so the correct approach is to have an OF device ID table if the devices are registered via OF.
---
Notes:
v3:
- Copy commit message from commit 72fc64c68decf119466 ("hwmon: (tmp103) Add OF device ID table")
- Add Fixes tag
v2:
- Put evidence and circumstances in commit message
drivers/hwmon/tmp401.c | 11 +++++++++++ 1 file changed, 11 insertions(+)
drivers/hwmon/tmp401.c +11 -0
@@ -708,10 +708,21 @@ static int tmp401_probe(struct i2c_client *client)return 0 ; } +static const struct of_device_id __maybe_unused tmp4xx_of_match[] = { + { .compatible ="ti,tmp401" , }, + { .compatible ="ti,tmp411" , }, + { .compatible ="ti,tmp431" , }, + { .compatible ="ti,tmp432" , }, + { .compatible ="ti,tmp435" , }, + { }, +}; +MODULE_DEVICE_TABLE (of, tmp4xx_of_match); +static struct i2c_driver tmp401_driver = { .class =I2C_CLASS_HWMON , .driver = { .name ="tmp401" , + .of_match_table =of_match_ptr (tmp4xx_of_match), }, .probe_new = tmp401_probe, .id_table = tmp401_id,
base-commit: 38d741cb70b30741c0e802cbed7bd9cf4fd15fa4
Signature · 1 line
2.30.2
Quoted 51 lines · Camel Guo
The driver doesn't have a struct
of_device_idtable but supported devices are registered via Device Trees. This is working on the assumption that a I2C device registered via OF will always match a legacy I2C device ID and that the MODALIAS reported will always be of the form i2c:<device>.But this could change in the future so the correct approach is to have an OF device ID table if the devices are registered via OF.
Fixes af503716ac14 ("i2c: core: report OF style module alias for devices registered via OF")Signed-off-by Camel Guo <[email protected]>---
Notes:
v3:
- Copy commit message from commit72fc64c68decf119466("hwmon:
(tmp103)
Add OF device ID table")
- Add Fixes tag
v2:
- Put evidence and circumstances in commit messagedrivers/hwmon/tmp401.c | 11 +++++++++++ 1 file changed, 11 insertions(+)drivers/hwmon/tmp401.c +11
-0@@ -708,10 +708,21 @@ static int tmp401_probe(struct i2c_client *client) return 0; } +static const struct of_device_id __maybe_unused tmp4xx_of_match[] = { + { .compatible = "ti,tmp401", }, + { .compatible = "ti,tmp411", }, + { .compatible = "ti,tmp431", }, + { .compatible = "ti,tmp432", }, + { .compatible = "ti,tmp435", }, + { }, +}; +MODULE_DEVICE_TABLE (of, tmp4xx_of_match); + static struct i2c_driver tmp401_driver = { .class = I2C_CLASS_HWMON, .driver = { .name = "tmp401", + .of_match_table = of_match_ptr(tmp4xx_of_match), }, .probe_new = tmp401_probe, .id_table = tmp401_id,
Quoted 4 lines
base-commit:
38d741cb70b30741c0e802cbed7bd9cf4fd15fa4Signature · 1 line
2.30.2
Sorry for the spam, but after rethinking, I think some description in commit message is improper. Hence I updated it in v4. Please review that one instead.