lkml.org 
[lkml]   [2022]   [May]   [2]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH v2] hwmon: (tmp401) Add of_match_table
Date
When tmp401 is built as kernel module, it won't be automatically loaded
even through there is a device node in the devicetree. e.g:
i2c {
#address-cells = <1>;
#size-cells = <0>;

sensor@4c {
compatible = "ti,tmp401";
reg = <0x4c>;
};
};
In order to make sure it is loaded automatically, this commit adds
of_match_table for tmp401.

Signed-off-by: Camel Guo <camel.guo@axis.com>
---

Notes:
v2:
- Put evidence and circumstances in commit message

drivers/hwmon/tmp401.c | 11 +++++++++++
1 file changed, 11 insertions(+)

diff --git a/drivers/hwmon/tmp401.c b/drivers/hwmon/tmp401.c
index b86d9df7105d..52c9e7d3f2ae 100644
--- a/drivers/hwmon/tmp401.c
+++ b/drivers/hwmon/tmp401.c
@@ -708,10 +708,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,
base-commit: 38d741cb70b30741c0e802cbed7bd9cf4fd15fa4
--
2.30.2

\
 
 \ /
  Last update: 2022-05-02 11:20    [W:0.058 / U:0.664 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site