]> www.infradead.org Git - users/hch/misc.git/commitdiff
docs: filesystems: sysfs: Recommend sysfs_emit() for new code only
authorBart Van Assche <bvanassche@acm.org>
Thu, 24 Jul 2025 15:34:42 +0000 (08:34 -0700)
committerJonathan Corbet <corbet@lwn.net>
Mon, 11 Aug 2025 17:16:13 +0000 (11:16 -0600)
The advantages of converting existing sysfs show() methods to sysfs_emit()
and sysfs_emit_at() do not outweigh the risk of introducing bugs. Hence
recommend sysfs_emit() and sysfs_emit_at() only for new implementations of
show() methods.

Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: James Bottomley <James.Bottomley@HansenPartnership.com>
Cc: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Jonathan Corbet <corbet@lwn.net>
Link: https://lore.kernel.org/r/20250724153449.2433395-1-bvanassche@acm.org
Documentation/filesystems/sysfs.rst

index c32993bc83c70436db118df8f582f59715798b20..624e4f51212e63a782a971b2d922768328253cfe 100644 (file)
@@ -243,8 +243,8 @@ Other notes:
 - show() methods should return the number of bytes printed into the
   buffer.
 
-- show() should only use sysfs_emit() or sysfs_emit_at() when formatting
-  the value to be returned to user space.
+- New implementations of show() methods should only use sysfs_emit() or
+  sysfs_emit_at() when formatting the value to be returned to user space.
 
 - store() should return the number of bytes used from the buffer. If the
   entire buffer has been used, just return the count argument.