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=-7.3 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=no 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 ECAB9C433C1 for ; Sat, 27 Mar 2021 22:27:38 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B6FA7619B4 for ; Sat, 27 Mar 2021 22:27:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230501AbhC0W1G (ORCPT ); Sat, 27 Mar 2021 18:27:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37922 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230514AbhC0W0u (ORCPT ); Sat, 27 Mar 2021 18:26:50 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B2566C0613B1 for ; Sat, 27 Mar 2021 15:26:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:Content-Type: In-Reply-To:MIME-Version:Date:Message-ID:From:References:Cc:To:Subject:Sender :Reply-To:Content-ID:Content-Description; bh=X6K9dDfiPk2z/NpuiKCPto3h86VCspjXOpVOyrJGiCs=; b=nTb6S/Ek8XQdnkzYBLhAqXSVdQ md360J+0TGdSUWhPfHXH4wY1yJWuSsA2Z5elcg1+l7ii87J12TEXlUzLva5gztRYX7R4vIVhTKL7S YaRyQXKBvfCaMvBy13jGVxqj5alL8lU1QdVDm0ESBeqmA4Y7Dq4junZKdQrdI6BHan2ihAwfMce+s hvgJP7sXJSRCaNyzh2fFAOWLXSQeEP251ZP4xQIrsZUO4ZnVtcFLYmjDNWKcLTZF5Xt3XamJC5oBw 6KWkqdo+1+yTbtRxkLKyqpGykq2jONAo7rH+bedTEKln21Hb967IGr7Xz2/rCRN7lGBq1NpYWgQqe tWOVn54A==; Received: from [2601:1c0:6280:3f0::4557] by casper.infradead.org with esmtpsa (Exim 4.94 #2 (Red Hat Linux)) id 1lQHOF-00H8UQ-D3; Sat, 27 Mar 2021 22:26:47 +0000 Subject: Re: [PATCH] kconfig: nconf: stop endless search-up loops To: Mihai Moldovan , Masahiro Yamada Cc: linux-kernel@vger.kernel.org References: <20210327120155.500-1-ionic@ionic.de> <1ca3a90f-799e-d917-370e-1475e33cdb14@infradead.org> <111c5853-e488-0aaa-18e9-36792b648427@ionic.de> From: Randy Dunlap Message-ID: <362edad0-daea-1f56-bed3-b1df174cbbf1@infradead.org> Date: Sat, 27 Mar 2021 15:26:38 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.8.0 MIME-Version: 1.0 In-Reply-To: <111c5853-e488-0aaa-18e9-36792b648427@ionic.de> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 3/27/21 3:12 PM, Mihai Moldovan wrote: > * On 3/27/21 4:58 PM, Randy Dunlap wrote: >> On 3/27/21 5:01 AM, Mihai Moldovan wrote: >>> + if ((-1 == index) && (index == match_start)) >> >> checkpatch doesn't complain about this (and I wonder how it's missed), but >> kernel style is (mostly) "constant goes on right hand side of comparison", >> so >> if ((index == -1) && > > I can naturally send a V2 with that swapped. > > To my rationale: I made sure to use checkpatch, saw that it was accepted and > even went for a quick git grep -- '-1 ==', which likewise returned enough > results for me to call this consistent with the current code style. > > Maybe those matches were just frowned-upon, but forgotten-to-be-critized > examples of this pattern being used. There is a test for it in checkpatch.pl but I also used checkpatch.pl without it complaining, so I don't know what it takes to make the script complain. if ($lead !~ /(?:$Operators|\.)\s*$/ && $to !~ /^(?:Constant|[A-Z_][A-Z0-9_]*)$/ && WARN("CONSTANT_COMPARISON", "Comparisons should place the constant on the right side of the test\n" . $herecurr) && cheers. -- ~Randy