Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 36131ce9 authored by Andy Shevchenko's avatar Andy Shevchenko Committed by Bjorn Helgaas
Browse files

PCI/ASPM: Convert to use sysfs_match_string() helper



The sysfs_match_string() helper returns index of the matching string in an
array.  Use it in pcie_aspm_set_policy() to simplify the code.

Signed-off-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
[bhelgaas: squash sysfs_match_string() fix into original patch for issue
Reported-by: default avatarHeiner Kallweit <hkallweit1@gmail.com&gt;]>
Signed-off-by: default avatarBjorn Helgaas <bhelgaas@google.com>
parent ce397d21
Loading
Loading
Loading
Loading
+3 −5
Original line number Diff line number Diff line
@@ -1127,11 +1127,9 @@ static int pcie_aspm_set_policy(const char *val,

	if (aspm_disabled)
		return -EPERM;
	for (i = 0; i < ARRAY_SIZE(policy_str); i++)
		if (!strncmp(val, policy_str[i], strlen(policy_str[i])))
			break;
	if (i >= ARRAY_SIZE(policy_str))
		return -EINVAL;
	i = sysfs_match_string(policy_str, val);
	if (i < 0)
		return i;
	if (i == aspm_policy)
		return 0;