Messages in this thread | | | Subject | Re: [PATCH] HID: lenovo: replace snprintf with sysfs_emit | From | Joe Perches <> | Date | Tue, 08 Feb 2022 18:03:58 -0800 |
| |
On Wed, 2022-02-09 at 08:39 +0800, davidcomponentone@gmail.com wrote: > From: Yang Guang <yang.guang5@zte.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...
| |