Skip to contentSkip to conversation

Documentation: firmware: Clarify firmware path usage

PATCH In review Florian Fainelli 3 participants 7 messages Apr 2, 2023 – Apr 12, 2023 Documentation

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Documentation: firmware: Clarify firmware path usage

Newline characters will be taken into account for the firmware search path parameter, warn users about that and provide an example using 'echo -n' such that it clarifies the typical use of that parameter.

---
 Documentation/driver-api/firmware/fw_search_path.rst | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
Documentation/driver-api/firmware/fw_search_path.rst +7 -2
index a360f1009fa3..d7cb1e8f0076 100644
@@ -22,5 +22,10 @@ can use the file:
 
 * /sys/module/firmware_class/parameters/path
 
-You would echo into it your custom path and firmware requested will be
-searched for there first.
+You would echo into it your custom path and firmware requested will be searched
+for there first. Be aware that newline characters will be taken into account
+and may not produce the intended effects. For instance you might want to use:
+
+echo -n /path/to/script > /sys/module/firmware_class/parameters/path
+
+to ensure that your script is being used.
Signature · 1 line
2.25.1
maintainer
#1 lore raw
Quoted 16 lines · Florian Fainelli

Newline characters will be taken into account for the firmware search path parameter, warn users about that and provide an example using 'echo -n' such that it clarifies the typical use of that parameter.

---
 Documentation/driver-api/firmware/fw_search_path.rst | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
Documentation/driver-api/firmware/fw_search_path.rst +0 -0
index a360f1009fa3..d7cb1e8f0076 100644
@@ -22,5 +22,10 @@ can use the file:
 
 * /sys/module/firmware_class/parameters/path

Documentation/driver-api/firmware/fw_search_path.rst can use the file: · line 31

Quoted 10 lines
Documentation/driver-api/firmware/fw_search_path.rst +7 -2
 
-You would echo into it your custom path and firmware requested will be
-searched for there first.
+You would echo into it your custom path and firmware requested will be searched
+for there first. Be aware that newline characters will be taken into account
+and may not produce the intended effects. For instance you might want to use:
+
+echo -n /path/to/script > /sys/module/firmware_class/parameters/path
+
+to ensure that your script is being used.

So I have no problem with applying this, but I have to ask...might it not be better to fix the implementation of that sysfs file to strip surrounding whitespace from the provided path? This patch has the look of a lesson learned the hard way; rather than codifying this behavior into a feature, perhaps we could just make the next person's life a bit easier...?

Thanks,

jon

#2 lore raw
Quoted 19 lines · Jonathan Corbet
Quoted 17 lines · Florian Fainelli

Newline characters will be taken into account for the firmware search path parameter, warn users about that and provide an example using 'echo -n' such that it clarifies the typical use of that parameter.

---
  Documentation/driver-api/firmware/fw_search_path.rst | 9 +++++++--
  1 file changed, 7 insertions(+), 2 deletions(-)
Documentation/driver-api/firmware/fw_search_path.rst +0 -0
index a360f1009fa3..d7cb1e8f0076 100644
@@ -22,5 +22,10 @@ can use the file:
 
  * /sys/module/firmware_class/parameters/path
 
Quoted 16 lines

Documentation/driver-api/firmware/fw_search_path.rst can use the file: · line 31

Quoted 9 lines
Documentation/driver-api/firmware/fw_search_path.rst +7 -2
-You would echo into it your custom path and firmware requested will be
-searched for there first.
+You would echo into it your custom path and firmware requested will be searched
+for there first. Be aware that newline characters will be taken into account
+and may not produce the intended effects. For instance you might want to use:
+
+echo -n /path/to/script > /sys/module/firmware_class/parameters/path
+
+to ensure that your script is being used.

So I have no problem with applying this, but I have to ask...might it not be better to fix the implementation of that sysfs file to strip surrounding whitespace from the provided path? This patch has the look of a lesson learned the hard way; rather than codifying this behavior into a feature, perhaps we could just make the next person's life a bit easier...?

