Received: by 2002:a05:7412:d8a:b0:e2:908c:2ebd with SMTP id b10csp66339rdg; Tue, 10 Oct 2023 04:37:05 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHyiRs6HFuvUdC70SSGKJih/jwVSaNFWvCY2oYOzyf7qJN34KG3zLpiQYlFl6XQ/JWaUfkl X-Received: by 2002:a05:6e02:cab:b0:357:3cdf:fd77 with SMTP id 11-20020a056e020cab00b003573cdffd77mr838888ilg.9.1696937825280; Tue, 10 Oct 2023 04:37:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696937825; cv=none; d=google.com; s=arc-20160816; b=ZKd6I2dsoIGLYbHuXQBt1AmEV1HojTPihjncX9CJPGW1AE3TvdWUT3juMBOwLTXg+v l9qm+I5vN++8tZbFF+viPI7vCFi/ybgZeAUMoTrjgCE94j5alEsbe6mLl8RIsQlbFqiZ xqFsbNSKADurt6GL/I5LL2GbYgKXv8O3tCnSdc7G05+BIAMOTBD5+GdEb5GgE/pkdyjU weco++IdzKosfPrkjussCpPWpN9UfwgjsmDggqSzvXpUEMW9HLdO0HFylg5F53HpzkZy prjDnPvMhploMmlsfLvwDXRHVrWTFF5wrMOV2QAy1W6L+uJ33dpafg1UdBQ7rTk2240E u91g== 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=zGXmFYa3zBn+b8V6dAAUs9ebwQSPIEfcCX3jMvtD3us=; fh=B9OehVzqs9CKf/ekQbaf3vjAiPsgNId4NJkXSq5UH+A=; b=tqkWPPuBNv1ag/XFUs02RJT00PdQVpgobEmnIuH8vP8mg4mebjU1Slz9tNsuKg6tDE E3qHK9L29l4BPwDiQeU4yvQ56Q6akKLm9kvyYDHQc+CQkLRG87zqDJLSnRs62AEWCgIQ lxBrSpXolf92WoBekxxohFkTqkwA7ocn2Zkpx1YlyRdIKzWFjBWBXI2zwJYRcAlLmIon Tsx0QrIjq9Qh0+oma4zFwRXGHOE+jdPecJxPMhYq+XQW6KWlPVSU4MpxT5e4E7/hBHSp naU4AFmKlbHGAQpTh5FJbt4T67G2orR0Ry9NDGNUMGOABGf14HdDd0lH76FbodvYkF9G xGSg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=VrtQM7gP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 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 snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id s17-20020a639251000000b005898ed1915bsi9140627pgn.460.2023.10.10.04.37.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Oct 2023 04:37:05 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=VrtQM7gP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 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 snail.vger.email (Postfix) with ESMTP id 23145815960C; Tue, 10 Oct 2023 04:37:04 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231236AbjJJLhA (ORCPT + 99 others); Tue, 10 Oct 2023 07:37:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42838 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229921AbjJJLg7 (ORCPT ); Tue, 10 Oct 2023 07:36:59 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AC32FA4; Tue, 10 Oct 2023 04:36:57 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E7F79C433C8; Tue, 10 Oct 2023 11:36:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1696937817; bh=kphcprxqB/I3b9pJ6JxA57GWF1FA2S/khI6Dosf5Juo=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=VrtQM7gPxLsbazqeFCEYj5U/iKZxPu0aoABRwuxOTuYHPP3FMwEEgn/RBRPw8zMO+ +K6X6VnQueWZtZpld6PeEsIdcBaJ9C1ThIEYgLc7Bkf2uodj+R3TgAQnZXfQdofQro ZV++fy2u90Plf1Wps+1fJjUnzd06h9GsL1fRPMzo= Date: Tue, 10 Oct 2023 13:36:54 +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] Documentation/process/coding-style.rst: space around const/volatile Message-ID: <2023101025-bungee-carve-2b4b@gregkh> References: <20231010101240.992984-1-max.kellermann@ionos.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20231010101240.992984-1-max.kellermann@ionos.com> X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham 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 X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Tue, 10 Oct 2023 04:37:04 -0700 (PDT) On Tue, Oct 10, 2023 at 12:12:40PM +0200, Max Kellermann wrote: > There are currently no rules on the placement of "const" and > "volatile", but a recent code submission revealed that there is > clearly a preference for spaces around them. > > 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 > --- > Documentation/process/coding-style.rst | 12 ++++++++++++ > 1 file changed, 12 insertions(+) > > diff --git a/Documentation/process/coding-style.rst b/Documentation/process/coding-style.rst > index 6db37a46d305..b40830517938 100644 > --- a/Documentation/process/coding-style.rst > +++ b/Documentation/process/coding-style.rst > @@ -271,6 +271,18 @@ adjacent to the type name. Examples: > unsigned long long memparse(char *ptr, char **retptr); > char *match_strdup(substring_t *s); > > +Use space around the keywords ``const`` and ``volatile`` (except when > +adjacent to parentheses). Example: > + > +.. code-block:: c > + > + const void *a; > + void * const b; > + void ** const c; > + void * const * const d; > + void * volatile e; > + int strcmp(const char *a, const char *b); Don't encourage the use of volatile please, it shouldn't be needed in kernel code (hint, almost all uses of it in the tree is wrong except for asm statements and some .h files that know they need it for some hardware operations.) thanks, greg k-h