Received: by 2002:a05:7412:d8a:b0:e2:908c:2ebd with SMTP id b10csp361164rdg; Tue, 10 Oct 2023 12:26:19 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFHqo0OrDfAD9jVycBcgEaoA6lvbxKysYcdiZeKhLkFvKjCtweK+GMhn9WxMWacw9zKMUO3 X-Received: by 2002:a17:902:d702:b0:1c5:f4c7:b4e4 with SMTP id w2-20020a170902d70200b001c5f4c7b4e4mr15671920ply.39.1696965979236; Tue, 10 Oct 2023 12:26:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696965979; cv=none; d=google.com; s=arc-20160816; b=D/ihNFC6C/vQgoK1ZCT5nWaDv80bnefK8NZG9ANnWJlCoSp3v8D4/KyjjhvqF3dAcu ImKwD37uFL2UC7SL1mah06MChiAjLrY+4wUn7yyioCusaMH01Kksy9S8qZlTi5+3SwkI pAyGOk/E8cf7UneXCpZnTzd5rkI4L0PXo1hnqKhsyGGrKKx9B/SJs3JSwvNGZGrgqft0 Gt7WBB8DjS/ovlRK8ijMihECXjJISKHD7AWEH898qd0dEIw7kSn5MVX3RVc8NKu5b/CF +xRAsLkTn8ShobJuh5h6Hiq5FJlfz2OqcLK/B/FEC/6vBMtjOTF1Nb3fPo/cxBjV+Nu+ A5Gg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=zvxy1GIwUWnURrGU3fnOCO003Q8bpxSoKlhFVERwUt4=; fh=B9OehVzqs9CKf/ekQbaf3vjAiPsgNId4NJkXSq5UH+A=; b=nLIoF3x1us61vvkP9jLPPgzrQFbe1ecyIrmlwmo1loYjGyY6C/jdZ9B3yadXdo64jC AKbK7aY8KWrbaL325p4IutO2wGNP40rfrDYTlhFJ6NunjV45aU/xZG8GJNUvvw8hyjH4 +2M+wTUfTAwzX4oFrZJdYpyqj1FP+p/anHdoa8kVHktROPqvsWOQwSigIXTDcjPGXdj8 LsC+VrbG/H1VLxDdEFW4BaYEG5uI46+Rmlf4ys1ZdHzVD5vFR8YHJiJOWw0rOrrCRKzz n4dzGeXcrzrEWOFtrF2Y3idLOUXA1N9GFlVvE0yxSuyk39MAsXhCJ6KgrdI7lZohudD0 mHeA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=DzH52Z7a; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from morse.vger.email (morse.vger.email. [23.128.96.31]) by mx.google.com with ESMTPS id ks7-20020a170903084700b001bc8a9f5e52si12243224plb.135.2023.10.10.12.26.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Oct 2023 12:26:19 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) client-ip=23.128.96.31; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=DzH52Z7a; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by morse.vger.email (Postfix) with ESMTP id A88018099888; Tue, 10 Oct 2023 12:26:16 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343926AbjJJT0I (ORCPT + 99 others); Tue, 10 Oct 2023 15:26:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54774 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234473AbjJJTZz (ORCPT ); Tue, 10 Oct 2023 15:25:55 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9A617D6C; Tue, 10 Oct 2023 12:24:30 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 960DDC433C9; Tue, 10 Oct 2023 19:24:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1696965870; bh=OaUT113OyEWZGUuz0QanPBBQlM+TNKNCSR8UWh97s4g=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=DzH52Z7aff0PLm//rj5X1M7cPqIlNkK7SLMktoACnl6QnQWNaa0dU6ixCQEV0y5oM +r6Yl/2FrXGlupfrbBNdkztXv//SemcHc57So/T85eOqDdtEvu2nesyD/PF4T2kKBJ 6zIDgoLhWG3ilgaPqEsqUCmIvJq5SkCsQef7P0d0= Date: Tue, 10 Oct 2023 21:24:27 +0200 From: Greg KH To: Max Kellermann Cc: linux@roeck-us.net, joe@perches.com, Jonathan Corbet , workflows@vger.kernel.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v3] Documentation/process/coding-style.rst: space around const Message-ID: <2023101018-eggnog-unsavory-1ba6@gregkh> References: <20231010125832.1002941-1-max.kellermann@ionos.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20231010125832.1002941-1-max.kellermann@ionos.com> X-Spam-Status: No, score=2.7 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_SBL_CSS,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on morse.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (morse.vger.email [0.0.0.0]); Tue, 10 Oct 2023 12:26:16 -0700 (PDT) X-Spam-Level: ** On Tue, Oct 10, 2023 at 02:58:31PM +0200, Max Kellermann wrote: > There are currently no rules on the placement of "const", but a recent > code submission revealed that there is clearly a preference for spaces > around it. > > checkpatch.pl has no check at all for this; though it does sometimes > complain, but only because it erroneously thinks that the "*" (on > local variables) is an unary dereference operator, not a pointer type. > > Current coding style for const pointers-to-pointers: > > "*const*": 2 occurrences > "* const*": 3 > "*const *": 182 > "* const *": 681 > > Just const pointers: > > "*const": 2833 occurrences > "* const": 16615 > > Link: https://lore.kernel.org/r/264fa39d-aed6-4a54-a085-107997078f8d@roeck-us.net/ > Link: https://lore.kernel.org/r/f511170fe61d7e7214a3a062661cf4103980dad6.camel@perches.com/ > Signed-off-by: Max Kellermann > --- > V1 -> V2: removed "volatile" on gregkh's request. > V2 -> V3: moved patch changelog below the "---" line > --- > Documentation/process/coding-style.rst | 11 +++++++++++ > 1 file changed, 11 insertions(+) > > diff --git a/Documentation/process/coding-style.rst b/Documentation/process/coding-style.rst > index 6db37a46d305..71d62d81e506 100644 > --- a/Documentation/process/coding-style.rst > +++ b/Documentation/process/coding-style.rst > @@ -271,6 +271,17 @@ adjacent to the type name. Examples: > unsigned long long memparse(char *ptr, char **retptr); > char *match_strdup(substring_t *s); > > +Use space around the ``const`` keyword (except when adjacent to > +parentheses). Example: > + > +.. code-block:: c > + > + const void *a; > + void * const b; > + void ** const c; > + void * const * const d; > + int strcmp(const char *a, const char *b); > + > Use one space around (on each side of) most binary and ternary operators, > such as any of these:: > > -- > 2.39.2 > Reviewed-by: Greg Kroah-Hartman