linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH V2 0/5] hid: replace snprintf in show functions with sysfs_emit
@ 2021-10-15 11:07 Qing Wang
  2021-10-15 11:07 ` [PATCH V2 1/5] hid-lenovo: " Qing Wang
                   ` (4 more replies)
  0 siblings, 5 replies; 8+ messages in thread
From: Qing Wang @ 2021-10-15 11:07 UTC (permalink / raw)
  To: Jiri Kosina, Benjamin Tissoires, Bruno Prémont,
	Stefan Achatz, Jonathan Cameron, Srinivas Pandruvada, linux-input,
	linux-kernel, linux-iio
  Cc: Qing Wang

According to Documentation/filesystems/sysfs.txt:
show() methods of device attributes should return the number
of bytes printed into the buffer. This is the return value of 
scnprintf(). snprintf() returns the length the resulting string.

So, show() should not use snprintf() when formatting 
the value to be returned to user space. 
Also, use sysfs_emit directly makes more sense.

Qing Wang (5):
  hid-lenovo: replace snprintf in show functions with sysfs_emit
  hid-picolcd: replace snprintf in show functions with sysfs_emit
  hid-roccat: replace snprintf in show functions with sysfs_emit
  hid-sensor: replace snprintf in show functions with sysfs_emit
  hid-sony: replace snprintf in show functions with sysfs_emit

 drivers/hid/hid-lenovo.c          | 16 ++++++++--------
 drivers/hid/hid-picolcd_core.c    |  6 +++---
 drivers/hid/hid-roccat-isku.c     |  2 +-
 drivers/hid/hid-roccat-kone.c     | 12 ++++++------
 drivers/hid/hid-roccat-koneplus.c |  4 ++--
 drivers/hid/hid-roccat-kovaplus.c | 10 +++++-----
 drivers/hid/hid-roccat-pyra.c     |  6 +++---
 drivers/hid/hid-sensor-custom.c   |  2 +-
 drivers/hid/hid-sony.c            |  6 +++---
 9 files changed, 32 insertions(+), 32 deletions(-)

-- 
2.7.4


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

end of thread, other threads:[~2021-10-15 13:51 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-10-15 11:07 [PATCH V2 0/5] hid: replace snprintf in show functions with sysfs_emit Qing Wang
2021-10-15 11:07 ` [PATCH V2 1/5] hid-lenovo: " Qing Wang
2021-10-15 13:51   ` Jonathan Cameron
2021-10-15 11:07 ` [PATCH V2 2/5] hid-picolcd: " Qing Wang
2021-10-15 11:07 ` [PATCH V2 3/5] hid-roccat: " Qing Wang
2021-10-15 11:07 ` [PATCH V2 4/5] hid-sensor: " Qing Wang
2021-10-15 13:48   ` Jonathan Cameron
2021-10-15 11:07 ` [PATCH V2 5/5] hid-sony: " Qing Wang

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).