summaryrefslogtreecommitdiffstats
path: root/drivers/hwmon/lm73.c
diff options
context:
space:
mode:
authorye xingchen <ye.xingchen@zte.com.cn>2022-12-01 04:30:31 +0100
committerGuenter Roeck <linux@roeck-us.net>2022-12-05 01:49:43 +0100
commit4e6104b1e70020ad500f0fab7238898dd2ea2a38 (patch)
tree00d9afe0a01e43f3794ac603c63ae46faa95348b /drivers/hwmon/lm73.c
parenthwmon: (oxp-sensors) Fix pwm reading (diff)
downloadlinux-4e6104b1e70020ad500f0fab7238898dd2ea2a38.tar.xz
linux-4e6104b1e70020ad500f0fab7238898dd2ea2a38.zip
hwmon: use sysfs_emit() to instead of scnprintf()
Replace the open-code with sysfs_emit() to simplify the code. Signed-off-by: ye xingchen <ye.xingchen@zte.com.cn> Link: https://lore.kernel.org/r/202212011130317080061@zte.com.cn Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Diffstat (limited to 'drivers/hwmon/lm73.c')
-rw-r--r--drivers/hwmon/lm73.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/hwmon/lm73.c b/drivers/hwmon/lm73.c
index 1346b3b3f463..b6433ae2d75c 100644
--- a/drivers/hwmon/lm73.c
+++ b/drivers/hwmon/lm73.c
@@ -92,7 +92,7 @@ static ssize_t temp_show(struct device *dev, struct device_attribute *da,
/* use integer division instead of equivalent right shift to
guarantee arithmetic shift and preserve the sign */
temp = (((s16) err) * 250) / 32;
- return scnprintf(buf, PAGE_SIZE, "%d\n", temp);
+ return sysfs_emit(buf, "%d\n", temp);
}
static ssize_t convrate_store(struct device *dev, struct device_attribute *da,
@@ -137,7 +137,7 @@ static ssize_t convrate_show(struct device *dev, struct device_attribute *da,
int res;
res = (data->ctrl & LM73_CTRL_RES_MASK) >> LM73_CTRL_RES_SHIFT;
- return scnprintf(buf, PAGE_SIZE, "%hu\n", lm73_convrates[res]);
+ return sysfs_emit(buf, "%hu\n", lm73_convrates[res]);
}
static ssize_t maxmin_alarm_show(struct device *dev,
@@ -154,7 +154,7 @@ static ssize_t maxmin_alarm_show(struct device *dev,
data->ctrl = ctrl;
mutex_unlock(&data->lock);
- return scnprintf(buf, PAGE_SIZE, "%d\n", (ctrl >> attr->index) & 1);
+ return sysfs_emit(buf, "%d\n", (ctrl >> attr->index) & 1);
abort:
mutex_unlock(&data->lock);