[v2,2/4] hwmon: ltc2945: Add devicetree match table

Message ID 20221220000457.1163446-3-jcormier@criticallink.com
State New
Headers
Series hwmon: ltc2945: Add binding and shunt resistor support |

Commit Message

Jonathan Cormier Dec. 20, 2022, 12:04 a.m. UTC
  Signed-off-by: "Cormier, Jonathan" <jcormier@criticallink.com>
---
 drivers/hwmon/ltc2945.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

--
2.25.1
  

Comments

Guenter Roeck Dec. 28, 2022, 4:43 p.m. UTC | #1
On Mon, Dec 19, 2022 at 07:04:55PM -0500, Cormier, Jonathan wrote:
> Signed-off-by: "Cormier, Jonathan" <jcormier@criticallink.com>

There should still be some description here.

> ---
>  drivers/hwmon/ltc2945.c | 11 +++++++++--
>  1 file changed, 9 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/hwmon/ltc2945.c b/drivers/hwmon/ltc2945.c
> index 9adebb59f604..9af3e3821152 100644
> --- a/drivers/hwmon/ltc2945.c
> +++ b/drivers/hwmon/ltc2945.c
> @@ -58,6 +58,12 @@
>  #define CONTROL_MULT_SELECT	(1 << 0)
>  #define CONTROL_TEST_MODE	(1 << 4)
> 
> +static const struct of_device_id __maybe_unused ltc2945_of_match[] = {
> +	{ .compatible = "adi,ltc2945" },
> +	{ }
> +};
> +MODULE_DEVICE_TABLE(of, ltc2945_of_match);
> +
>  static inline bool is_power_reg(u8 reg)
>  {
>  	return reg < LTC2945_SENSE_H;
> @@ -475,8 +481,9 @@ MODULE_DEVICE_TABLE(i2c, ltc2945_id);
> 
>  static struct i2c_driver ltc2945_driver = {
>  	.driver = {
> -		   .name = "ltc2945",
> -		   },
> +		.name = "ltc2945",
> +		.of_match_table = of_match_ptr(ltc2945_of_match),
> +	},
>  	.probe_new = ltc2945_probe,
>  	.id_table = ltc2945_id,
>  };
> --
> 2.25.1
  

Patch

diff --git a/drivers/hwmon/ltc2945.c b/drivers/hwmon/ltc2945.c
index 9adebb59f604..9af3e3821152 100644
--- a/drivers/hwmon/ltc2945.c
+++ b/drivers/hwmon/ltc2945.c
@@ -58,6 +58,12 @@ 
 #define CONTROL_MULT_SELECT	(1 << 0)
 #define CONTROL_TEST_MODE	(1 << 4)

+static const struct of_device_id __maybe_unused ltc2945_of_match[] = {
+	{ .compatible = "adi,ltc2945" },
+	{ }
+};
+MODULE_DEVICE_TABLE(of, ltc2945_of_match);
+
 static inline bool is_power_reg(u8 reg)
 {
 	return reg < LTC2945_SENSE_H;
@@ -475,8 +481,9 @@  MODULE_DEVICE_TABLE(i2c, ltc2945_id);

 static struct i2c_driver ltc2945_driver = {
 	.driver = {
-		   .name = "ltc2945",
-		   },
+		.name = "ltc2945",
+		.of_match_table = of_match_ptr(ltc2945_of_match),
+	},
 	.probe_new = ltc2945_probe,
 	.id_table = ltc2945_id,
 };