From patchwork Thu May 4 20:05:14 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Desnoyers X-Patchwork-Id: 8939 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp618144vqo; Thu, 4 May 2023 14:28:16 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5WHJ0ZVMNwu4kxgJFLLY2dDW+CYzk5kCfvpz7qA2m5pHwCafllr1yVIJIGo6uh5H5spbyq X-Received: by 2002:a17:90b:4c52:b0:24d:ebf8:b228 with SMTP id np18-20020a17090b4c5200b0024debf8b228mr3360885pjb.19.1683235696167; Thu, 04 May 2023 14:28:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683235696; cv=none; d=google.com; s=arc-20160816; b=v/QgsLnuioNbKyUHW2F0gULXaUTdCcP1JWg7Ct+n94Lb7ylasmZdZLZhOkPtrJ+Och DB8dU1Q5uZNqmTyma2Ff3QABsRFIO8EIb3h0KPYRtJDO8dP9r8+X4yA+fURgP+dJDoIa CC3wYZVfwF3F9nC+4+7HE7SGph1wNmnA0lmSFbBBKrZVtIy+VRmJyfgcY0veHUw6weQl ZR3NNBqGHOELoj61gaUCifuRb6Wx62xYSfur3xIIZ5sC4UlKdiZG+rnR5Ubp+zA4q4I1 JT2hiHNCZjY9Dx3x4h0nU633wz6Bg+Bay4rxxxEG9xctzIWUivtJtMFbBlLSEiwVD+Fl lb8g== 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=uO0m4FG3s35cNHWZBjmySEcB/3MVws/Ah4eIz4TfI/c=; b=Zih5oRqO51T4ZKJ4/I/2XuIugGxxffFSmm1DeWIf4NWdMniDyrPDzuK4hlCQEokh6K DL7j5CbDuGzI5eKeR5ap58khynuiwg1YtnVjjGcGW0/c/lpaqx6ZUwSBUD6gDUCLye78 R+Yv89hggW4Xk33W+5/wWPuY9o0msT3qE0j63J2bb1G5yWW7vxOMG+0accM2rG3ysSDI Du8RJRkKKO992Wfi1rbnzWgfBBVuq63Suu2xlIQlJHTQrsY1AedNasONTOt82uUSiuDS l3QWiN2L+/Bo50W22KXu2ilKu0DFkFoNX82qREncjQ7OndzBQhGvGKZjZsR9xi0CRpmX KVBA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@efficios.com header.s=smtpout1 header.b="D/0V0zXY"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=efficios.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c19-20020a637253000000b0050f77f03312si262409pgn.853.2023.05.04.14.27.51; Thu, 04 May 2023 14:28:16 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@efficios.com header.s=smtpout1 header.b="D/0V0zXY"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=efficios.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230140AbjEDVBn (ORCPT + 99 others); Thu, 4 May 2023 17:01:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57678 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230334AbjEDVBS (ORCPT ); Thu, 4 May 2023 17:01:18 -0400 Received: from smtpout.efficios.com (unknown [IPv6:2607:5300:203:b2ee::31e5]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F058B13851 for ; Thu, 4 May 2023 14:00:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=efficios.com; s=smtpout1; t=1683230731; bh=YaLjMlY2AXAxdGceepfOSLT5QLDQ8cu212pZLfriISQ=; h=From:To:Cc:Subject:Date:From; b=D/0V0zXYaNb9nrKChDCVLoBh2h5eCF6chN0tYXXfZxU/j76WxLbKEw+sHbWBiX3cQ QE5nbsdxOZrxXk5FHL9Qh6CNqIFuLe6ckJypK+99xmz/ioWPfVktmwU5lnffNH32vi WBRyryqGBoDd+WmWbsqZAr/KbNTbo1apjyStXlR3deLlwfPQ/wkUfEpJ1dQz64g+sh /sBJM9fBoYbG4mS/VgCbkZqA61QJU/e8y4yzloy2voh1Y/J3c1FRJQ0RhPEAe0lMRt wbe2vHoBxM7RcuL6DcK3cc8KgOIub2E05T+MdxPGSg5f2gCiOIdxecmAhP8KK4rSiA HmBRySTG7BHGA== Received: from localhost.localdomain (192-222-143-198.qc.cable.ebox.net [192.222.143.198]) by smtpout.efficios.com (Postfix) with ESMTPSA id 4QC4Yl4YNTz122b; Thu, 4 May 2023 16:05:31 -0400 (EDT) From: Mathieu Desnoyers To: Andrew Morton Cc: linux-kernel@vger.kernel.org, Mathieu Desnoyers Subject: [RFC PATCH 00/13] Fix parentheses around macro parameter use in headers Date: Thu, 4 May 2023 16:05:14 -0400 Message-Id: <20230504200527.1935944-1-mathieu.desnoyers@efficios.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RDNS_NONE,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=no 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-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1765000553435506980?= X-GMAIL-MSGID: =?utf-8?q?1765000553435506980?= I tried to look at various list and list user headers in the kernel tree to figure out what the proper parentheses pattern should be around macro parameter use for new code, and it turns out that the current code base lacks consistency. This is not an exhaustive change of all public kernel headers, but at least it is a start, updating those which are implementing or using kernel lists. The basic rules followed here are: - Use parentheses around arguments which are rvalues, except when those are expressions between commas "," used as arguments to functions or other macros, or surrounded by brackets "[]". - Do not use parentheses around arguments which are lvalues. For consistency, when a macro argument is used both as an lvalue and as an rvalue within the macro, use the parentheses rules applying to each of the context: with parentheses for rvalue, without parentheses for lvalue. Mathieu Desnoyers (13): rcu: rcupdate.h: Fix parentheses around macro parameter use rculist.h: Fix parentheses around macro pointer parameter use rculist_nulls.h: Add parentheses around macro pointer parameter use rculist_bl.h: Fix parentheses around macro pointer parameter use list.h: Fix parentheses around macro pointer parameter use list_nulls.h: Fix parentheses around macro pointer parameter use list_bl.h: Fix parentheses around macro pointer parameter use llist.h: Fix parentheses around macro pointer parameter use klist.h: Fix parentheses around macro parameter use resource_ext.h: Remove useless parentheses around macro parameters netdevice.h: Fix parentheses around macro parameter use blk-mq.h: Fix parentheses around macro parameter use bio.h: Fix parentheses around macro parameter use include/linux/bio.h | 22 +++++++------- include/linux/blk-mq.h | 38 ++++++++++++------------ include/linux/klist.h | 8 +++--- include/linux/list.h | 54 +++++++++++++++++------------------ include/linux/list_bl.h | 12 ++++---- include/linux/list_nulls.h | 8 +++--- include/linux/llist.h | 14 ++++----- include/linux/netdevice.h | 12 ++++---- include/linux/rculist.h | 28 +++++++++--------- include/linux/rculist_bl.h | 6 ++-- include/linux/rculist_nulls.h | 4 +-- include/linux/rcupdate.h | 46 ++++++++++++++--------------- include/linux/resource_ext.h | 6 ++-- 13 files changed, 129 insertions(+), 129 deletions(-)