linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 01/14] PCI: Use sysfs_emit() and sysfs_emit_at() in "show" functions
@ 2021-05-15  5:24 Krzysztof Wilczyński
  2021-05-15  5:24 ` [PATCH v2 02/14] PCI/AER: " Krzysztof Wilczyński
                   ` (15 more replies)
  0 siblings, 16 replies; 21+ messages in thread
From: Krzysztof Wilczyński @ 2021-05-15  5:24 UTC (permalink / raw)
  To: Bjorn Helgaas
  Cc: Logan Gunthorpe, Joe Perches, Oliver O'Halloran,
	Michael Ellerman, Benjamin Herrenschmidt, Paul Mackerras,
	Tyrel Datwyler, Russell Currey, Kurt Schwemmer, Vidya Sagar,
	Xiongfeng Wang, 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>
Reviewed-by: Logan Gunthorpe <logang@deltatee.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] 21+ messages in thread

end of thread, other threads:[~2021-05-17 17:44 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-15  5:24 [PATCH v2 01/14] PCI: Use sysfs_emit() and sysfs_emit_at() in "show" functions Krzysztof Wilczyński
2021-05-15  5:24 ` [PATCH v2 02/14] PCI/AER: " Krzysztof Wilczyński
2021-05-15  5:24 ` [PATCH v2 03/14] PCI: " Krzysztof Wilczyński
2021-05-15  5:24 ` [PATCH v2 04/14] PCI/MSI: " Krzysztof Wilczyński
2021-05-15  5:46   ` Joe Perches
2021-05-15  6:01     ` Krzysztof Wilczyński
2021-05-15  5:24 ` [PATCH v2 05/14] PCI/IOV: " Krzysztof Wilczyński
2021-05-15  5:24 ` [PATCH v2 06/14] PCI/P2PDMA: " Krzysztof Wilczyński
2021-05-15  5:24 ` [PATCH v2 07/14] PCI/ASPM: " Krzysztof Wilczyński
2021-05-15  5:24 ` [PATCH v2 08/14] PCI: switchtec: " Krzysztof Wilczyński
2021-05-15  5:24 ` [PATCH v2 09/14] PCI: rpadlpar: " Krzysztof Wilczyński
2021-05-15  5:24 ` [PATCH v2 10/14] PCI: hotplug: " Krzysztof Wilczyński
2021-05-15  5:24 ` [PATCH v2 11/14] PCI: shpchp: " Krzysztof Wilczyński
2021-05-15  5:24 ` [PATCH v2 12/14] PCI: Fix trailing newline handling of resource_alignment_param Krzysztof Wilczyński
2021-05-15  5:24 ` [PATCH v2 13/14] PCI/sysfs: Add missing trailing newline to devspec_show() Krzysztof Wilczyński
2021-05-15  5:24 ` [PATCH v2 14/14] PCI/sysfs: Only show value when driver_override is not NULL Krzysztof Wilczyński
2021-05-15  5:36 ` [PATCH v2 01/14] PCI: Use sysfs_emit() and sysfs_emit_at() in "show" functions Krzysztof Wilczyński
2021-05-15  5:43 ` Joe Perches
2021-05-15  5:59   ` Krzysztof Wilczyński
2021-05-17 15:48 ` Logan Gunthorpe
2021-05-17 17:44   ` Krzysztof Wilczyński

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).