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

ACPI: replace snprintf() in "show" functions with sysfs_emit()

coccicheck complains about the use of snprintf() in sysfs "show"
functions:

Fix the coccicheck warning:
WARNING: use scnprintf or sprintf.

so use sysfs_emit() instead of it where applicable.

Signed-off-by: Qing Wang <wangqing@vivo.com>
[ rjw: Subject and changelog edits ]
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>

authored by

Qing Wang and committed by
Rafael J. Wysocki
d47e983e 5771e582

+5 -5
+1 -1
drivers/acpi/acpi_lpss.c
··· 750 750 if (ret) 751 751 return ret; 752 752 753 - return snprintf(buf, PAGE_SIZE, "%08x\n", ltr_value); 753 + return sysfs_emit(buf, "%08x\n", ltr_value); 754 754 } 755 755 756 756 static ssize_t lpss_ltr_mode_show(struct device *dev,
+4 -4
drivers/acpi/dock.c
··· 492 492 struct acpi_device *adev = NULL; 493 493 494 494 acpi_bus_get_device(dock_station->handle, &adev); 495 - return snprintf(buf, PAGE_SIZE, "%u\n", acpi_device_enumerated(adev)); 495 + return sysfs_emit(buf, "%u\n", acpi_device_enumerated(adev)); 496 496 } 497 497 static DEVICE_ATTR_RO(docked); 498 498 ··· 504 504 { 505 505 struct dock_station *dock_station = dev->platform_data; 506 506 507 - return snprintf(buf, PAGE_SIZE, "%d\n", dock_station->flags); 507 + return sysfs_emit(buf, "%d\n", dock_station->flags); 508 508 509 509 } 510 510 static DEVICE_ATTR_RO(flags); ··· 543 543 if (ACPI_FAILURE(status)) 544 544 return 0; 545 545 546 - return snprintf(buf, PAGE_SIZE, "%llx\n", lbuf); 546 + return sysfs_emit(buf, "%llx\n", lbuf); 547 547 } 548 548 static DEVICE_ATTR_RO(uid); 549 549 ··· 562 562 else 563 563 type = "unknown"; 564 564 565 - return snprintf(buf, PAGE_SIZE, "%s\n", type); 565 + return sysfs_emit(buf, "%s\n", type); 566 566 } 567 567 static DEVICE_ATTR_RO(type); 568 568