Received: by 2002:a05:6a10:413:0:0:0:0 with SMTP id 19csp977831pxp; Wed, 16 Mar 2022 23:15:22 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzafqI5PAV4PWJJZ8jHhC1ae22cDyVmZvxCfxZ34vu+AxMSVXWmeVreTtcO/lfjH8nX2qWR X-Received: by 2002:aa7:830f:0:b0:4f9:ff96:daf7 with SMTP id bk15-20020aa7830f000000b004f9ff96daf7mr3218023pfb.6.1647497722536; Wed, 16 Mar 2022 23:15:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1647497722; cv=none; d=google.com; s=arc-20160816; b=Q9mbFKo8BacD1Yj2YDbGMU0rjLqCayFkiNcA4P1LE4h1xplgujSjcXzrDRKBnOj6w5 XPlcjB1pUVDugw+pjvm3olO+eLT01Ir+ZJyUR2tmcut5/WFQ+FUPzXFxHRpijWBdd+7D jVebuhi+K21ZPp8OnaockCCLapg2QgdzCCSphgX2H1iKed6vNr9ja0au+OWhUnph4ws/ PuQ2u718J+/EgTIptGToH6Kva+k6HNWwIbv+UkWLk5U/IV0Oqk9iH8zBGjw4fgeQImNY 6BQtFihvvj6B4GVC7uR74d2RJ0SWDPtTd6/3bjbHVSEqK70rxiXmz22lPw6DFZwYlOMm 9n8Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:feedback-id:content-transfer-encoding :mime-version:message-id:date:subject:cc:to:from; bh=AYciOhdiC1PIZmYf9ffaInA2anThtpZ5lUZbfO0bVhA=; b=0ZviURBLYeo95rYvO8W3jjEWyGVkXezb64/kBQxQF81rnp2n31Qrb3sLH7PCOFL/ck Mej2k6kERJg6AOizkP/hv8dqQ481927v73nVg9lwrclYRKcOyfQcRYQlOidFVEzkpusb SagafASumo7tAiLK2LBXs6dY1loRK2xtADJcasl9i0qwtVmWwBX+0VOSvvoZzrRnaQkT vxb5+4DtvLYL8zOVJb1QxEaqBn0C1fbbLkcwNxGuwlHZc6SbCT1tAQ1NSauipRAm2Lqe UtFpV8/6Eu6FwxLZcrwQRDGOv5hwoytz0dv5kkhLdDxYruI9u/ojF7l9UDo53OYKWPsy IpbA== ARC-Authentication-Results: i=1; mx.google.com; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id d18-20020a634f12000000b003816043ee64si1155282pgb.89.2022.03.16.23.15.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Mar 2022 23:15:22 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 9A185F61E3; Wed, 16 Mar 2022 21:58:27 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345647AbiCOHwC (ORCPT + 99 others); Tue, 15 Mar 2022 03:52:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55936 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232675AbiCOHwA (ORCPT ); Tue, 15 Mar 2022 03:52:00 -0400 Received: from smtpbg153.qq.com (smtpbg153.qq.com [13.245.218.24]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CD16E12AD8 for ; Tue, 15 Mar 2022 00:50:47 -0700 (PDT) X-QQ-mid: bizesmtp65t1647330599t5jaxgpj Received: from localhost.localdomain ( [58.240.82.166]) by bizesmtp.qq.com (ESMTP) with id ; Tue, 15 Mar 2022 15:49:53 +0800 (CST) X-QQ-SSF: 01400000002000D0H000B00A0000000 X-QQ-FEAT: F3yR32iATbgMpCjbikc3BWSKeichddKAGID8W5xikXF3OmtDM7BGzcFt33YO1 Bl123JlrOMf2XGDP9jYKyTX29QEBr4qU+cbjYb4/z1x0YZy/OElwmyMj2wsE83OekJNjX5l XGt4Nl59hWdWuqD2ExSFSrRrRQtDOpcdCi5x4Ng4pSqUK6ouzIr21OVYcXlmE7cabFs6C2i jHkeROi0AC6KMwhqqCJc9Wte26kq4GfGBPfojflnUxlqZ+eT3J23mVzwpoKqnXiGrt3+Gjh WuE2onOmnqJugzMoXfC+Bcw6Q6sdzxXSnt/5Bg87rIh2f4YcY5BknCME4LinZD0a/eoUHXL OjFo53XoCpiuXJYo4CM+4x1zgxrL21PgTDttKSX X-QQ-GoodBg: 2 From: Meng Tang To: davem@davemloft.net, kuba@kernel.org Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Meng Tang Subject: [PATCH] net: tulip: de4x5: Optimize if branch in de4x5_parse_params Date: Tue, 15 Mar 2022 15:49:52 +0800 Message-Id: <20220315074952.6577-1-tangmeng@uniontech.com> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-QQ-SENDSIZE: 520 Feedback-ID: bizesmtp:uniontech.com:qybgforeign:qybgforeign2 X-QQ-Bgrelay: 1 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org In the de4x5_parse_params, 'if (strstr(p, "BNC_AUI"))' condition and 'if (strstr(p, "BNC_AUI"))' condition are both execute the statement 'lp->params.autosense = BNC', these two conditions can be combined. In addition, in the current code logic, when p = "BNC", the judgments need to be executed four times. In order to simplify the execution process and keep the original code design, I used the statement which is 'if (strstr(p, "BNC") || strstr(p, "BNC_AUI"))' to deal with it, after that once 'strstr(p, "BNC")' is established, we no longer need to judge whether 'strstr(p, "BNC_AUI")' is true(not NULL). In this way, we can execute the judgment statement one time less. Signed-off-by: Meng Tang --- drivers/net/ethernet/dec/tulip/de4x5.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/net/ethernet/dec/tulip/de4x5.c b/drivers/net/ethernet/dec/tulip/de4x5.c index 71730ef4cd57..5900b8ef7f6f 100644 --- a/drivers/net/ethernet/dec/tulip/de4x5.c +++ b/drivers/net/ethernet/dec/tulip/de4x5.c @@ -5208,9 +5208,7 @@ de4x5_parse_params(struct net_device *dev) lp->params.autosense = TP_NW; } else if (strstr(p, "TP")) { lp->params.autosense = TP; - } else if (strstr(p, "BNC_AUI")) { - lp->params.autosense = BNC; - } else if (strstr(p, "BNC")) { + } else if (strstr(p, "BNC") || strstr(p, "BNC_AUI")) { lp->params.autosense = BNC; } else if (strstr(p, "AUI")) { lp->params.autosense = AUI; -- 2.20.1