提交 70d330ad 编写于 作者: A Andy Shevchenko 提交者: Caspar Zhang

PCI/AER: Use match_string() helper to simplify the code

task #29600094

commit 807ffb1e1eabbcdcd46494ee415317aa80ed415c upstream.
Backport summary: for 4.19 kernel ICX PCIe Gen4 support.

match_string() returns the array index of a matching string.  Use it
instead of the open-coded implementation.
Signed-off-by: NAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: NBjorn Helgaas <bhelgaas@google.com>
(cherry picked from commit 807ffb1e1eabbcdcd46494ee415317aa80ed415c)
Signed-off-by: NEthan Zhao <haifeng.zhao@intel.com>
Signed-off-by: NArtie Ding <artie.ding@linux.alibaba.com>
Acked-by: NCaspar Zhang <caspar@linux.alibaba.com>
上级 554ea036
...@@ -117,7 +117,7 @@ bool pci_aer_available(void) ...@@ -117,7 +117,7 @@ bool pci_aer_available(void)
static int ecrc_policy = ECRC_POLICY_DEFAULT; static int ecrc_policy = ECRC_POLICY_DEFAULT;
static const char *ecrc_policy_str[] = { static const char * const ecrc_policy_str[] = {
[ECRC_POLICY_DEFAULT] = "bios", [ECRC_POLICY_DEFAULT] = "bios",
[ECRC_POLICY_OFF] = "off", [ECRC_POLICY_OFF] = "off",
[ECRC_POLICY_ON] = "on" [ECRC_POLICY_ON] = "on"
...@@ -203,11 +203,8 @@ void pcie_ecrc_get_policy(char *str) ...@@ -203,11 +203,8 @@ void pcie_ecrc_get_policy(char *str)
{ {
int i; int i;
for (i = 0; i < ARRAY_SIZE(ecrc_policy_str); i++) i = match_string(ecrc_policy_str, ARRAY_SIZE(ecrc_policy_str), str);
if (!strncmp(str, ecrc_policy_str[i], if (i < 0)
strlen(ecrc_policy_str[i])))
break;
if (i >= ARRAY_SIZE(ecrc_policy_str))
return; return;
ecrc_policy = i; ecrc_policy = i;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册