public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v1 1/5] usb: fotg210-hcd: use sysfs_emit() to instead of scnprintf()
@ 2023-01-20 15:44 Andy Shevchenko
  2023-01-20 15:44 ` [PATCH v1 2/5] usb: fotg210-hcd: Don't shadow error codes in store() Andy Shevchenko
                   ` (4 more replies)
  0 siblings, 5 replies; 15+ messages in thread
From: Andy Shevchenko @ 2023-01-20 15:44 UTC (permalink / raw)
  To: Linus Walleij, Greg Kroah-Hartman, linux-usb, linux-kernel
  Cc: Andy Shevchenko

Follow the advice of the Documentation/filesystems/sysfs.rst and show()
should only use sysfs_emit() or sysfs_emit_at() when formatting the
value to be returned to user space.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/usb/fotg210/fotg210-hcd.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/drivers/usb/fotg210/fotg210-hcd.c b/drivers/usb/fotg210/fotg210-hcd.c
index 7bd1e8f3080d..46752a75c428 100644
--- a/drivers/usb/fotg210/fotg210-hcd.c
+++ b/drivers/usb/fotg210/fotg210-hcd.c
@@ -4686,14 +4686,11 @@ static ssize_t uframe_periodic_max_show(struct device *dev,
 		struct device_attribute *attr, char *buf)
 {
 	struct fotg210_hcd *fotg210;
-	int n;
 
 	fotg210 = hcd_to_fotg210(bus_to_hcd(dev_get_drvdata(dev)));
-	n = scnprintf(buf, PAGE_SIZE, "%d\n", fotg210->uframe_periodic_max);
-	return n;
+	return sysfs_emit(buf, "%d\n", fotg210->uframe_periodic_max);
 }
 
-
 static ssize_t uframe_periodic_max_store(struct device *dev,
 		struct device_attribute *attr, const char *buf, size_t count)
 {
-- 
2.39.0


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

end of thread, other threads:[~2023-02-16  8:30 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-01-20 15:44 [PATCH v1 1/5] usb: fotg210-hcd: use sysfs_emit() to instead of scnprintf() Andy Shevchenko
2023-01-20 15:44 ` [PATCH v1 2/5] usb: fotg210-hcd: Don't shadow error codes in store() Andy Shevchenko
2023-01-26 20:00   ` Linus Walleij
2023-01-20 15:44 ` [PATCH v1 3/5] usb: fotg210-udc: remove redundant error logging Andy Shevchenko
2023-01-26 20:01   ` Linus Walleij
2023-01-20 15:44 ` [PATCH v1 4/5] usb: fotg210: Switch to use dev_err_probe() Andy Shevchenko
2023-01-26 20:01   ` Linus Walleij
2023-02-16  8:07   ` Christophe JAILLET
2023-02-16  8:30     ` Linus Walleij
2023-01-20 15:44 ` [PATCH v1 5/5] usb: fotg210: use devm_platform_get_and_ioremap_resource() Andy Shevchenko
2023-01-26 20:02   ` Linus Walleij
2023-01-27  8:55     ` Andy Shevchenko
2023-01-27  9:10       ` Linus Walleij
2023-01-27  9:16         ` Andy Shevchenko
2023-01-26 19:59 ` [PATCH v1 1/5] usb: fotg210-hcd: use sysfs_emit() to instead of scnprintf() Linus Walleij

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox