[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <d7d764a70d154030fc5e00d6238c8a65b489e456.camel@perches.com>
Date: Tue, 08 Feb 2022 18:03:58 -0800
From: Joe Perches <joe@...ches.com>
To: davidcomponentone@...il.com, jikos@...nel.org
Cc: benjamin.tissoires@...hat.com, linux-input@...r.kernel.org,
linux-kernel@...r.kernel.org, Yang Guang <yang.guang5@....com.cn>,
Zeal Robot <zealci@....com.cn>
Subject: Re: [PATCH] HID: lenovo: replace snprintf with sysfs_emit
On Wed, 2022-02-09 at 08:39 +0800, davidcomponentone@...il.com wrote:
> From: Yang Guang <yang.guang5@....com.cn>
[]
> Use sysfs_emit instead of scnprintf or sprintf makes more sense.
[]
> diff --git a/drivers/hid/hid-lenovo.c b/drivers/hid/hid-lenovo.c
[]
> @@ -442,7 +442,7 @@ static ssize_t attr_sensitivity_show_cptkbd(struct device *dev,
> struct hid_device *hdev = to_hid_device(dev);
> struct lenovo_drvdata *cptkbd_data = hid_get_drvdata(hdev);
>
> - return snprintf(buf, PAGE_SIZE, "%u\n",
> + return sysfs_emit(buf, "%u\n",
> cptkbd_data->sensitivity);
Please rewrap lines to 80 columns where reasonable.
return sysfs_emit(buf, "%u\n", cptkbd_data->sensitivity);
[]
> @@ -723,7 +723,7 @@ static ssize_t attr_sensitivity_show_tpkbd(struct device *dev,
> struct hid_device *hdev = to_hid_device(dev);
> struct lenovo_drvdata *data_pointer = hid_get_drvdata(hdev);
>
> - return snprintf(buf, PAGE_SIZE, "%u\n",
> + return sysfs_emit(buf, "%u\n",
> data_pointer->sensitivity);
> }
>
> @@ -752,7 +752,7 @@ static ssize_t attr_press_speed_show_tpkbd(struct device *dev,
> struct hid_device *hdev = to_hid_device(dev);
> struct lenovo_drvdata *data_pointer = hid_get_drvdata(hdev);
>
> - return snprintf(buf, PAGE_SIZE, "%u\n",
> + return sysfs_emit(buf, "%u\n",
> data_pointer->press_speed);
etc...
Powered by blists - more mailing lists