From patchwork Thu May 4 20:05:23 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Desnoyers X-Patchwork-Id: 90244 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp611647vqo; Thu, 4 May 2023 14:13:40 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7Qwa9YLZuiDfErefCLMir/4KfxnXbfuR78zCxZPYC+cK93+PeHaNiAsZefOuobFsTNEP9U X-Received: by 2002:a17:902:9b8a:b0:1a9:7e44:17 with SMTP id y10-20020a1709029b8a00b001a97e440017mr4523048plp.17.1683234820311; Thu, 04 May 2023 14:13:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683234820; cv=none; d=google.com; s=arc-20160816; b=ZbpdNx9JNdRPOlLUnbhmqnMAq64cdL1hTAtLS8k68vYAMpaIbgPau0ff2lLFmsVrOE C4SS/x/0Bx0UI23Obxe73NeXTPFfaOqCGD8f7zlAfGWhhhWvAfUmznRC8HhAKy1bpz/h DO344rTGcnYCXA9x0VNcE1IMZ6VcQkDEiDJBB3hxESzCHnb8Dp/SSB0rOTUh7UVcyLc+ zGOI10LO6EHI3F65nvvEKd7l0IQfHrOj1W0hd65jZDG9MhQxWyDbaGOHWFsN22l9tHFB EL6+YzgqmbKVr7iOlXg/22obkeEaB6r+F7w3R5DMnYgmjYR/ag1sgrPXIllbn3F/M+Rz MAMQ== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=Bubf55MzW5emAv6+LlabL3jgrNnqs2qrHUIhSugWFXg=; b=CGECY/h04LEi39c9w7O9acRZmKxzhMDepyie/tTMfniQCtC7iXMNq2h2ZPw5TKpldq tUzIwOedaX4gi/i+lG2bLHpvz1inaN1Njj3UUrC3D8fbYEvo4BxISIfauu9TnyjA+GbH Bk2wI/zsAwtSBQCI9iG5CxZsHVyt9DrcgS9Qidr/UVX+XvM+0pccliZ+ooXER2Gko0Q9 nLZN+pP4HP2hPFaHrjFZpEFnSFQldrgrVAFEGaaJzX8/c/D4OtZ1LsMWlhJfXBPPV0Jf jDq8CiH5J0a9hFEVJRQLQvRo7RM+XlESVaGhRyk9N2CT4iEInCBByXwl5JsFSWq9RBUT D7Jw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@efficios.com header.s=smtpout1 header.b=jxPC214C; 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 jb22-20020a170903259600b001a9b2c782ddsi17802543plb.176.2023.05.04.14.13.26; Thu, 04 May 2023 14:13:40 -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=jxPC214C; 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 S229959AbjEDUwR (ORCPT + 99 others); Thu, 4 May 2023 16:52:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45132 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229607AbjEDUwM (ORCPT ); Thu, 4 May 2023 16:52:12 -0400 Received: from smtpout.efficios.com (unknown [IPv6:2607:5300:203:b2ee::31e5]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A80E41982 for ; Thu, 4 May 2023 13:51:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=efficios.com; s=smtpout1; t=1683230734; bh=dJQRAkXY/sZd+jGAwjtNNNkqluNx5CFdlblILWEd/ho=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jxPC214CyqN3DWs2Lz4/8H6/dXwg9FXVbDVTrZWqDb53iOczpo8qSltyhMXsKwuUh mSGGhtlybyKW4PFy+3RZ0T4kXVvvAKZfEfsw595k3mDQC88GSyd96HZKORmxy7TUVi 4x2hGCby5njBz7+1n1eHcSfOKRHXatuQfYo+JlzLfz5vtcR0IAKJSPVydnIwfIbixw YieXJzykgzJAAgUD7XiTv1NnDBZwtM7iPetRzlC1GsbFhNJAtPtWCsvcpc+RvXvzil tAVfs5s2eRdOsvr6/BJll1vB+hBp0drnQl1WEsbZpdrfIJp6nMwYZxHksGKdNsok70 L+TBIKiWk4Ulg== Received: from localhost.localdomain (192-222-143-198.qc.cable.ebox.net [192.222.143.198]) by smtpout.efficios.com (Postfix) with ESMTPSA id 4QC4Yn75Q6z11jG; Thu, 4 May 2023 16:05:33 -0400 (EDT) From: Mathieu Desnoyers To: Andrew Morton Cc: linux-kernel@vger.kernel.org, Mathieu Desnoyers , Tejun Heo , Peter Zijlstra Subject: [RFC PATCH 09/13] klist.h: Fix parentheses around macro parameter use Date: Thu, 4 May 2023 16:05:23 -0400 Message-Id: <20230504200527.1935944-10-mathieu.desnoyers@efficios.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230504200527.1935944-1-mathieu.desnoyers@efficios.com> References: <20230504200527.1935944-1-mathieu.desnoyers@efficios.com> 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?1764999635073359425?= X-GMAIL-MSGID: =?utf-8?q?1764999635073359425?= Add missing parentheses around "_name" parameter use in KLIST_INIT(). It keeps list macros consistent, and prevents unexpected operator precedence situations, for example: struct klist a[1] = { KLIST_INIT(*a, NULL, NULL) }; Where the "." operator within KLIST_INIT() is evaluated before the "*" operator. Add missing parentheses around macro parameter use in the following patterns to ensure operator precedence behaves as expected: - "x = y" is changed for "x = (y)", because "y" can be an expression containing a comma if it is the result of the expansion of a macro such as #define eval(...) __VA_ARGS__, which would cause unexpected operator precedence. This use-case is far-fetched, but we have to choose one way or the other (with or without parentheses) for consistency. Signed-off-by: Mathieu Desnoyers Cc: Andrew Morton Cc: Tejun Heo Cc: Peter Zijlstra --- include/linux/klist.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/include/linux/klist.h b/include/linux/klist.h index b0f238f20dbb..d7e0612ca4ff 100644 --- a/include/linux/klist.h +++ b/include/linux/klist.h @@ -23,10 +23,10 @@ struct klist { } __attribute__ ((aligned (sizeof(void *)))); #define KLIST_INIT(_name, _get, _put) \ - { .k_lock = __SPIN_LOCK_UNLOCKED(_name.k_lock), \ - .k_list = LIST_HEAD_INIT(_name.k_list), \ - .get = _get, \ - .put = _put, } + { .k_lock = __SPIN_LOCK_UNLOCKED((_name).k_lock), \ + .k_list = LIST_HEAD_INIT((_name).k_list), \ + .get = (_get), \ + .put = (_put), } #define DEFINE_KLIST(_name, _get, _put) \ struct klist _name = KLIST_INIT(_name, _get, _put)