I was not sure whether it was on purpose or not, Greg, will we break anyone's use case if we strip off \n from the firmware path passed via sysfs?

Signature · 1 line
Florian
#3 lore raw
Quoted 37 lines · Florian Fainelli
Quoted 25 lines · Jonathan Corbet
Quoted 23 lines · Florian Fainelli

Newline characters will be taken into account for the firmware search path parameter, warn users about that and provide an example using 'echo -n' such that it clarifies the typical use of that parameter.

---
  Documentation/driver-api/firmware/fw_search_path.rst | 9 +++++++--
  1 file changed, 7 insertions(+), 2 deletions(-)
Documentation/driver-api/firmware/fw_search_path.rst +6 -2
index a360f1009fa3..d7cb1e8f0076 100644
@@ -22,5 +22,10 @@ can use the file:
  * /sys/module/firmware_class/parameters/path
-You would echo into it your custom path and firmware requested will be
-searched for there first.
+You would echo into it your custom path and firmware requested will be searched
+for there first. Be aware that newline characters will be taken into account
+and may not produce the intended effects. For instance you might want to use:
+
+echo -n /path/to/script > /sys/module/firmware_class/parameters/path
+
Quoted 8 lines

Documentation/driver-api/firmware/fw_search_path.rst can use the file: · line 31

Quoted 1 line
Documentation/driver-api/firmware/fw_search_path.rst +1 -0
+to ensure that your script is being used.

So I have no problem with applying this, but I have to ask...might it not be better to fix the implementation of that sysfs file to strip surrounding whitespace from the provided path? This patch has the look of a lesson learned the hard way; rather than codifying this behavior into a feature, perhaps we could just make the next person's life a bit easier...?

Quoted 3 lines

I was not sure whether it was on purpose or not, Greg, will we break anyone's use case if we strip off \n from the firmware path passed via sysfs?

I do not know, sorry.

maintainer
#4 lore raw
Quoted 6 lines · Greg KH
Quoted 3 lines · Florian Fainelli

I was not sure whether it was on purpose or not, Greg, will we break anyone's use case if we strip off \n from the firmware path passed via sysfs?

I do not know, sorry.

I would be amazed if anybody is putting newlines into their firmware path; that would be kind of a silly thing to do.

That said, I've been amazed before.

I'll go ahead and apply the docs patch, but it still doesn't really seem like the right fix to me.

Thanks,

jon

#5 lore raw
Quoted 9 lines · Jonathan Corbet
Quoted 6 lines · Greg KH
Quoted 3 lines · Florian Fainelli

I was not sure whether it was on purpose or not, Greg, will we break anyone's use case if we strip off \n from the firmware path passed via sysfs?

I do not know, sorry.

Quoted 7 lines

I would be amazed if anybody is putting newlines into their firmware path; that would be kind of a silly thing to do.

That said, I've been amazed before.

I'll go ahead and apply the docs patch, but it still doesn't really seem like the right fix to me.

I will submit a patch that strips off newlines from sysfs provided firmware paths and if this turns out to break someone's use case it could still be reverted, sounds good?

Signature · 1 line
Florian
#6 lore raw
Quoted 13 lines · Florian Fainelli
Quoted 12 lines · Jonathan Corbet
Quoted 6 lines · Greg KH
Quoted 3 lines · Florian Fainelli

I was not sure whether it was on purpose or not, Greg, will we break anyone's use case if we strip off \n from the firmware path passed via sysfs?

I do not know, sorry.

I would be amazed if anybody is putting newlines into their firmware path; that would be kind of a silly thing to do.

Quoted 8 lines
Quoted 4 lines

That said, I've been amazed before.

I'll go ahead and apply the docs patch, but it still doesn't really seem like the right fix to me.

I will submit a patch that strips off newlines from sysfs provided firmware paths and if this turns out to break someone's use case it could still be reverted, sounds good?

Sounds good.