linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] hwmon: (tmp401) Add of_match_table
@ 2022-04-29  9:52 Camel Guo
  2022-04-29 16:22 ` Guenter Roeck
  0 siblings, 1 reply; 3+ messages in thread
From: Camel Guo @ 2022-04-29  9:52 UTC (permalink / raw)
  To: Guenter Roeck, Jean Delvare; +Cc: Camel Guo, linux-hwmon, linux-kernel, kernel

Add the missing of_match_table to allow device tree probing

Signed-off-by: Camel Guo <camel.guo@axis.com>
---
 drivers/hwmon/tmp401.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/drivers/hwmon/tmp401.c b/drivers/hwmon/tmp401.c
index a58a2f31a07e..cc0a1c219b1f 100644
--- a/drivers/hwmon/tmp401.c
+++ b/drivers/hwmon/tmp401.c
@@ -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,
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] hwmon: (tmp401) Add of_match_table
  2022-04-29  9:52 [PATCH] hwmon: (tmp401) Add of_match_table Camel Guo
@ 2022-04-29 16:22 ` Guenter Roeck
  2022-05-02  9:20   ` Camel Guo
  0 siblings, 1 reply; 3+ messages in thread
From: Guenter Roeck @ 2022-04-29 16:22 UTC (permalink / raw)
  To: Camel Guo, Jean Delvare; +Cc: linux-hwmon, linux-kernel, kernel

On 4/29/22 02:52, Camel Guo wrote:
> Add the missing of_match_table to 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

> Signed-off-by: Camel Guo <camel.guo@axis.com>
> ---
>   drivers/hwmon/tmp401.c | 11 +++++++++++
>   1 file changed, 11 insertions(+)
> 
> diff --git a/drivers/hwmon/tmp401.c b/drivers/hwmon/tmp401.c
> index a58a2f31a07e..cc0a1c219b1f 100644
> --- a/drivers/hwmon/tmp401.c
> +++ b/drivers/hwmon/tmp401.c
> @@ -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,


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] hwmon: (tmp401) Add of_match_table
  2022-04-29 16:22 ` Guenter Roeck
@ 2022-05-02  9:20   ` Camel Guo
  0 siblings, 0 replies; 3+ messages in thread
From: Camel Guo @ 2022-05-02  9:20 UTC (permalink / raw)
  To: Guenter Roeck, Camel Guo, Jean Delvare; +Cc: linux-hwmon, linux-kernel, kernel

On 4/29/22 18:22, Guenter Roeck wrote:
> On 4/29/22 02:52, Camel Guo wrote:
>> Add the missing of_match_table to 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.

Commit message was updated in v2. Please check out v2 instead.

> 
> Guenter
> 
>> Signed-off-by: Camel Guo <camel.guo@axis.com>
>> ---
>>   drivers/hwmon/tmp401.c | 11 +++++++++++
>>   1 file changed, 11 insertions(+)
>> 
>> diff --git a/drivers/hwmon/tmp401.c b/drivers/hwmon/tmp401.c
>> index a58a2f31a07e..cc0a1c219b1f 100644
>> --- a/drivers/hwmon/tmp401.c
>> +++ b/drivers/hwmon/tmp401.c
>> @@ -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,
> 


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-05-02  9:20 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-29  9:52 [PATCH] hwmon: (tmp401) Add of_match_table Camel Guo
2022-04-29 16:22 ` Guenter Roeck
2022-05-02  9:20   ` Camel Guo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).