0024-usb-fotg210-hcd-use-sysfs_emit-to-instead-of-scnprin.patch 1.2 KB

1234567891011121314151617181920212223242526272829303132
  1. From 482830a70408a5d30af264b3d6706f818c78b2b2 Mon Sep 17 00:00:00 2001
  2. From: Andy Shevchenko <[email protected]>
  3. Date: Fri, 20 Jan 2023 17:44:33 +0200
  4. Subject: [PATCH 24/29] usb: fotg210-hcd: use sysfs_emit() to instead of
  5. scnprintf()
  6. Follow the advice of the Documentation/filesystems/sysfs.rst and show()
  7. should only use sysfs_emit() or sysfs_emit_at() when formatting the
  8. value to be returned to user space.
  9. Signed-off-by: Andy Shevchenko <[email protected]>
  10. Link: https://lore.kernel.org/r/[email protected]
  11. Signed-off-by: Greg Kroah-Hartman <[email protected]>
  12. ---
  13. --- a/drivers/usb/fotg210/fotg210-hcd.c
  14. +++ b/drivers/usb/fotg210/fotg210-hcd.c
  15. @@ -4686,14 +4686,11 @@ static ssize_t uframe_periodic_max_show(
  16. struct device_attribute *attr, char *buf)
  17. {
  18. struct fotg210_hcd *fotg210;
  19. - int n;
  20. fotg210 = hcd_to_fotg210(bus_to_hcd(dev_get_drvdata(dev)));
  21. - n = scnprintf(buf, PAGE_SIZE, "%d\n", fotg210->uframe_periodic_max);
  22. - return n;
  23. + return sysfs_emit(buf, "%d\n", fotg210->uframe_periodic_max);
  24. }
  25. -
  26. static ssize_t uframe_periodic_max_store(struct device *dev,
  27. struct device_attribute *attr, const char *buf, size_t count)
  28. {