]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commitdiff
net: hns3: add optimization in the hclge_hw_error_set_state
authorShiju Jose <shiju.jose@huawei.com>
Fri, 7 Dec 2018 21:08:03 +0000 (21:08 +0000)
committerKleber Sacilotto de Souza <kleber.souza@canonical.com>
Mon, 14 Jan 2019 09:28:55 +0000 (09:28 +0000)
BugLink: https://bugs.launchpad.net/bugs/1810457
1. This patch adds minor loop optimization in the
   hclge_hw_error_set_state function.
2. Adds logging module's name if it fails to configure the
   error interrupts.

Signed-off-by: Shiju Jose <shiju.jose@huawei.com>
Signed-off-by: Salil Mehta <salil.mehta@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 481a626a603d5e234618a19abbaa889405755f46)
Signed-off-by: dann frazier <dann.frazier@canonical.com>
Acked-by: Stefan Bader <stefan.bader@canonical.com>
Acked-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
Signed-off-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_err.c

index 2d07be873a31f5b5d2f6bdd3ab880df407c72c03..d1c9f7ac90215d6cd6a8a93b073e5bb9449c3d13 100644 (file)
@@ -586,18 +586,16 @@ static const struct hclge_hw_blk hw_blk[] = {
 
 int hclge_hw_error_set_state(struct hclge_dev *hdev, bool state)
 {
+       const struct hclge_hw_blk *module = hw_blk;
        int ret = 0;
-       int i = 0;
 
-       while (hw_blk[i].name) {
-               if (!hw_blk[i].config_err_int) {
-                       i++;
-                       continue;
+       while (module->name) {
+               if (module->config_err_int) {
+                       ret = module->config_err_int(hdev, state);
+                       if (ret)
+                               return ret;
                }
-               ret = hw_blk[i].config_err_int(hdev, state);
-               if (ret)
-                       return ret;
-               i++;
+               module++;
        }
 
        return ret;