diff mbox series

[2/2] hwmon: tmp513: Add temp_config to struct tmp51x_info

Message ID 20230820124910.71526-3-biju.das.jz@bp.renesas.com (mailing list archive)
State Changes Requested
Headers show
Series Convert enum->pointer for data in the tmp51x match tables | expand

Commit Message

Biju Das Aug. 20, 2023, 12:49 p.m. UTC
Move temp_config from struct tmp51x_data to struct tmp51x_info and
remove unnecessary check in tmp51x_configure().

Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
---
 drivers/hwmon/tmp513.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
diff mbox series

Patch

diff --git a/drivers/hwmon/tmp513.c b/drivers/hwmon/tmp513.c
index 22f6000bc50a..138e02a99304 100644
--- a/drivers/hwmon/tmp513.c
+++ b/drivers/hwmon/tmp513.c
@@ -158,6 +158,7 @@  enum tmp51x_ids {
 
 struct tmp51x_info {
 	enum tmp51x_ids id;
+	u16 temp_config;
 };
 
 struct tmp51x_data {
@@ -165,7 +166,6 @@  struct tmp51x_data {
 	u16 pga_gain;
 	u32 vbus_range_uvolt;
 
-	u16 temp_config;
 	u32 nfactor[3];
 
 	u32 shunt_uohms;
@@ -574,7 +574,8 @@  static int tmp51x_init(struct tmp51x_data *data)
 	if (ret < 0)
 		return ret;
 
-	ret = regmap_write(data->regmap, TMP51X_TEMP_CONFIG, data->temp_config);
+	ret = regmap_write(data->regmap, TMP51X_TEMP_CONFIG,
+			   data->info->temp_config);
 	if (ret < 0)
 		return ret;
 
@@ -606,10 +607,12 @@  static int tmp51x_init(struct tmp51x_data *data)
 
 static const struct tmp51x_info tmp512_info = {
 	.id = tmp512,
+	.temp_config = TMP512_TEMP_CONFIG_DEFAULT,
 };
 
 static const struct tmp51x_info tmp513_info = {
 	.id = tmp513,
+	.temp_config = TMP513_TEMP_CONFIG_DEFAULT,
 };
 
 static const struct i2c_device_id tmp51x_id[] = {
@@ -704,9 +707,6 @@  static void tmp51x_use_default(struct tmp51x_data *data)
 static int tmp51x_configure(struct device *dev, struct tmp51x_data *data)
 {
 	data->shunt_config = TMP51X_SHUNT_CONFIG_DEFAULT;
-	data->temp_config = (data->info->id == tmp513) ?
-			TMP513_TEMP_CONFIG_DEFAULT : TMP512_TEMP_CONFIG_DEFAULT;
-
 	if (dev->of_node)
 		return tmp51x_read_properties(dev, data);