Received: by 2002:a05:7412:d8a:b0:e2:908c:2ebd with SMTP id b10csp24683rdg; Tue, 10 Oct 2023 03:12:57 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGGLn5l9yO6zc2hLOsNPuOXa6cKLbpGcIkk9lM21wvIEcpq3E7OkoKJSEK0LsB8BFfX8RsK X-Received: by 2002:a05:6a00:248b:b0:692:b539:28ff with SMTP id c11-20020a056a00248b00b00692b53928ffmr16543403pfv.24.1696932776873; Tue, 10 Oct 2023 03:12:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696932776; cv=none; d=google.com; s=arc-20160816; b=JrbzS8oExpH+iNfSfjMFTTIqMGIudx01IfTsu0Igb9oobS6kS6WAbp9uu+C5xlnmPR LiSTUmjVKemcXdUJB/IQo+aUiXCtClVFqbxiKxEYXJUvLSxjwJHjyZ5eXwdbjStr9ZpH VexN3pnD8e4ZA/kNzxZxD/AQASG1kB5mORSLDjCWWfQpYtfzemRjwJXgpoi9MnqiOfk/ STkILTRp1wFzXJDuXhGr1PwCy3q93fj+V+GVpTMQbiPfiN4oB5MhmLkiLJG5/B1ARY1D 9E6qr6appGbY8Eb2wp4YhBaV7vSY95P0mRKKNiOBGLUfm8kP2jYHmVGQN1q5l2Bumykt lc0g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=teYJaujWBCZMTxCLTD+iOO+xzJ4IWgTIsHFi/8ohCow=; fh=GpP8dusKvxeOi4AYyA9hCEMiPEh7InvT1FP9bta97gk=; b=JMg3BHw5xutcwVqXKk2+6vVo+vDCyqtattaTK7bKWf4laj0Vi15PqFPa1Romdx1Hmh QU0RF/THQRw6ovyDEiNwmYdbldpRHlbKvti5uEhJnexEZL49TTbuUT+WbQ3tuzeHqTOT S8xfNj1OoVk9MIv6X4rHJ++VpZ46O68+O6oZj4pM8rn2UusK1wH0SDeCsnmrorILlWq7 Lrm30zRFpZEkzY3zDbG394Zla1dIeEeq9KXPstdg5Xt/BeJAtmkrq0jmj4d15Qr1GF7c SMVrXTqM2G99CA49vSCQ+gkmOlI90+tKj6Wk0aPoQizd+49nnmST3W1Aao26lqnhnTFa ZTrw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ionos.com header.s=google header.b=RYELOLeF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=ionos.com Return-Path: Received: from pete.vger.email (pete.vger.email. [23.128.96.36]) by mx.google.com with ESMTPS id a19-20020a056a000c9300b00690bf904bb6si9738135pfv.307.2023.10.10.03.12.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Oct 2023 03:12:56 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) client-ip=23.128.96.36; Authentication-Results: mx.google.com; dkim=pass header.i=@ionos.com header.s=google header.b=RYELOLeF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=ionos.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by pete.vger.email (Postfix) with ESMTP id 2288E8022C10; Tue, 10 Oct 2023 03:12:54 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230284AbjJJKMq (ORCPT + 99 others); Tue, 10 Oct 2023 06:12:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42580 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229499AbjJJKMp (ORCPT ); Tue, 10 Oct 2023 06:12:45 -0400 Received: from mail-wm1-x32d.google.com (mail-wm1-x32d.google.com [IPv6:2a00:1450:4864:20::32d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 167AC94 for ; Tue, 10 Oct 2023 03:12:44 -0700 (PDT) Received: by mail-wm1-x32d.google.com with SMTP id 5b1f17b1804b1-40566f89f6eso55582365e9.3 for ; Tue, 10 Oct 2023 03:12:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ionos.com; s=google; t=1696932762; x=1697537562; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=teYJaujWBCZMTxCLTD+iOO+xzJ4IWgTIsHFi/8ohCow=; b=RYELOLeFmbycvKbS5j7pdiq+gIU9r6GKjpP7iyvoWjvStQ1zfGZenwc/gDCH0QFZp9 ToIDV1m6wE04IHsyKpRgnX3nSxj3+4mNuuMshD7dTV6nkhyyrGQyVb9RH+lVBhtRDTAA K8zkEKJ3tZl7xt61/8oNiqkLwn9/WBF59R1Pj9qy0Jm/cE8+0HNfqi+e0rJIX4xN7EEt TlUpO/Cvm7v+FlYK/6v52Zhl1rueHulPuILI+Qsl6VG5uCydU6+kFk4taaxskvA9m7dG 8aBiLhJgxZBAp3qAkwo9Bm952urWHVzu83/qWVcKQaXEiiEZ+DhdsFVTU3QI4nlABQ86 drAw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696932762; x=1697537562; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=teYJaujWBCZMTxCLTD+iOO+xzJ4IWgTIsHFi/8ohCow=; b=m4JahtydmhDaqZXKx+IFoag+mHT9XDnRuQzIl+UYT1k7S476JlkW8MP/e6dwNQlLHl ZnsiAQRY5hgYnMO55aLVMZTjleuOo77zXXMZ9XGr499Bhd/OORRxpgiM2pwYSVZJMqlr jNgLvCPQae0zxlj3vHDIcK6J8boyqLGsZoYvTeJjOyivuF1xtdebSlKskdgtQU049aj2 7svVXGXHuTTkAzrMI+BlpWqT46j/CvZnRfldNfueWCeBXuFO1E/Ru899R8+KwXlu0voR ohRe7C24R9/gWCn4lFqG73ri3bKDEwhfv2e+8Dht07oZvVKcLrVGEUjX2vBioMz5h/f1 PvAQ== X-Gm-Message-State: AOJu0YwbCkljIqUebRLvm4cz/Az0t2/WK6zLodm/QuShAV7K6iwLM5GM ifM33qHRderF6NSWokVl/hFCdg== X-Received: by 2002:a1c:6a18:0:b0:405:4a78:a892 with SMTP id f24-20020a1c6a18000000b004054a78a892mr14910939wmc.9.1696932762426; Tue, 10 Oct 2023 03:12:42 -0700 (PDT) Received: from heron.intern.cm-ag (p200300dc6f49a600529a4cfffe3dd983.dip0.t-ipconnect.de. [2003:dc:6f49:a600:529a:4cff:fe3d:d983]) by smtp.gmail.com with ESMTPSA id 1-20020a05600c230100b0040644e699a0sm15977562wmo.45.2023.10.10.03.12.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Oct 2023 03:12:42 -0700 (PDT) From: Max Kellermann To: linux@roeck-us.net, joe@perches.com, Jonathan Corbet Cc: Max Kellermann , workflows@vger.kernel.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] Documentation/process/coding-style.rst: space around const/volatile Date: Tue, 10 Oct 2023 12:12:40 +0200 Message-Id: <20231010101240.992984-1-max.kellermann@ionos.com> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=2.7 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, RCVD_IN_SBL_CSS,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on pete.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 (pete.vger.email [0.0.0.0]); Tue, 10 Oct 2023 03:12:54 -0700 (PDT) X-Spam-Level: ** 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); + Use one space around (on each side of) most binary and ternary operators, such as any of these:: -- 2.39.2