From patchwork Mon Oct 12 09:10:49 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Chan X-Patchwork-Id: 270094 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, 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 62B1BC433E7 for ; Mon, 12 Oct 2020 09:11:22 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 1D1AF214D8 for ; Mon, 12 Oct 2020 09:11:22 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.b="OmQqaV3H" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729292AbgJLJLV (ORCPT ); Mon, 12 Oct 2020 05:11:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45922 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729273AbgJLJLU (ORCPT ); Mon, 12 Oct 2020 05:11:20 -0400 Received: from mail-pf1-x442.google.com (mail-pf1-x442.google.com [IPv6:2607:f8b0:4864:20::442]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DB539C0613D0 for ; Mon, 12 Oct 2020 02:11:19 -0700 (PDT) Received: by mail-pf1-x442.google.com with SMTP id b26so12944234pff.3 for ; Mon, 12 Oct 2020 02:11:19 -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=cR27gV077Qe43s3jKK+9o+jLch3DBwZ/pJ5X76wDrf0=; b=OmQqaV3H2sk3BM6+EITQm8DJY+YTsGDQshkioUWF88z+971YouTnFrUwWg03CxZQl8 ONAUzRVWVTvvvUuzrtqOWEot3nPHMCMj2HJY6Hc886ZLo2ftjvFnAyBdXriqiP4XZkKG JNZiEuB6GjTTJpX9Uwacz7Cw3npKAhe6XTVAk= 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=cR27gV077Qe43s3jKK+9o+jLch3DBwZ/pJ5X76wDrf0=; b=q8yKKU+dpncvQXnmJ6RZJUR5mGwuAdhO7/IFk0gbAh7oIz3Tmt2xTJAvt4aWvhWRCn EU9cnCh5YOItURe0nHt1YI8a/VS+CwrfVSmVEgBzKHf5WtjK/uGeGJDKMptxGPDSpTTA JYuYiJ+pxFWeWTE82yH5H8vM4abxr7GQ8Hez6JYeXlh/f61AEv2Se8mrMJLLAgFYgerY EOB1peMAJHzoFHih3fBdHm/nDqdxvbHebKhmAe2TUTVQoElJWB1kGfwnIo7WHdWvSRan zrfArzAkXZRXYNu9+HECb4JLPogWeImi0FQu7+hXu/rWpFkx539bD/r6M0Cb3mn7MPCN m1gQ== X-Gm-Message-State: AOAM532KBvkYSEkFmN/EW7L9627MKAMGeQe58jNtbJdrEvYFu/8nAgmu y5oHmowenHQSupTElYrCXy+3fA== X-Google-Smtp-Source: ABdhPJxJmpB9wsoiG9y4nx6RLhiHcaUe7N/XgUtDtoSx7/w+135D2/bJqpFQp5mX96+OUBsOSurkCQ== X-Received: by 2002:a17:90a:1b45:: with SMTP id q63mr18283436pjq.21.1602493879265; Mon, 12 Oct 2020 02:11:19 -0700 (PDT) Received: from localhost.swdvt.lab.broadcom.net ([192.19.223.252]) by smtp.gmail.com with ESMTPSA id jy19sm1275932pjb.9.2020.10.12.02.11.18 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 12 Oct 2020 02:11:18 -0700 (PDT) From: Michael Chan To: davem@davemloft.net Cc: netdev@vger.kernel.org, kuba@kernel.org, gospo@broadcom.com Subject: [PATCH net-next v2 4/9] bnxt_en: Simplify bnxt_async_event_process(). Date: Mon, 12 Oct 2020 05:10:49 -0400 Message-Id: <1602493854-29283-5-git-send-email-michael.chan@broadcom.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1602493854-29283-1-git-send-email-michael.chan@broadcom.com> References: <1602493854-29283-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 bac1b713786c..293af0d48028 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;