hwmon: (tmp401) Add of_match_table
PATCH 1/1 hwmon: (tmp401) Add of_match_table
Add the missing of_match_table to allow device tree probing
Signed-off-by Camel Guo <[email protected]>
--- drivers/hwmon/tmp401.c | 11 +++++++++++ 1 file changed, 11 insertions(+)
drivers/hwmon/tmp401.c +11 -0
@@ -750,10 +750,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,
Signature · 1 line
2.30.2
Guenter Roeck
maintainerQuoted 2 lines · Camel Guo
Add the missing
of_match_tableto allow device tree probing
I2C devices probe based on the I2C device table even on devicetree systems, so this isn't a correct statement. Please provide evidence and explain in detail the circumstances where this does not work.
Guenter
Quoted 31 lines
Signed-off-by Camel Guo <[email protected]>--- drivers/hwmon/tmp401.c | 11 +++++++++++ 1 file changed, 11 insertions(+)drivers/hwmon/tmp401.c +11
-0@@ -750,10 +750,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 7 lines · Guenter Roeck
Quoted 2 lines · Camel Guo
Add the missing
of_match_tableto allow device tree probingI2C devices probe based on the I2C device table even on devicetree systems, so this isn't a correct statement. Please provide evidence and explain in detail the circumstances where this does not work.
Commit message was updated in v2. Please check out v2 instead.
Quoted 35 lines
Guenter
Quoted 31 lines
Signed-off-by Camel Guo <[email protected]>---
drivers/hwmon/tmp401.c| 11 +++++++++++1 file changed, 11 insertions(+)drivers/hwmon/tmp401.c +11
-0@@ -750,10 +750,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,