From patchwork Sat May 8 00:29:01 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Marangi X-Patchwork-Id: 12245425 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C06CAC433B4 for ; Sat, 8 May 2021 00:29:50 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A247E61057 for ; Sat, 8 May 2021 00:29:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231179AbhEHAat (ORCPT ); Fri, 7 May 2021 20:30:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47690 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230394AbhEHAad (ORCPT ); Fri, 7 May 2021 20:30:33 -0400 Received: from mail-wm1-x329.google.com (mail-wm1-x329.google.com [IPv6:2a00:1450:4864:20::329]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5D423C061574; Fri, 7 May 2021 17:29:31 -0700 (PDT) Received: by mail-wm1-x329.google.com with SMTP id a10-20020a05600c068ab029014dcda1971aso5924691wmn.3; Fri, 07 May 2021 17:29:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=fczMnBhmtho0URtHNyya3OojQZqoHKWZ9vHMvarIH4c=; b=GMZUbkLFdCtKOD6dICwJX75JY5AO7q4joRFUMf31IZMEs6E+SDv4gu71bUHLnlJjvZ 64V/Nv3hYin3HeOTkgVkz6J+QeE8R+ISmGRVOmlLWIMVyOCApJeIRHHO4VbBbgeDuper xDX/BhbS3h4pdD9UKaseMD7gv6UIRSBE/knH6/fx+T8fCMuDQQLe21+4xIpja7VWSOTV 1esZ2ywap+g67bhhebsgG3vdawDe+3en3/vm6JL+7MbpsrBxucvSjkKXvXBJsbJ6i3u7 ByywiYN7LsVTY72Y14y8AtcMJGRhP9Ypf+7H+bKvDVaoXtyvrhdCNLB3lGjRLbU9XLT0 D5Dw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=fczMnBhmtho0URtHNyya3OojQZqoHKWZ9vHMvarIH4c=; b=mOT+WZghn6G8YausgcaXx2risign/67F+baU/NDD3/7iyWSDGr0x37IlpwlM8OtbJw NUhHE9wXN2E15mJio12/IVIc5df+t8fJJcqpDxCeg03e4bgmpFNKnlc4YazZRhtE5tyP 9mUoMCYfbDjA7XPy+TYS8bXm7TCuUjDy6HZqXvW1SfaeoucUFCXKqM6XafxKJwxfpyX7 PkFxQrWWTPnyz/z3PLrMf8c+mjjXj7+ifQuUCzMAojc4+H6KlmWYZZ1c2+cC2iHH9St0 2OW5qVQd3Cm+G9wUF9odv/0EEQpmoV6KC6rBNy0LMi2toPWCN0mIgfwFuLM265a9LxIx HqRA== X-Gm-Message-State: AOAM532rJGfniSHdzSwHhyHi0LvBDdo+c4hBmDaBKmA9l/a0ULQxSmyp RnB8KMcGvDdo1tcx1Xnl8Yg= X-Google-Smtp-Source: ABdhPJy2PDNubHcf2bzf91/pxEcz8wWMCzCEPl4WZFyP2wb9nqyopzjTHlw/zg40MPHCiTk8W4BMFw== X-Received: by 2002:a1c:35c2:: with SMTP id c185mr12553502wma.54.1620433770032; Fri, 07 May 2021 17:29:30 -0700 (PDT) Received: from Ansuel-xps.localdomain (93-35-189-2.ip56.fastwebnet.it. [93.35.189.2]) by smtp.googlemail.com with ESMTPSA id f4sm10967597wrz.33.2021.05.07.17.29.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 07 May 2021 17:29:29 -0700 (PDT) From: Ansuel Smith To: Florian Fainelli Cc: Ansuel Smith , Andrew Lunn , Vivien Didelot , Vladimir Oltean , "David S. Miller" , Jakub Kicinski , Russell King , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [RFC PATCH net-next v4 11/28] net: dsa: qca8k: handle error from qca8k_busy_wait Date: Sat, 8 May 2021 02:29:01 +0200 Message-Id: <20210508002920.19945-11-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210508002920.19945-1-ansuelsmth@gmail.com> References: <20210508002920.19945-1-ansuelsmth@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org X-Patchwork-State: RFC Propagate errors from qca8k_busy_wait instead of hardcoding return value. Signed-off-by: Ansuel Smith Reviewed-by: Andrew Lunn --- drivers/net/dsa/qca8k.c | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/drivers/net/dsa/qca8k.c b/drivers/net/dsa/qca8k.c index 16ffff478de0..6c65c6013c5f 100644 --- a/drivers/net/dsa/qca8k.c +++ b/drivers/net/dsa/qca8k.c @@ -397,8 +397,9 @@ qca8k_fdb_access(struct qca8k_priv *priv, enum qca8k_fdb_cmd cmd, int port) return ret; /* wait for completion */ - if (qca8k_busy_wait(priv, QCA8K_REG_ATU_FUNC, QCA8K_ATU_FUNC_BUSY)) - return -1; + ret = qca8k_busy_wait(priv, QCA8K_REG_ATU_FUNC, QCA8K_ATU_FUNC_BUSY); + if (ret) + return ret; /* Check for table full violation when adding an entry */ if (cmd == QCA8K_FDB_LOAD) { @@ -480,8 +481,9 @@ qca8k_vlan_access(struct qca8k_priv *priv, enum qca8k_vlan_cmd cmd, u16 vid) return ret; /* wait for completion */ - if (qca8k_busy_wait(priv, QCA8K_REG_VTU_FUNC1, QCA8K_VTU_FUNC1_BUSY)) - return -ETIMEDOUT; + ret = qca8k_busy_wait(priv, QCA8K_REG_VTU_FUNC1, QCA8K_VTU_FUNC1_BUSY); + if (ret) + return ret; /* Check for table full violation when adding an entry */ if (cmd == QCA8K_VLAN_LOAD) { @@ -592,7 +594,9 @@ qca8k_mib_init(struct qca8k_priv *priv) if (ret) goto exit; - qca8k_busy_wait(priv, QCA8K_REG_MIB, QCA8K_MIB_BUSY); + ret = qca8k_busy_wait(priv, QCA8K_REG_MIB, QCA8K_MIB_BUSY); + if (ret) + goto exit; ret = qca8k_reg_set(priv, QCA8K_REG_MIB, QCA8K_MIB_CPU_KEEP); if (ret) @@ -682,9 +686,10 @@ qca8k_mdio_read(struct qca8k_priv *priv, int port, u32 regnum) if (ret) return ret; - if (qca8k_busy_wait(priv, QCA8K_MDIO_MASTER_CTRL, - QCA8K_MDIO_MASTER_BUSY)) - return -ETIMEDOUT; + ret = qca8k_busy_wait(priv, QCA8K_MDIO_MASTER_CTRL, + QCA8K_MDIO_MASTER_BUSY); + if (ret) + return ret; val = qca8k_read(priv, QCA8K_MDIO_MASTER_CTRL); if (val < 0)