diff mbox series

[2/2] hwmon: (w83781d) Match on device tree compatibles

Message ID 20210729230543.2853485-2-linus.walleij@linaro.org (mailing list archive)
State Accepted
Headers show
Series [1/2] dt-bindings: hwmon: Add bindings for Winbond W83781D | expand

Commit Message

Linus Walleij July 29, 2021, 11:05 p.m. UTC
I2C devices should match on the proper compatible string.
This is already used in one device tree in the kernel (MIPS)
so let's add the matches.

Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
---
 drivers/hwmon/w83781d.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

Comments

Guenter Roeck July 30, 2021, 5:10 p.m. UTC | #1
On 7/29/21 4:05 PM, Linus Walleij wrote:
> I2C devices should match on the proper compatible string.
> This is already used in one device tree in the kernel (MIPS)
> so let's add the matches.
> 
> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>

For my reference:

Reviewed-by: Guenter Roeck <linux@roeck-us.net>

Waiting for Rob's approval of the devicetree patch.

Thanks,
Guenter

> ---
>   drivers/hwmon/w83781d.c | 11 +++++++++++
>   1 file changed, 11 insertions(+)
> 
> diff --git a/drivers/hwmon/w83781d.c b/drivers/hwmon/w83781d.c
> index e84aa5604e64..ce8e2c10e854 100644
> --- a/drivers/hwmon/w83781d.c
> +++ b/drivers/hwmon/w83781d.c
> @@ -1571,10 +1571,21 @@ static const struct i2c_device_id w83781d_ids[] = {
>   };
>   MODULE_DEVICE_TABLE(i2c, w83781d_ids);
>   
> +static const struct of_device_id w83781d_of_match[] = {
> +	{ .compatible = "winbond,w83781d" },
> +	{ .compatible = "winbond,w83781g" },
> +	{ .compatible = "winbond,w83782d" },
> +	{ .compatible = "winbond,w83783s" },
> +	{ .compatible = "asus,as99127f" },
> +	{ },
> +};
> +MODULE_DEVICE_TABLE(of, w83781d_of_match);
> +
>   static struct i2c_driver w83781d_driver = {
>   	.class		= I2C_CLASS_HWMON,
>   	.driver = {
>   		.name = "w83781d",
> +		.of_match_table = w83781d_of_match,
>   	},
>   	.probe_new	= w83781d_probe,
>   	.remove		= w83781d_remove,
>
Guenter Roeck Aug. 3, 2021, 7:40 p.m. UTC | #2
On Fri, Jul 30, 2021 at 01:05:43AM +0200, Linus Walleij wrote:
> I2C devices should match on the proper compatible string.
> This is already used in one device tree in the kernel (MIPS)
> so let's add the matches.
> 
> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
> Reviewed-by: Guenter Roeck <linux@roeck-us.net>

Applied.

Thanks,
Guenter
diff mbox series

Patch

diff --git a/drivers/hwmon/w83781d.c b/drivers/hwmon/w83781d.c
index e84aa5604e64..ce8e2c10e854 100644
--- a/drivers/hwmon/w83781d.c
+++ b/drivers/hwmon/w83781d.c
@@ -1571,10 +1571,21 @@  static const struct i2c_device_id w83781d_ids[] = {
 };
 MODULE_DEVICE_TABLE(i2c, w83781d_ids);
 
+static const struct of_device_id w83781d_of_match[] = {
+	{ .compatible = "winbond,w83781d" },
+	{ .compatible = "winbond,w83781g" },
+	{ .compatible = "winbond,w83782d" },
+	{ .compatible = "winbond,w83783s" },
+	{ .compatible = "asus,as99127f" },
+	{ },
+};
+MODULE_DEVICE_TABLE(of, w83781d_of_match);
+
 static struct i2c_driver w83781d_driver = {
 	.class		= I2C_CLASS_HWMON,
 	.driver = {
 		.name = "w83781d",
+		.of_match_table = w83781d_of_match,
 	},
 	.probe_new	= w83781d_probe,
 	.remove		= w83781d_remove,