linux-hwmon.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Nuno Sá via B4 Relay" <devnull+nuno.sa.analog.com@kernel.org>
To: devicetree@vger.kernel.org, linux-hwmon@vger.kernel.org
Cc: Rob Herring <robh@kernel.org>,
	Krzysztof Kozlowski <krzk+dt@kernel.org>,
	 Conor Dooley <conor+dt@kernel.org>,
	Guenter Roeck <linux@roeck-us.net>
Subject: [PATCH 2/3] hwmon: (adt7410): Add OF match table
Date: Wed, 15 Oct 2025 15:52:20 +0100	[thread overview]
Message-ID: <20251015-dev-add-adt7422-v1-2-7cf72d3253ad@analog.com> (raw)
In-Reply-To: <20251015-dev-add-adt7422-v1-0-7cf72d3253ad@analog.com>

From: Nuno Sá <nuno.sa@analog.com>

Add a struct of_device_id match table to the driver.

While at it, make sure to properly include mod_devicetable.h which is
also needed for struct i2c_device_id.

Signed-off-by: Nuno Sá <nuno.sa@analog.com>
---
 drivers/hwmon/adt7410.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/drivers/hwmon/adt7410.c b/drivers/hwmon/adt7410.c
index 3bf0e0a0882c..79952866a4db 100644
--- a/drivers/hwmon/adt7410.c
+++ b/drivers/hwmon/adt7410.c
@@ -7,6 +7,7 @@
  */
 
 #include <linux/module.h>
+#include <linux/mod_devicetable.h>
 #include <linux/init.h>
 #include <linux/i2c.h>
 #include <linux/regmap.h>
@@ -94,10 +95,18 @@ static const struct i2c_device_id adt7410_ids[] = {
 };
 MODULE_DEVICE_TABLE(i2c, adt7410_ids);
 
+static const struct of_device_id adt7410_of_match[] = {
+	{ .compatible = "adi,adt7410" },
+	{ .compatible = "adi,adt7420" },
+	{ }
+};
+MODULE_DEVICE_TABLE(of, adt7410_of_match);
+
 static struct i2c_driver adt7410_driver = {
 	.driver = {
 		.name	= "adt7410",
 		.pm	= pm_sleep_ptr(&adt7x10_dev_pm_ops),
+		.of_match_table = adt7410_of_match,
 	},
 	.probe		= adt7410_i2c_probe,
 	.id_table	= adt7410_ids,

-- 
2.51.0



  parent reply	other threads:[~2025-10-15 14:51 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-15 14:52 [PATCH 0/3] hwmon: (adt7410): Add ADT7422 support Nuno Sá via B4 Relay
2025-10-15 14:52 ` [PATCH 1/3] dt-bindings: trivial-devices: add ADT7410, ADT7420 and ADT7422 Nuno Sá via B4 Relay
2025-10-16 16:20   ` Conor Dooley
2025-10-16 20:45   ` Guenter Roeck
2025-10-15 14:52 ` Nuno Sá via B4 Relay [this message]
2025-10-16 20:45   ` [PATCH 2/3] hwmon: (adt7410): Add OF match table Guenter Roeck
2025-10-15 14:52 ` [PATCH 3/3] hwmon: (adt7410): Support adt7422 chip Nuno Sá via B4 Relay
2025-10-16 20:46   ` Guenter Roeck

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20251015-dev-add-adt7422-v1-2-7cf72d3253ad@analog.com \
    --to=devnull+nuno.sa.analog.com@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=krzk+dt@kernel.org \
    --cc=linux-hwmon@vger.kernel.org \
    --cc=linux@roeck-us.net \
    --cc=nuno.sa@analog.com \
    --cc=robh@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).