diff options
author | Barnabás Pőcze <pobrn@protonmail.com> | 2021-02-04 00:54:56 +0300 |
---|---|---|
committer | Hans de Goede <hdegoede@redhat.com> | 2021-02-04 12:20:34 +0300 |
commit | d6b508896afedc0c4197cd5a6c4b9a24e64d05c9 (patch) | |
tree | ae83a79272cbb9eb8c2471c7dbae9547acf98d07 /drivers/platform | |
parent | caa315b8de372890aedfa612b91e649168a31187 (diff) | |
download | linux-d6b508896afedc0c4197cd5a6c4b9a24e64d05c9.tar.xz |
platform/x86: ideapad-laptop: use sysfs_emit()
sysfs_emit() has been introduced to make it less ambiguous
which function is preferred when writing to the output
buffer in a device attribute's show() callback. Convert the
ideapad-laptop module to utilize this new helper function.
Signed-off-by: Barnabás Pőcze <pobrn@protonmail.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Link: https://lore.kernel.org/r/20210203215403.290792-7-pobrn@protonmail.com
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Diffstat (limited to 'drivers/platform')
-rw-r--r-- | drivers/platform/x86/ideapad-laptop.c | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/drivers/platform/x86/ideapad-laptop.c b/drivers/platform/x86/ideapad-laptop.c index 7ee5ac662f80..1a91588399f5 100644 --- a/drivers/platform/x86/ideapad-laptop.c +++ b/drivers/platform/x86/ideapad-laptop.c @@ -24,6 +24,7 @@ #include <linux/platform_profile.h> #include <linux/rfkill.h> #include <linux/seq_file.h> +#include <linux/sysfs.h> #include <linux/types.h> #include <acpi/video.h> @@ -371,8 +372,8 @@ static ssize_t show_ideapad_cam(struct device *dev, struct ideapad_private *priv = dev_get_drvdata(dev); if (read_ec_data(priv->adev->handle, VPCCMD_R_CAMERA, &result)) - return sprintf(buf, "-1\n"); - return sprintf(buf, "%lu\n", result); + return sysfs_emit(buf, "-1\n"); + return sysfs_emit(buf, "%lu\n", result); } static ssize_t store_ideapad_cam(struct device *dev, @@ -402,8 +403,8 @@ static ssize_t show_ideapad_fan(struct device *dev, struct ideapad_private *priv = dev_get_drvdata(dev); if (read_ec_data(priv->adev->handle, VPCCMD_R_FAN, &result)) - return sprintf(buf, "-1\n"); - return sprintf(buf, "%lu\n", result); + return sysfs_emit(buf, "-1\n"); + return sysfs_emit(buf, "%lu\n", result); } static ssize_t store_ideapad_fan(struct device *dev, @@ -435,8 +436,8 @@ static ssize_t touchpad_show(struct device *dev, unsigned long result; if (read_ec_data(priv->adev->handle, VPCCMD_R_TOUCHPAD, &result)) - return sprintf(buf, "-1\n"); - return sprintf(buf, "%lu\n", result); + return sysfs_emit(buf, "-1\n"); + return sysfs_emit(buf, "%lu\n", result); } /* Switch to RO for now: It might be revisited in the future */ @@ -468,8 +469,8 @@ static ssize_t conservation_mode_show(struct device *dev, unsigned long result; if (method_gbmd(priv->adev->handle, &result)) - return sprintf(buf, "-1\n"); - return sprintf(buf, "%u\n", test_bit(BM_CONSERVATION_BIT, &result)); + return sysfs_emit(buf, "-1\n"); + return sysfs_emit(buf, "%u\n", test_bit(BM_CONSERVATION_BIT, &result)); } static ssize_t conservation_mode_store(struct device *dev, @@ -504,10 +505,10 @@ static ssize_t fn_lock_show(struct device *dev, int fail = read_method_int(priv->adev->handle, "HALS", &hals); if (fail) - return sprintf(buf, "-1\n"); + return sysfs_emit(buf, "-1\n"); result = hals; - return sprintf(buf, "%u\n", test_bit(HA_FNLOCK_BIT, &result)); + return sysfs_emit(buf, "%u\n", test_bit(HA_FNLOCK_BIT, &result)); } static ssize_t fn_lock_store(struct device *dev, |