[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20230906180837.284743-3-biju.das.jz@bp.renesas.com>
Date: Wed, 6 Sep 2023 19:08:37 +0100
From: Biju Das <biju.das.jz@...renesas.com>
To: Eric Tremblay <etremblay@...tech-controls.com>,
Jean Delvare <jdelvare@...e.com>,
Guenter Roeck <linux@...ck-us.net>
Cc: Biju Das <biju.das.jz@...renesas.com>, linux-hwmon@...r.kernel.org,
linux-kernel@...r.kernel.org, Biju Das <biju.das.au@...il.com>,
Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
Geert Uytterhoeven <geert+renesas@...der.be>
Subject: [PATCH v5 2/2] hwmon: tmp513: Simplify tmp51x_read_properties()
Simplify tmp51x_read_properties() by replacing 'nfactor' ->'data->nfactor'
in device_property_read_u32_array() and drop the local variable as it is
unused.
Signed-off-by: Biju Das <biju.das.jz@...renesas.com>
Reviewed-by: Geert Uytterhoeven <geert+renesas@...der.be>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
---
v4->v5:
* No change.
v3->v4:
* Added Rb tag from Geert and Andy.
v3:
* New patch.
---
drivers/hwmon/tmp513.c | 7 ++-----
1 file changed, 2 insertions(+), 5 deletions(-)
diff --git a/drivers/hwmon/tmp513.c b/drivers/hwmon/tmp513.c
index 290390c842e6..f32a2310380b 100644
--- a/drivers/hwmon/tmp513.c
+++ b/drivers/hwmon/tmp513.c
@@ -654,7 +654,6 @@ static int tmp51x_pga_gain_to_reg(struct device *dev, struct tmp51x_data *data)
static int tmp51x_read_properties(struct device *dev, struct tmp51x_data *data)
{
int ret;
- u32 nfactor[3];
u32 val;
ret = device_property_read_u32(dev, "shunt-resistor-micro-ohms", &val);
@@ -672,10 +671,8 @@ static int tmp51x_read_properties(struct device *dev, struct tmp51x_data *data)
if (ret < 0)
return ret;
- ret = device_property_read_u32_array(dev, "ti,nfactor", nfactor,
- data->max_channels - 1);
- if (ret >= 0)
- memcpy(data->nfactor, nfactor, data->max_channels - 1);
+ device_property_read_u32_array(dev, "ti,nfactor", data->nfactor,
+ data->max_channels - 1);
// Check if shunt value is compatible with pga-gain
if (data->shunt_uohms > data->pga_gain * 40 * 1000 * 1000) {
--
2.25.1
Powered by blists - more mailing lists