summaryrefslogtreecommitdiffstats
path: root/drivers/hwmon
diff options
context:
space:
mode:
authorBiju Das <biju.das.jz@bp.renesas.com>2023-09-07 09:14:04 +0200
committerGuenter Roeck <linux@roeck-us.net>2023-10-27 16:27:23 +0200
commit27887b06597bbfef8924985d1ed21db3ab01c417 (patch)
tree949584f71973d90260e9b5f560063fd0f9c00315 /drivers/hwmon
parenthwmon: tmp513: Add max_channels variable to struct tmp51x_data (diff)
downloadlinux-27887b06597bbfef8924985d1ed21db3ab01c417.tar.xz
linux-27887b06597bbfef8924985d1ed21db3ab01c417.zip
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@bp.renesas.com> Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be> Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Link: https://lore.kernel.org/r/20230907071404.24334-3-biju.das.jz@bp.renesas.com Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Diffstat (limited to 'drivers/hwmon')
-rw-r--r--drivers/hwmon/tmp513.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/drivers/hwmon/tmp513.c b/drivers/hwmon/tmp513.c
index b336b95298ab..8a7cf08733c6 100644
--- a/drivers/hwmon/tmp513.c
+++ b/drivers/hwmon/tmp513.c
@@ -653,7 +653,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);
@@ -671,10 +670,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) {