Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp3035693pxf; Sun, 28 Mar 2021 09:22:00 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwPUqmvGDRjh9+1XJQvnsEOnOQQdb3qPouehDbubq6W208gDnyNdSv/T7ez6Mzaj75EV+IO X-Received: by 2002:a05:6402:4395:: with SMTP id o21mr24497613edc.22.1616948520125; Sun, 28 Mar 2021 09:22:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1616948520; cv=none; d=google.com; s=arc-20160816; b=kWV0Fw4/zC07ZPBeD3ieS+PWMCgqn2QBBLdolvVV3+/ewGDkCRv2C2DW48mc6eUx3U hUCg4K2v9CQT+OiUJ2Y1KkVkTJoD+oeib4WK+ozJSj6Uvn39AFZ/OvL2FeiGNTRzALOZ QFnSO6SF/0Ps/GgS5JkVvs4rWRhF6FJhzCbNG6xBbXWoKQCPuHgc2bD5nVfZN2RYAdey Uxlt9hA/X0++4ecExD7yo0wG4MGOf5vx2bw1vQUU7SVvPOroj4aCZRg5AEqBTdWH00Tq 976ciWGwtz/VjlsUXZXjLDTi5PU1dPyHoedtlnxujkwyPmGTuhR9uF2jbND0xXsKlgaH u51A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:dkim-signature; bh=GJZppRAaG51+5xCQGxJDbiT+rib+B0Hn9tDagEpn2g4=; b=c1hx+AiGy91rZy5mIBx/GFkSWhfistNmTbsp0l+w/wXrOy5dfJ5OilR1V3FBrGWBCG rJHNsGVqq/B45H6LaPIna5ZIfcKSw4H13xZHvX7o7ysf4FivX77LbTQbX7nwRVSeLOnP rbtsFDkLi0bERUJgAUepm/XRsFiqKTNChQR8QIK9/rqwe7tDxqEXli/2xyCclhrlTc47 fMqEApAljHTrHLszdr+9w7ly+yOqn4nDTKDmKl5yorspSIYCL1o1EGma3zqS2lUisHen +8WUSR1VNf3VPpEVhOquZ3payNEGv0kB+6jp6bCk/I9sem4GYXqlh7mkVRXipuddjiZF brcQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=nfARpzp6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id o6si13710711edi.504.2021.03.28.09.21.37; Sun, 28 Mar 2021 09:22:00 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=nfARpzp6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230196AbhC1QQ4 (ORCPT + 99 others); Sun, 28 Mar 2021 12:16:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39768 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230294AbhC1QQj (ORCPT ); Sun, 28 Mar 2021 12:16:39 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 00D96C061756 for ; Sun, 28 Mar 2021 09:16:38 -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=GJZppRAaG51+5xCQGxJDbiT+rib+B0Hn9tDagEpn2g4=; b=nfARpzp6MFeIeyjK6VX/SKjb1K SCm2OQ1w8xXfQtSJZYj63yUky7+187ES2bZZ8kaG1wqr1y7PlMwJNP29JIBrQeLWyflLUxfVj+GQl FIIWN/q4mtGlJx076MyjcD0SVyS++WrMANozYfMmFje0ytHOvT3xDc5Zfw50wRn6T2lBy4Lm/Dsga SDgOTBFTdEwE8pKbDUW8daxQtJMEpWuLIKBt921npx/fkp3l5jbtoNTPe8SO88Kxiriiozhij1Ihp iJoUgomoNYmbALvWbwhMEro8O8NspLU76fCEldik0M9ckS7WurQ68iBKJKk58sobEyL+S0tgICmjY LLQQ7ZAQ==; Received: from [2601:1c0:6280:3f0::4557] by casper.infradead.org with esmtpsa (Exim 4.94 #2 (Red Hat Linux)) id 1lQY5Y-000GDm-30; Sun, 28 Mar 2021 16:16:34 +0000 Subject: Re: [PATCH] kconfig: nconf: stop endless search-up loops To: Joe Perches , 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> <362edad0-daea-1f56-bed3-b1df174cbbf1@infradead.org> <6caae542c6f295a47b1012738b3b35055cf17cc4.camel@perches.com> From: Randy Dunlap Message-ID: <027ce5a1-cc48-3f79-fc05-bb587a9e86b1@infradead.org> Date: Sun, 28 Mar 2021 09:16:27 -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: <6caae542c6f295a47b1012738b3b35055cf17cc4.camel@perches.com> 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/28/21 3:32 AM, Joe Perches wrote: > On Sat, 2021-03-27 at 15:26 -0700, Randy Dunlap wrote: >> 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) && > > Negative values aren't parsed well by the silly script as checkpatch > isn't a real parser. Yes, I get that. > Basically, checkpatch only recognizes positive ints as constants. OK, good to know. > So it doesn't recognize uses like: > > a * -5 > b > > It doesn't parse -5 as a negative constant. > > Though here it does seem the line with > $to !~ /^(?:Constant|[A-Z_][A-Z0-9_]*)$/ && > should be > $to !~ /^(?:$Constant|[A-Z_][A-Z0-9_]*)$/ && > > You are welcome to try to improve checkpatch, but it seems non-trivial > and a relatively uncommon use in the kernel, so I won't. I get that too. > Most all of the existing uses seem to be in drivers/scsi/pm8001/pm8001_hwi.c [snip] thanks. -- ~Randy