From mboxrd@z Thu Jan 1 00:00:00 1970 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.3 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_SANE_1 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 BCD6AC433B4 for ; Tue, 11 May 2021 13:48:21 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 8D7EE613E6 for ; Tue, 11 May 2021 13:48:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231602AbhEKNt1 (ORCPT ); Tue, 11 May 2021 09:49:27 -0400 Received: from szxga05-in.huawei.com ([45.249.212.191]:2562 "EHLO szxga05-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230435AbhEKNtZ (ORCPT ); Tue, 11 May 2021 09:49:25 -0400 Received: from DGGEMS401-HUB.china.huawei.com (unknown [172.30.72.60]) by szxga05-in.huawei.com (SkyGuard) with ESMTP id 4FffM52MMPzwSNl; Tue, 11 May 2021 21:45:37 +0800 (CST) Received: from [127.0.0.1] (10.174.177.72) by DGGEMS401-HUB.china.huawei.com (10.3.19.201) with Microsoft SMTP Server id 14.3.498.0; Tue, 11 May 2021 21:48:12 +0800 Subject: Re: [PATCH] net: forcedeth: Give bot handlers a helping hand understanding the code To: Andrew Lunn , Jakub Kicinski CC: netdev References: <20210511124330.891694-1-andrew@lunn.ch> From: "Leizhen (ThunderTown)" Message-ID: Date: Tue, 11 May 2021 21:48:11 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.7.0 MIME-Version: 1.0 In-Reply-To: <20210511124330.891694-1-andrew@lunn.ch> Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [10.174.177.72] X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org On 2021/5/11 20:43, Andrew Lunn wrote: > Bots handlers repeatedly fail to understand nv_update_linkspeed() and > submit patches unoptimizing it for the human reader. Add a comment to > try to prevent this in the future. > > Signed-off-by: Andrew Lunn > --- > drivers/net/ethernet/nvidia/forcedeth.c | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/drivers/net/ethernet/nvidia/forcedeth.c b/drivers/net/ethernet/nvidia/forcedeth.c > index 8724d6a9ed02..0822b28f3b6a 100644 > --- a/drivers/net/ethernet/nvidia/forcedeth.c > +++ b/drivers/net/ethernet/nvidia/forcedeth.c > @@ -3475,6 +3475,9 @@ static int nv_update_linkspeed(struct net_device *dev) > newls = NVREG_LINKSPEED_FORCE|NVREG_LINKSPEED_10; > newdup = 0; > } else { > + /* Default to the same as 10/Half if we cannot > + * determine anything else. > + */ I think it would be better to remove the if branch above and then add comments here. Otherwise, it becomes more and more redundant. > newls = NVREG_LINKSPEED_FORCE|NVREG_LINKSPEED_10; > newdup = 0; > } >