Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp27718rwr; Thu, 4 May 2023 14:17:56 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4yMVzysVCzoQ5zxfzuihj2nvNpaLvaQzlbLkdzUSAEEHIZAEMykZW6r+vdy+wtDby1N2Sd X-Received: by 2002:a05:6a00:134b:b0:643:9df7:edaa with SMTP id k11-20020a056a00134b00b006439df7edaamr256508pfu.33.1683235075946; Thu, 04 May 2023 14:17:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683235075; cv=none; d=google.com; s=arc-20160816; b=emwh8uxXGTL9UK9PeAv98Gbgirxlj3X8o60AMweWh8xS43BDMi8lAYopmN109hXhz6 bTB0Hv51islPYJZdo1n47AYgBd766tyJApyU/9yaaRxaysyyK8iXFfvwlxMnGY8iiaav TqoL9e9fxRH160819b6r/yML3yN7NJpq89P5ETvEiO7o+nf3rg8SfnkZMbZXhnM9kcZ2 jOuasC2kp7Y1NSUQtgdzcpLJC7dD6u3194zvDlW2nsrNRw66o8JZKWS8oRfj/H/+JTIJ xeuxuxSPcFrXv/itQIOu6GZJYMNM5YLlBEe5fdXiR7km6t7FpCtvZOew/z645OZUi83p Lagw== 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b126-20020a62cf84000000b0063b77e2123csi363997pfg.26.2023.05.04.14.17.40; Thu, 04 May 2023 14:17:55 -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 S229947AbjEDUwR (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 Content-Transfer-Encoding: 8bit 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 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) -- 2.25.1