Skip to contentSkip to conversation

PCI/ASPM: Convert to use sysfs_match_string() helper

PATCH In review Andy Shevchenko 2 participants 2 messages Aug 3, 2018 – Aug 6, 2018 PCI

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 PCI/ASPM: Convert to use sysfs_match_string() helper

The commit

4cec16861a40 ("PCI/ASPM: Convert to use match_string() helper")

didn't take into consideration small but crucial detail about scope of usage, i.e. sysfs interface provided to handle the ASPM policy. Due to this in most of the cases input string comes with a new line symbol.

Use sysfs_match_string() helper to take into account above.

Fixes 4cec16861a40 ("PCI/ASPM: Convert to use match_string() helper")
---
 drivers/pci/pcie/aspm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pci/pcie/aspm.c +1 -1
index 0e88b3ad065f..5326916715d2 100644
@@ -1127,7 +1127,7 @@ static int pcie_aspm_set_policy(const char *val,
 
 	if (aspm_disabled)
 		return -EPERM;
-	i = match_string(policy_str, ARRAY_SIZE(policy_str), val);
+	i = sysfs_match_string(policy_str, val);
 	if (i < 0)
 		return i;
 	if (i == aspm_policy)
Signature · 1 line
2.18.0
#1 lore raw
Quoted 8 lines · Andy Shevchenko

The commit

4cec16861a40 ("PCI/ASPM: Convert to use match_string() helper")

didn't take into consideration small but crucial detail about scope of usage, i.e. sysfs interface provided to handle the ASPM policy. Due to this in most of the cases input string comes with a new line symbol.

Quoted 5 lines

Use sysfs_match_string() helper to take into account above.

Fixes 4cec16861a40 ("PCI/ASPM: Convert to use match_string() helper")

Folded into original patch on pci/aspm for v4.19, thanks!

Quoted 20 lines
---
 drivers/pci/pcie/aspm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pci/pcie/aspm.c +1 -1
index 0e88b3ad065f..5326916715d2 100644
@@ -1127,7 +1127,7 @@ static int pcie_aspm_set_policy(const char *val,
 
 	if (aspm_disabled)
 		return -EPERM;
-	i = match_string(policy_str, ARRAY_SIZE(policy_str), val);
+	i = sysfs_match_string(policy_str, val);
 	if (i < 0)
 		return i;
 	if (i == aspm_policy)
Signature · 1 line
2.18.0