drivers/xen/xen-pciback/pci_stub.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
Replace the use of scnprintf() with sysfs_emit_at() in slots_show() and irq_handlers_show().
This change uses sysfs_emit() API usage for sysfs 'show'
functions as recommended from Documentation/filesystems/sysfs.rst.
No functional change intended.
Signed-off-by: Ryan Chung <seokwoo.chung130@gmail.com>
---
drivers/xen/xen-pciback/pci_stub.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/drivers/xen/xen-pciback/pci_stub.c b/drivers/xen/xen-pciback/pci_stub.c
index 5c2f829d5b0b..d0a889474a46 100644
--- a/drivers/xen/xen-pciback/pci_stub.c
+++ b/drivers/xen/xen-pciback/pci_stub.c
@@ -18,6 +18,7 @@
#include <linux/wait.h>
#include <linux/sched.h>
#include <linux/atomic.h>
+#include <linux/sysfs.h>
#include <xen/events.h>
#include <xen/pci.h>
#include <xen/xen.h>
@@ -30,6 +31,7 @@
#include "conf_space.h"
#include "conf_space_quirks.h"
+
#define PCISTUB_DRIVER_NAME "pciback"
static char *pci_devs_to_hide;
@@ -720,7 +722,7 @@ static void kill_domain_by_device(struct pcistub_device *psdev)
return;
}
/*PV AER handlers will set this flag*/
- xenbus_printf(xbt, nodename, "aerState" , "aerfail");
+ xenbus_printf(xbt, nodename, "aerState", "aerfail");
err = xenbus_transaction_end(xbt, 0);
if (err) {
if (err == -EAGAIN)
@@ -1261,7 +1263,7 @@ static ssize_t slots_show(struct device_driver *drv, char *buf)
if (count >= PAGE_SIZE)
break;
- count += scnprintf(buf + count, PAGE_SIZE - count,
+ count += sysfs_emit_at(buf, count,
"%04x:%02x:%02x.%d\n",
pci_dev_id->domain, pci_dev_id->bus,
PCI_SLOT(pci_dev_id->devfn),
@@ -1290,7 +1292,7 @@ static ssize_t irq_handlers_show(struct device_driver *drv, char *buf)
if (!dev_data)
continue;
count +=
- scnprintf(buf + count, PAGE_SIZE - count,
+ sysfs_emit_at(buf, count,
"%s:%s:%sing:%ld\n",
pci_name(psdev->dev),
dev_data->isr_on ? "on" : "off",
--
2.43.0
I sent the wrong patch. My apologies. Please ignore this patch. I will send a V2 shortly. On Tue, 24 Jun 2025 at 12:26, Ryan Chung <seokwoo.chung130@gmail.com> wrote: > > Replace the use of scnprintf() with sysfs_emit_at() in slots_show() and irq_handlers_show(). > > This change uses sysfs_emit() API usage for sysfs 'show' > functions as recommended from Documentation/filesystems/sysfs.rst. > > No functional change intended. > > Signed-off-by: Ryan Chung <seokwoo.chung130@gmail.com> > --- > drivers/xen/xen-pciback/pci_stub.c | 8 +++++--- > 1 file changed, 5 insertions(+), 3 deletions(-) > > diff --git a/drivers/xen/xen-pciback/pci_stub.c b/drivers/xen/xen-pciback/pci_stub.c > index 5c2f829d5b0b..d0a889474a46 100644 > --- a/drivers/xen/xen-pciback/pci_stub.c > +++ b/drivers/xen/xen-pciback/pci_stub.c > @@ -18,6 +18,7 @@ > #include <linux/wait.h> > #include <linux/sched.h> > #include <linux/atomic.h> > +#include <linux/sysfs.h> > #include <xen/events.h> > #include <xen/pci.h> > #include <xen/xen.h> > @@ -30,6 +31,7 @@ > #include "conf_space.h" > #include "conf_space_quirks.h" > > + > #define PCISTUB_DRIVER_NAME "pciback" > > static char *pci_devs_to_hide; > @@ -720,7 +722,7 @@ static void kill_domain_by_device(struct pcistub_device *psdev) > return; > } > /*PV AER handlers will set this flag*/ > - xenbus_printf(xbt, nodename, "aerState" , "aerfail"); > + xenbus_printf(xbt, nodename, "aerState", "aerfail"); > err = xenbus_transaction_end(xbt, 0); > if (err) { > if (err == -EAGAIN) > @@ -1261,7 +1263,7 @@ static ssize_t slots_show(struct device_driver *drv, char *buf) > if (count >= PAGE_SIZE) > break; > > - count += scnprintf(buf + count, PAGE_SIZE - count, > + count += sysfs_emit_at(buf, count, > "%04x:%02x:%02x.%d\n", > pci_dev_id->domain, pci_dev_id->bus, > PCI_SLOT(pci_dev_id->devfn), > @@ -1290,7 +1292,7 @@ static ssize_t irq_handlers_show(struct device_driver *drv, char *buf) > if (!dev_data) > continue; > count += > - scnprintf(buf + count, PAGE_SIZE - count, > + sysfs_emit_at(buf, count, > "%s:%s:%sing:%ld\n", > pci_name(psdev->dev), > dev_data->isr_on ? "on" : "off", > -- > 2.43.0 >
© 2016 - 2025 Red Hat, Inc.