Update the instructions for enabling and disabling read access to the
special sysfs 'rom' file for PCI devices.  The function that interprets
user data for enabling and disabling the device actually expects _at
least_ 2 bytes, more than what is expressly implied by "1" or "0".

It should also be noted, that the code path for enabling read access to
the special file can receive any length of input as long as it doesn't
start with "0".  However, this is not added to the documentation as this
is, perhaps, not a "feature" of the file system we want to encourage.

This patch is submitted in place of accepting [pci: use kstrtobool over
ad hoc string parsing][0] as to not break existing functionality.
Similarly, this patch is in reference to a bugzilla report: [Sysfs PCI
rom file functionality does not match documentation][1].

[0]: https://www.spinics.net/lists/linux-pci/msg69073.html
[1]: https://bugzilla.kernel.org/show_bug.cgi?id=111301

Reported-by: google...@yahoo.com
Signed-off-by: Kenny Ballou <kbal...@devnulllabs.io>
---
 Documentation/filesystems/sysfs-pci.txt | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/Documentation/filesystems/sysfs-pci.txt 
b/Documentation/filesystems/sysfs-pci.txt
index 06f1d64c6f70..0cc9a32ebab0 100644
--- a/Documentation/filesystems/sysfs-pci.txt
+++ b/Documentation/filesystems/sysfs-pci.txt
@@ -75,8 +75,8 @@ may not be reversed.
 
 The 'rom' file is special in that it provides read-only access to the device's
 ROM file, if available.  It's disabled by default, however, so applications
-should write the string "1" to the file to enable it before attempting a read
-call, and disable it following the access by writing "0" to the file.  Note
+should write the string "1\n" to the file to enable it before attempting a read
+call, and disable it following the access by writing "0\n" to the file.  Note
 that the device must be enabled for a rom read to return data successfully.
 In the event a driver is not bound to the device, it can be enabled using the
 'enable' file, documented above.
-- 
2.16.1

--
To unsubscribe from this list: send the line "unsubscribe linux-doc" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to