From patchwork Sun Oct 11 10:22:56 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Chan X-Patchwork-Id: 270139 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=-12.7 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, MIME_HEADER_CTYPE_ONLY, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, T_TVD_MIME_NO_HEADERS, URIBL_BLOCKED, 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 7AB37C433E7 for ; Sun, 11 Oct 2020 10:23:34 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 3ECC8207F7 for ; Sun, 11 Oct 2020 10:23:34 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.b="RGZqynOG" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729634AbgJKKXc (ORCPT ); Sun, 11 Oct 2020 06:23:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33908 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727035AbgJKKXY (ORCPT ); Sun, 11 Oct 2020 06:23:24 -0400 Received: from mail-pf1-x441.google.com (mail-pf1-x441.google.com [IPv6:2607:f8b0:4864:20::441]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D472DC0613CE for ; Sun, 11 Oct 2020 03:23:24 -0700 (PDT) Received: by mail-pf1-x441.google.com with SMTP id y14so10775428pfp.13 for ; Sun, 11 Oct 2020 03:23:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=vQHU9KUdCZPZvEoGfzhG2OU6JJPjcM31kFff1Y+vDik=; b=RGZqynOGO4U8Jl3imscm1CpcRmCrWKRTlDriteRcieTkBVnwxwoIZ76S+eWb0IXR69 eAxeG86Dwcx3zdbaVIqR7Xb1TZ+uowKHC16SH2eep3CbjVGmX3aQU4lCHKapFAZ4jy19 urPpSvTklsejZiyf/tQNktORxR4WzYe+ZxX/c= 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; bh=vQHU9KUdCZPZvEoGfzhG2OU6JJPjcM31kFff1Y+vDik=; b=VFXZcPOylxtkDbB3hZT1dOh0hIdNYlyxMEUah54ZdCyO1TiMJNzX5pfjgaP/TZyWw+ bnQVqOmVjilXoFbrK/buksE8YwAW96SFmbg5LMGcBK+FnnLIbOEMeCsnQ/fnxTFpFKvB dzjKgpN08G60jebQEB7PECVskFO4uDGQpSzSh1yp3iUKlDJ1s29Hm3tjfAN5Avq1zaJA +pNzWWHnPLDVu7SfgLLo3Us8zgrUdp99ErrPtVOGshzATwD1/mpYVk0f0/H5ipf+5+BW 9BV9u0ChmmcYDDVhsETxVmi0g7ZuV3f+F4oVek6/aO4W6dV4TRohFM1ExhT7I0aSHMR7 1Zrg== X-Gm-Message-State: AOAM5301TteBzQqCwbBADtbwg7zTFdkJ1c1CpNA4VBYoYETO9XiuzdpH nOrUFEsR53oWH5uzCkC+wS4Eaw== X-Google-Smtp-Source: ABdhPJxjIR3yy8YjDMiQqAnLj6j1d/sRDJ34JRZfiD7XGesqjb/oUsmUzRCn70JWS+sUdG8V2zWiVQ== X-Received: by 2002:a17:90b:1215:: with SMTP id gl21mr12342423pjb.132.1602411804098; Sun, 11 Oct 2020 03:23:24 -0700 (PDT) Received: from localhost.swdvt.lab.broadcom.net ([192.19.223.252]) by smtp.gmail.com with ESMTPSA id i1sm20155057pjh.52.2020.10.11.03.23.23 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sun, 11 Oct 2020 03:23:23 -0700 (PDT) From: Michael Chan To: davem@davemloft.net Cc: netdev@vger.kernel.org, kuba@kernel.org, gospo@broadcom.com Subject: [PATCH net-next 4/9] bnxt_en: Simplify bnxt_async_event_process(). Date: Sun, 11 Oct 2020 06:22:56 -0400 Message-Id: <1602411781-6012-5-git-send-email-michael.chan@broadcom.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1602411781-6012-1-git-send-email-michael.chan@broadcom.com> References: <1602411781-6012-1-git-send-email-michael.chan@broadcom.com> Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org event_data1 and event_data2 are used when processing most events. Store these in local variables at the beginning of the function to simplify many of the case statements. Reviewed-by: Edwin Peer Signed-off-by: Michael Chan --- drivers/net/ethernet/broadcom/bnxt/bnxt.c | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c index 0da6a1138eee..f093cdd61426 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c @@ -1980,11 +1980,12 @@ static int bnxt_async_event_process(struct bnxt *bp, struct hwrm_async_event_cmpl *cmpl) { u16 event_id = le16_to_cpu(cmpl->event_id); + u32 data1 = le32_to_cpu(cmpl->event_data1); + u32 data2 = le32_to_cpu(cmpl->event_data2); /* TODO CHIMP_FW: Define event id's for link change, error etc */ switch (event_id) { case ASYNC_EVENT_CMPL_EVENT_ID_LINK_SPEED_CFG_CHANGE: { - u32 data1 = le32_to_cpu(cmpl->event_data1); struct bnxt_link_info *link_info = &bp->link_info; if (BNXT_VF(bp)) @@ -2014,7 +2015,6 @@ static int bnxt_async_event_process(struct bnxt *bp, set_bit(BNXT_HWRM_PF_UNLOAD_SP_EVENT, &bp->sp_event); break; case ASYNC_EVENT_CMPL_EVENT_ID_PORT_CONN_NOT_ALLOWED: { - u32 data1 = le32_to_cpu(cmpl->event_data1); u16 port_id = BNXT_GET_EVENT_PORT(data1); if (BNXT_VF(bp)) @@ -2031,9 +2031,7 @@ static int bnxt_async_event_process(struct bnxt *bp, goto async_event_process_exit; set_bit(BNXT_RESET_TASK_SILENT_SP_EVENT, &bp->sp_event); break; - case ASYNC_EVENT_CMPL_EVENT_ID_RESET_NOTIFY: { - u32 data1 = le32_to_cpu(cmpl->event_data1); - + case ASYNC_EVENT_CMPL_EVENT_ID_RESET_NOTIFY: if (!bp->fw_health) goto async_event_process_exit; @@ -2053,10 +2051,8 @@ static int bnxt_async_event_process(struct bnxt *bp, } set_bit(BNXT_FW_RESET_NOTIFY_SP_EVENT, &bp->sp_event); break; - } case ASYNC_EVENT_CMPL_EVENT_ID_ERROR_RECOVERY: { struct bnxt_fw_health *fw_health = bp->fw_health; - u32 data1 = le32_to_cpu(cmpl->event_data1); if (!fw_health) goto async_event_process_exit; @@ -2084,8 +2080,6 @@ static int bnxt_async_event_process(struct bnxt *bp, goto async_event_process_exit; } case ASYNC_EVENT_CMPL_EVENT_ID_RING_MONITOR_MSG: { - u32 data1 = le32_to_cpu(cmpl->event_data1); - u32 data2 = le32_to_cpu(cmpl->event_data2); struct bnxt_rx_ring_info *rxr; u16 grp_idx;