From nobody Wed Feb 11 20:55:47 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id ACA86C7EE22 for ; Thu, 4 May 2023 20:52:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230100AbjEDUwS (ORCPT ); Thu, 4 May 2023 16:52:18 -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 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" 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] =3D { 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 =3D y" is changed for "x =3D (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 *)))); =20 #define KLIST_INIT(_name, _get, _put) \ - { .k_lock =3D __SPIN_LOCK_UNLOCKED(_name.k_lock), \ - .k_list =3D LIST_HEAD_INIT(_name.k_list), \ - .get =3D _get, \ - .put =3D _put, } + { .k_lock =3D __SPIN_LOCK_UNLOCKED((_name).k_lock), \ + .k_list =3D LIST_HEAD_INIT((_name).k_list), \ + .get =3D (_get), \ + .put =3D (_put), } =20 #define DEFINE_KLIST(_name, _get, _put) \ struct klist _name =3D KLIST_INIT(_name, _get, _put) --=20 2.25.1