All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3 01/14] PCI: Use sysfs_emit() and sysfs_emit_at() in "show" functions
@ 2021-05-18  3:40 Krzysztof Wilczyński
  2021-05-18  3:40 ` [PATCH v3 02/14] PCI/AER: " Krzysztof Wilczyński
                   ` (12 more replies)
  0 siblings, 13 replies; 22+ messages in thread
From: Krzysztof Wilczyński @ 2021-05-18  3:40 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

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>
---
Changes in v2:
  None.
Changes in v3:
  Added Logan Gunthorpe's "Reviewed-by".

 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] 22+ messages in thread

end of thread, other threads:[~2021-05-25 16:07 UTC | newest]

Thread overview: 22+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-18  3:40 [PATCH v3 01/14] PCI: Use sysfs_emit() and sysfs_emit_at() in "show" functions Krzysztof Wilczyński
2021-05-18  3:40 ` [PATCH v3 02/14] PCI/AER: " Krzysztof Wilczyński
2021-05-18  3:40 ` [PATCH v3 03/14] PCI: " Krzysztof Wilczyński
2021-05-24 21:14   ` Bjorn Helgaas
2021-05-24 21:19     ` Bjorn Helgaas
2021-05-25 10:32       ` Krzysztof Wilczyński
2021-05-25 16:07         ` Logan Gunthorpe
2021-05-18  3:40 ` [PATCH v3 04/14] PCI/MSI: " Krzysztof Wilczyński
2021-05-18  3:41 ` [PATCH v3 05/14] PCI/IOV: " Krzysztof Wilczyński
2021-05-18  3:41 ` [PATCH v3 06/14] PCI/P2PDMA: " Krzysztof Wilczyński
2021-05-18  3:41 ` [PATCH v3 07/14] PCI/ASPM: " Krzysztof Wilczyński
2021-05-18  3:41 ` [PATCH v3 08/14] PCI: switchtec: " Krzysztof Wilczyński
2021-05-18  3:41 ` [PATCH v3 09/14] PCI: rpadlpar: " Krzysztof Wilczyński
2021-05-18  3:41 ` [PATCH v3 10/14] PCI: hotplug: " Krzysztof Wilczyński
2021-05-18  3:41 ` [PATCH v3 11/14] PCI: shpchp: " Krzysztof Wilczyński
2021-05-18  3:41 ` [PATCH v3 12/14] PCI: Fix trailing newline handling of resource_alignment_param Krzysztof Wilczyński
2021-05-21 15:14   ` Krzysztof Wilczyński
2021-05-21 15:34     ` Logan Gunthorpe
2021-05-21 17:19     ` Greg Kroah-Hartman
2021-05-25 10:29       ` Krzysztof Wilczyński
2021-05-18  3:41 ` [PATCH v3 13/14] PCI/sysfs: Add missing trailing newline to devspec_show() Krzysztof Wilczyński
2021-05-18  3:41 ` [PATCH v3 14/14] PCI/sysfs: Only show value when driver_override is not NULL 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.