summaryrefslogtreecommitdiff
path: root/drivers/hwmon
diff options
context:
space:
mode:
authorZihao Tang <tangzihao1@hisilicon.com>2021-03-16 19:00:57 +0800
committerGuenter Roeck <linux@roeck-us.net>2021-04-20 06:50:14 -0700
commitaf9a973040bd5c27dfa1c7b5e970b7cf9238b530 (patch)
tree3f1e2423c93740c42bac3a41970d921a053c1180 /drivers/hwmon
parent9d2227bb9bd4ae799e77c0575452e7e5716658ea (diff)
hwmon: (ina2xx) Convert sysfs sprintf/snprintf family to sysfs_emit
Fix the following coccicheck warning: drivers/hwmon/ina2xx.c:313:8-16: WARNING: use scnprintf or sprintf drivers/hwmon/ina2xx.c:453:8-16: WARNING: use scnprintf or sprintf drivers/hwmon/ina2xx.c:484:8-16: WARNING: use scnprintf or sprintf drivers/hwmon/ina2xx.c:540:8-16: WARNING: use scnprintf or sprintf Signed-off-by: Zihao Tang <tangzihao1@hisilicon.com> Signed-off-by: Jay Fang <f.fangjian@huawei.com> Link: https://lore.kernel.org/r/1615892457-35501-1-git-send-email-f.fangjian@huawei.com Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Diffstat (limited to 'drivers/hwmon')
-rw-r--r--drivers/hwmon/ina2xx.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/drivers/hwmon/ina2xx.c b/drivers/hwmon/ina2xx.c
index ca97f9e931bc..8acb2db58c68 100644
--- a/drivers/hwmon/ina2xx.c
+++ b/drivers/hwmon/ina2xx.c
@@ -310,8 +310,7 @@ static ssize_t ina2xx_value_show(struct device *dev,
if (err < 0)
return err;
- return snprintf(buf, PAGE_SIZE, "%d\n",
- ina2xx_get_value(data, attr->index, regval));
+ return sysfs_emit(buf, "%d\n", ina2xx_get_value(data, attr->index, regval));
}
static int ina226_reg_to_alert(struct ina2xx_data *data, u8 bit, u16 regval)
@@ -450,7 +449,7 @@ static ssize_t ina226_alarm_show(struct device *dev,
alarm = (regval & BIT(attr->index)) &&
(regval & INA226_ALERT_FUNCTION_FLAG);
- return snprintf(buf, PAGE_SIZE, "%d\n", alarm);
+ return sysfs_emit(buf, "%d\n", alarm);
}
/*
@@ -481,7 +480,7 @@ static ssize_t ina2xx_shunt_show(struct device *dev,
{
struct ina2xx_data *data = dev_get_drvdata(dev);
- return snprintf(buf, PAGE_SIZE, "%li\n", data->rshunt);
+ return sysfs_emit(buf, "%li\n", data->rshunt);
}
static ssize_t ina2xx_shunt_store(struct device *dev,
@@ -537,7 +536,7 @@ static ssize_t ina226_interval_show(struct device *dev,
if (status)
return status;
- return snprintf(buf, PAGE_SIZE, "%d\n", ina226_reg_to_interval(regval));
+ return sysfs_emit(buf, "%d\n", ina226_reg_to_interval(regval));
}
/* shunt voltage */