Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Input: synaptics-rmi4 - use sysfs_emit() to instead of scnprintf()

Replace calls to scnprintf() in the methods showing device attributes
with sysfs_emit() to simplify the code.

Signed-off-by: ye xingchen <ye.xingchen@zte.com.cn>
Link: https://lore.kernel.org/r/202212011551429834598@zte.com.cn
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>

authored by

ye xingchen and committed by
Dmitry Torokhov
8fbdb8fb e50389f2

+6 -7
+6 -7
drivers/input/rmi4/rmi_f01.c
··· 267 267 struct rmi_driver_data *data = dev_get_drvdata(dev); 268 268 struct f01_data *f01 = dev_get_drvdata(&data->f01_container->dev); 269 269 270 - return scnprintf(buf, PAGE_SIZE, "%d\n", 271 - f01->properties.manufacturer_id); 270 + return sysfs_emit(buf, "%d\n", f01->properties.manufacturer_id); 272 271 } 273 272 274 273 static DEVICE_ATTR(manufacturer_id, 0444, ··· 279 280 struct rmi_driver_data *data = dev_get_drvdata(dev); 280 281 struct f01_data *f01 = dev_get_drvdata(&data->f01_container->dev); 281 282 282 - return scnprintf(buf, PAGE_SIZE, "%s\n", f01->properties.dom); 283 + return sysfs_emit(buf, "%s\n", f01->properties.dom); 283 284 } 284 285 285 286 static DEVICE_ATTR(date_of_manufacture, 0444, rmi_driver_dom_show, NULL); ··· 291 292 struct rmi_driver_data *data = dev_get_drvdata(dev); 292 293 struct f01_data *f01 = dev_get_drvdata(&data->f01_container->dev); 293 294 294 - return scnprintf(buf, PAGE_SIZE, "%s\n", f01->properties.product_id); 295 + return sysfs_emit(buf, "%s\n", f01->properties.product_id); 295 296 } 296 297 297 298 static DEVICE_ATTR(product_id, 0444, rmi_driver_product_id_show, NULL); ··· 303 304 struct rmi_driver_data *data = dev_get_drvdata(dev); 304 305 struct f01_data *f01 = dev_get_drvdata(&data->f01_container->dev); 305 306 306 - return scnprintf(buf, PAGE_SIZE, "%d\n", f01->properties.firmware_id); 307 + return sysfs_emit(buf, "%d\n", f01->properties.firmware_id); 307 308 } 308 309 309 310 static DEVICE_ATTR(firmware_id, 0444, rmi_driver_firmware_id_show, NULL); ··· 317 318 318 319 u32 package_id = f01->properties.package_id; 319 320 320 - return scnprintf(buf, PAGE_SIZE, "%04x.%04x\n", 321 - package_id & 0xffff, (package_id >> 16) & 0xffff); 321 + return sysfs_emit(buf, "%04x.%04x\n", 322 + package_id & 0xffff, (package_id >> 16) & 0xffff); 322 323 } 323 324 324 325 static DEVICE_ATTR(package_id, 0444, rmi_driver_package_id_show, NULL);