All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 01/11] PCI: Use sysfs_emit() and sysfs_emit_at() in "show" functions
@ 2021-05-10  4:14 ` Krzysztof Wilczyński
  0 siblings, 0 replies; 28+ messages in thread
From: Krzysztof Wilczyński @ 2021-05-10  4:14 UTC (permalink / raw)
  To: Bjorn Helgaas
  Cc: Oliver O'Halloran, Michael Ellerman, Benjamin Herrenschmidt,
	Paul Mackerras, Tyrel Datwyler, Russell Currey, Kurt Schwemmer,
	Logan Gunthorpe, linux-pci, linuxppc-dev

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/pci.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index b717680377a9..5ed316ea5831 100644
--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -6439,7 +6439,7 @@ static ssize_t resource_alignment_show(struct bus_type *bus, char *buf)
 
 	spin_lock(&resource_alignment_lock);
 	if (resource_alignment_param)
-		count = scnprintf(buf, PAGE_SIZE, "%s", resource_alignment_param);
+		count = sysfs_emit(buf, "%s", resource_alignment_param);
 	spin_unlock(&resource_alignment_lock);
 
 	/*
-- 
2.31.1


^ permalink raw reply related	[flat|nested] 28+ messages in thread

end of thread, other threads:[~2021-05-13 12:50 UTC | newest]

Thread overview: 28+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-10  4:14 [PATCH 01/11] PCI: Use sysfs_emit() and sysfs_emit_at() in "show" functions Krzysztof Wilczyński
2021-05-10  4:14 ` Krzysztof Wilczyński
2021-05-10  4:14 ` [PATCH 02/11] PCI/AER: " Krzysztof Wilczyński
2021-05-10  4:14   ` Krzysztof Wilczyński
2021-05-10  4:14 ` [PATCH 03/11] PCI: " Krzysztof Wilczyński
2021-05-10  4:14   ` Krzysztof Wilczyński
2021-05-10  4:14 ` [PATCH 04/11] PCI/MSI: " Krzysztof Wilczyński
2021-05-10  4:14   ` Krzysztof Wilczyński
2021-05-10  4:14 ` [PATCH 05/11] PCI/IOV: " Krzysztof Wilczyński
2021-05-10  4:14   ` Krzysztof Wilczyński
2021-05-10  4:14 ` [PATCH 06/11] PCI/P2PDMA: " Krzysztof Wilczyński
2021-05-10  4:14   ` Krzysztof Wilczyński
2021-05-10  4:14 ` [PATCH 07/11] PCI/ASPM: " Krzysztof Wilczyński
2021-05-10  4:14   ` Krzysztof Wilczyński
2021-05-10  4:14 ` [PATCH 08/11] PCI: switchtec: " Krzysztof Wilczyński
2021-05-10  4:14   ` Krzysztof Wilczyński
2021-05-10  4:14 ` [PATCH 09/11] PCI: rpadlpar: " Krzysztof Wilczyński
2021-05-10  4:14   ` Krzysztof Wilczyński
2021-05-10  4:14 ` [PATCH 10/11] PCI: hotplug: " Krzysztof Wilczyński
2021-05-10  4:14   ` Krzysztof Wilczyński
2021-05-10  4:14 ` [PATCH 11/11] PCI: shpchp: " Krzysztof Wilczyński
2021-05-10  4:14   ` Krzysztof Wilczyński
2021-05-10 10:30 ` [PATCH 01/11] PCI: " Krzysztof Wilczyński
2021-05-10 10:30   ` Krzysztof Wilczyński
2021-05-10 15:57 ` Logan Gunthorpe
2021-05-10 15:57   ` Logan Gunthorpe
2021-05-13 12:49   ` Krzysztof Wilczyński
2021-05-13 12:49     ` Krzysztof Wilczyński

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.