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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxxx>
---
 drivers/hwmon/tmp513.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

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);
 
-- 
2.25.1




[Index of Archives]     [Linux Samsung SOC]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]

  Powered by Linux