linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFC PATCH 2/2] hwmon: (sht3x) add device-tree support
       [not found] <20230621035937.58721-1-JuenKit_Yip@hotmail.com>
@ 2023-06-21  3:59 ` JuenKit Yip
  2023-06-21 15:35   ` Guenter Roeck
  0 siblings, 1 reply; 2+ messages in thread
From: JuenKit Yip @ 2023-06-21  3:59 UTC (permalink / raw)
  To: linux, jdelvare; +Cc: linux-hwmon, linux-kernel, JuenKit Yip

add "compatible" property for supporting device-tree

Signed-off-by: JuenKit Yip <JuenKit_Yip@hotmail.com>
---
 drivers/hwmon/sht3x.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/drivers/hwmon/sht3x.c b/drivers/hwmon/sht3x.c
index 31013b5b6..edcf6820c 100644
--- a/drivers/hwmon/sht3x.c
+++ b/drivers/hwmon/sht3x.c
@@ -923,8 +923,18 @@ static const struct i2c_device_id sht3x_ids[] = {
 
 MODULE_DEVICE_TABLE(i2c, sht3x_ids);
 
+/* devicetree ID table */
+static const struct of_device_id sht3x_of_match[] = {
+	{ .compatible = "sensirion,sht3x" },
+	{ .compatible = "sensirion,sts3x" },
+	{},
+};
+
 static struct i2c_driver sht3x_i2c_driver = {
-	.driver.name = "sht3x",
+	.driver = {
+		.name = "sht3x",
+		.of_match_table = of_match_ptr(sht3x_of_match),
+	},
 	.probe       = sht3x_probe,
 	.id_table    = sht3x_ids,
 };
-- 
2.30.2


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

* Re: [RFC PATCH 2/2] hwmon: (sht3x) add device-tree support
  2023-06-21  3:59 ` [RFC PATCH 2/2] hwmon: (sht3x) add device-tree support JuenKit Yip
@ 2023-06-21 15:35   ` Guenter Roeck
  0 siblings, 0 replies; 2+ messages in thread
From: Guenter Roeck @ 2023-06-21 15:35 UTC (permalink / raw)
  To: JuenKit Yip; +Cc: jdelvare, linux-hwmon, linux-kernel

On Wed, Jun 21, 2023 at 11:59:37AM +0800, JuenKit Yip wrote:
> add "compatible" property for supporting device-tree
> 
> Signed-off-by: JuenKit Yip <JuenKit_Yip@hotmail.com>
> ---
>  drivers/hwmon/sht3x.c | 12 +++++++++++-
>  1 file changed, 11 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/hwmon/sht3x.c b/drivers/hwmon/sht3x.c
> index 31013b5b6..edcf6820c 100644
> --- a/drivers/hwmon/sht3x.c
> +++ b/drivers/hwmon/sht3x.c
> @@ -923,8 +923,18 @@ static const struct i2c_device_id sht3x_ids[] = {
>  
>  MODULE_DEVICE_TABLE(i2c, sht3x_ids);
>  
> +/* devicetree ID table */
> +static const struct of_device_id sht3x_of_match[] = {
> +	{ .compatible = "sensirion,sht3x" },
> +	{ .compatible = "sensirion,sts3x" },

Also needs a separate patch addding the two devices
to Documentation/devicetree/bindings/trivial-devices.yaml.

> +	{},
> +};
> +
>  static struct i2c_driver sht3x_i2c_driver = {
> -	.driver.name = "sht3x",
> +	.driver = {
> +		.name = "sht3x",
> +		.of_match_table = of_match_ptr(sht3x_of_match),
> +	},
>  	.probe       = sht3x_probe,
>  	.id_table    = sht3x_ids,
>  };
> -- 
> 2.30.2
> 

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

end of thread, other threads:[~2023-06-21 15:36 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <20230621035937.58721-1-JuenKit_Yip@hotmail.com>
2023-06-21  3:59 ` [RFC PATCH 2/2] hwmon: (sht3x) add device-tree support JuenKit Yip
2023-06-21 15:35   ` Guenter Roeck

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).