diff mbox series

[04/11] PCI/MSI: Use sysfs_emit() and sysfs_emit_at() in "show" functions

Message ID 20210510041424.233565-4-kw@linux.com
State Not Applicable
Headers show
Series [01/11] PCI: Use sysfs_emit() and sysfs_emit_at() in "show" functions | expand


Context Check Description
snowpatch_ozlabs/apply_patch success Successfully applied on branch powerpc/merge (fcc98c6d0289241dded10b74f8198fc4ecb22bd1)
snowpatch_ozlabs/checkpatch warning total: 1 errors, 1 warnings, 0 checks, 10 lines checked
snowpatch_ozlabs/needsstable success Patch has no Fixes tags

Commit Message

Krzysztof Wilczyński May 10, 2021, 4:14 a.m. UTC
The sysfs_emit() and sysfs_emit_at() functions were introduced to make
it less ambiguous which function is preferred when writing to the output
buffer in a device attribute's "show" callback [1].

Convert the PCI sysfs object "show" functions from sprintf(), snprintf()
and scnprintf() to sysfs_emit() and sysfs_emit_at() accordingly, as the
latter is aware of the PAGE_SIZE buffer and correctly returns the number
of bytes written into the buffer.

No functional change intended.

[1] Documentation/filesystems/sysfs.rst

Related to:
  commit ad025f8e46f3 ("PCI/sysfs: Use sysfs_emit() and sysfs_emit_at() in "show" functions")

Signed-off-by: Krzysztof Wilczyński <kw@linux.com>
 drivers/pci/msi.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
diff mbox series


diff --git a/drivers/pci/msi.c b/drivers/pci/msi.c
index 217dc9f0231f..dbfec59dfe41 100644
--- a/drivers/pci/msi.c
+++ b/drivers/pci/msi.c
@@ -465,8 +465,8 @@  static ssize_t msi_mode_show(struct device *dev, struct device_attribute *attr,
 	entry = irq_get_msi_desc(irq);
 	if (entry)
-		return sprintf(buf, "%s\n",
-				entry->msi_attrib.is_msix ? "msix" : "msi");
+		return sysfs_emit(buf, "%s\n",
+				  entry->msi_attrib.is_msix ? "msix" : "msi");
 	return -ENODEV;