Skip to content

Commit d47e983

Browse files
Qing Wangrafaeljw
authored andcommitted
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 <[email protected]> [ rjw: Subject and changelog edits ] Signed-off-by: Rafael J. Wysocki <[email protected]>
1 parent 5771e58 commit d47e983

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

drivers/acpi/acpi_lpss.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -750,7 +750,7 @@ static ssize_t lpss_ltr_show(struct device *dev, struct device_attribute *attr,
750750
if (ret)
751751
return ret;
752752

753-
return snprintf(buf, PAGE_SIZE, "%08x\n", ltr_value);
753+
return sysfs_emit(buf, "%08x\n", ltr_value);
754754
}
755755

756756
static ssize_t lpss_ltr_mode_show(struct device *dev,

drivers/acpi/dock.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -492,7 +492,7 @@ static ssize_t docked_show(struct device *dev,
492492
struct acpi_device *adev = NULL;
493493

494494
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));
496496
}
497497
static DEVICE_ATTR_RO(docked);
498498

@@ -504,7 +504,7 @@ static ssize_t flags_show(struct device *dev,
504504
{
505505
struct dock_station *dock_station = dev->platform_data;
506506

507-
return snprintf(buf, PAGE_SIZE, "%d\n", dock_station->flags);
507+
return sysfs_emit(buf, "%d\n", dock_station->flags);
508508

509509
}
510510
static DEVICE_ATTR_RO(flags);
@@ -543,7 +543,7 @@ static ssize_t uid_show(struct device *dev,
543543
if (ACPI_FAILURE(status))
544544
return 0;
545545

546-
return snprintf(buf, PAGE_SIZE, "%llx\n", lbuf);
546+
return sysfs_emit(buf, "%llx\n", lbuf);
547547
}
548548
static DEVICE_ATTR_RO(uid);
549549

@@ -562,7 +562,7 @@ static ssize_t type_show(struct device *dev,
562562
else
563563
type = "unknown";
564564

565-
return snprintf(buf, PAGE_SIZE, "%s\n", type);
565+
return sysfs_emit(buf, "%s\n", type);
566566
}
567567
static DEVICE_ATTR_RO(type);
568568

0 commit comments

Comments
 (0)