From nobody Thu Apr 2 09:13:07 2026 Received: from mail-dy1-f182.google.com (mail-dy1-f182.google.com [74.125.82.182]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A78A3391E72 for ; Mon, 30 Mar 2026 02:28:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.82.182 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774837682; cv=none; b=j7vsmvYiTjgDlErZxdJ1PYDJXeJV6kFAPd0QxIHuGta9CEV6YS3OtU8ozM7iA3k1GYpbft26ORXwmcAhbpbM/kM/R4FpL7PPE4A9ke6LrVsvxpPhUfyDRNb2zm2gi5tZ6HdLNDgyPQu2V/h54TjBrBGjDnL3xRbIBYWzi0iAzh4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774837682; c=relaxed/simple; bh=WAA48TAgXPKh6OTsM9jfu2LAkNr3B0EfohpnQi0pV2k=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=gN1tQRAcuJs1U9NOibpH7M/kpheIgK1zB91zaXXJFunw7RR/6M/ixJLMsBSolM5qDHH/OWZs7WqWBRRPf8GDMxBbVNm3cJelQa42tV2b/54zfmQB203a459opDTih2us3FTOidyjweA9F9cxmPiNFYAQocOXeLoSBFiQTQQ6E34= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=r58A0fyC; arc=none smtp.client-ip=74.125.82.182 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="r58A0fyC" Received: by mail-dy1-f182.google.com with SMTP id 5a478bee46e88-2c0c955a481so1096330eec.1 for ; Sun, 29 Mar 2026 19:28:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1774837679; x=1775442479; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=VMnha1VqvY6bmQXtBiFyEl6o1L0XqC/h5XlUXxbZCb0=; b=r58A0fyC4EgRvj1K6ixjPsSeRbJQtCpAUqcPv0FaJbb74ylmBOHQLNs+UqKJ0bUUz5 EnOYRpaGFvedeyBVMlcn7KjLQd2N886BXoGoVu+xVW+cXHzUXAvJ3pu0WOPUA7nDFtxm lzRBg3QL1ocW4Ax+X9RjzFoMV/ljkOZVRRNo1b6lE+DqnMYdcnbgH53iOrq6HKRDPRln MmoEk125io7XROzhqYvs/t8+Qzslx2VeRBCDOnyB5cHXzC8HIiy68E/C+hJ96o+gO6ot l+t3Tp1HfI2uhHU2296F2GuNpJuD6gj2axfMwkaGnoX9AHLZrBTxwMzNpp6LjK7uqYKH 7s8A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1774837679; x=1775442479; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=VMnha1VqvY6bmQXtBiFyEl6o1L0XqC/h5XlUXxbZCb0=; b=Sp0BCIq1IsQNKnsXQNyPOh3E2z4CgpR0OFHrTB/L2x3QZOXBoTzkEs1hRzN1fDqxc8 ngR9mzNlJ7aDGaWS6l9M8XzJJDo4vVyfAkfGGQSq0IxEQotug3mN9c/Dm+sZT6VdFQ5V XrzIADTzWOTSA2KDWTKr1uuJh1vRTc2tjaACPixc8m9k9Ds2FwRT20x8ssWGXNHF2Rpd hbZ8eS57QccqUWdaYPK0+rLruzXohhP8aCGExldMCqhLJmCAStlhOi9UmoEysZkHMKKR 5QpxP3pHMYjM2uPX0acGz/aen0x0VyG0/w6Qs4BgTHwtyUpyYlV2b9oMS3WI0WzWYU+c LkyA== X-Gm-Message-State: AOJu0YxUKL5TB4wXDbApdXTXPaMhPavFjr24zb+vx9vlY2GrV/YNCQh/ wUOS706eQLElzEnWk3bGGP5/LNz3rPulrp5c9VDF6+kTb3Of+2Gv7xlSU75Oag== X-Gm-Gg: ATEYQzz8oLyAzN1PTGn24kB5jYir8w0O1HndLOlWTUpSIAOLgQ4CQmXx2WoKIRJnWTn 26G5mTad0vmHYjjVvJz7uS0APeiJelNeFnxBwtqDRy/9h09kWI7u/li55JVwu9Gic57ydzKDB9x YY60FGbBc7120uwBf0kiM7m79wI6Ii7SFphPFW46vs/XtOQ6LVFZOn0M36YWfv93tRwz7ZDMURQ sJzubJbudM2hOKaJ6e3s+UrIiEpDHlchc8VuBZCNaY0Hvt2DCAk6NKca2spo/DYxUr5b2vFBEYu gFJIgH91HFTSvGGnx19qr/aNuj1uP/+C/x97PmH+oDRL9+5Tmo/Utju14F32CirQeGPg/YUW8+O UTgWjWQwPkRPgX4u7uaFq+MDhCUYrqs7wGkuxCqicsRpXviCcHNWqycUuTcUwHQivfklxEXMpuc NhDxwByy4QZMPTr+8jChue5v5RYSvm0E1pRSK/ZC35n3LBgC418YLD6EyOgY1RPPSbQZ4isve/H gMA/89uWuGsvRM= X-Received: by 2002:a05:7300:6423:b0:2c0:d9e6:7eb0 with SMTP id 5a478bee46e88-2c185e169aemr6118335eec.16.1774837679449; Sun, 29 Mar 2026 19:27:59 -0700 (PDT) Received: from dtor-ws.sjc.corp.google.com ([2a00:79e0:2ebe:8:7265:773a:8e51:c62f]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-2c3c7971d97sm6250673eec.30.2026.03.29.19.27.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 29 Mar 2026 19:27:58 -0700 (PDT) From: Dmitry Torokhov Date: Sun, 29 Mar 2026 19:27:49 -0700 Subject: [PATCH v2 2/4] software node: allow passing reference args to PROPERTY_ENTRY_REF Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260329-property-gpio-fix-v2-2-3cca5ba136d8@gmail.com> References: <20260329-property-gpio-fix-v2-0-3cca5ba136d8@gmail.com> In-Reply-To: <20260329-property-gpio-fix-v2-0-3cca5ba136d8@gmail.com> To: Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, Hans de Goede , Greg Kroah-Hartman , "Rafael J. Wysocki" , Danilo Krummrich , Andy Shevchenko , Daniel Scally , Heikki Krogerus , Sakari Ailus Cc: linux-kernel@vger.kernel.org, linux-acpi@vger.kernel.org, driver-core@lists.linux.dev X-Mailer: b4 0.15-dev-a6826 When dynamically creating software nodes and properties for subsequent use with software_node_register() current implementation of PROPERTY_ENTRY_REF is not suitable because it creates a temporary instance of struct software_node_ref_args on stack which will later disappear, and software_node_register() only does shallow copy of properties. Fix this by allowing to pass address of reference arguments structure directly into PROPERTY_ENTRY_REF(), so that caller can manage lifetime of the object properly. Signed-off-by: Dmitry Torokhov --- include/linux/property.h | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/include/linux/property.h b/include/linux/property.h index e30ef23a9af3..942657e76993 100644 --- a/include/linux/property.h +++ b/include/linux/property.h @@ -471,12 +471,19 @@ struct property_entry { #define PROPERTY_ENTRY_STRING(_name_, _val_) \ __PROPERTY_ENTRY_ELEMENT(_name_, str, STRING, _val_) =20 +#define __PROPERTY_ENTRY_REF_ARGS(_ref_, ...) \ + _Generic(_ref_, \ + const struct software_node_ref_args *: _ref_, \ + struct software_node_ref_args *: _ref_, \ + default: &SOFTWARE_NODE_REFERENCE(_ref_, \ + ##__VA_ARGS__)) + #define PROPERTY_ENTRY_REF(_name_, _ref_, ...) \ (struct property_entry) { \ .name =3D _name_, \ .length =3D sizeof(struct software_node_ref_args), \ .type =3D DEV_PROP_REF, \ - { .pointer =3D &SOFTWARE_NODE_REFERENCE(_ref_, ##__VA_ARGS__), }, \ + { .pointer =3D __PROPERTY_ENTRY_REF_ARGS(_ref_, ##__VA_ARGS__) }, \ } =20 #define PROPERTY_ENTRY_BOOL(_name_) \ --=20 2.53.0.1018.g2bb0e51243-goog