From nobody Thu Oct 9 10:52:48 2025 Received: from mail-pf1-f177.google.com (mail-pf1-f177.google.com [209.85.210.177]) (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 97FC22BD593 for ; Wed, 18 Jun 2025 12:16:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.177 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750248968; cv=none; b=c/1GrrpHD+BZjaa0CkvEXVWfcuJ1wjjdc4dJ92I2PfMhSe/Tc6cmZlZhYWVoE2h4cwjfz0ptA9MfqGfxBe5LDoeVwLdaIJvD1HmK5RWNEpKGl9spFYDoVLBhS16c2LUAAtKTPmO5NALVjd4ebNGZh1LZI8gW0BQXzEQbysFttNM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750248968; c=relaxed/simple; bh=SBjQlH46dBB3U+TixQzZp78z+Lc9Dr3istOOhSNwHTo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=JmaOE7L/asCCXQtHHud5J/2PmZxQ3LVXueMTzh4WDSX9l0BwF2HHBd1Fqj7pxXbKKcOWjbM0ZLuxgzyNSJvO+1Y6LZ9SdiPb2KyIupuMrOhXa0AYJs5GJcc8MpIRH0s6Ga/gqbhX1xRh0m5pOiEo0mD4s62I7/EPGog3WJrBY4Y= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ventanamicro.com; spf=pass smtp.mailfrom=ventanamicro.com; dkim=pass (2048-bit key) header.d=ventanamicro.com header.i=@ventanamicro.com header.b=FmutcZ5i; arc=none smtp.client-ip=209.85.210.177 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ventanamicro.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ventanamicro.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ventanamicro.com header.i=@ventanamicro.com header.b="FmutcZ5i" Received: by mail-pf1-f177.google.com with SMTP id d2e1a72fcca58-747fc77bb2aso5094569b3a.3 for ; Wed, 18 Jun 2025 05:16:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1750248966; x=1750853766; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=t/zEjMktz2Q+rhDOD+xT+f8Y23symCCnfKy+4Q372EY=; b=FmutcZ5ibJCM7wgjI991vyO1uq4Ptv6YdfmjzS5gS+zFauK9+At/ikXU3P2cd+RsJa v8Gspvci6Uiku4BKTLNCFQbjjc4SkXHWRhZBDyjiC6Q7B6XE9NDpUDHjF/ZgO+tucUS4 iD+pghY7EVDlR9qWLWW6AA0CmlR8SqGCoHpShlAEs8a4Y4LwnwBcKWUVCjcyYm8M9CGb dqkMVtmv6vS3pP7w5iyFXIk9uGdoO2hhrB+36thGkKDIEUY4hwgLSUFP3YOM+KkWU1Y5 ytXw08Yu8sw+yNQ6+QDCHAarxiWmpI4KstaouBZaDeXFkQK+BAqdF5PiT7sLvgKmMb3S UetA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1750248966; x=1750853766; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=t/zEjMktz2Q+rhDOD+xT+f8Y23symCCnfKy+4Q372EY=; b=qZ4pT6i8wqmOIy4HXZ2QjDbE8C1KlmBmF/090zHFQW/Z+YCfu4AouU3XY6VKsPR6WN X1eysW+GxLfg5ypyMjCLZtmjq6BugD8P10rVaGQ/HDLYX+WUPQO0LS4wpUjv+1c+HYsx 4cqMQPqP57vqe+LrWL8n06caMmiPsTnTktvLSjJ9OQTIeBHYLV1wHQsRsk4YAOIO7DlM WPuCcd8xi+WzRGb8Hi1ycKOMPwTsLSUe/WEOztrsuKLBRPkHwTCpO9CbIyDZqGGKBZww 0tnC+2/q6MBjApNzVEs8+dUAqiOOln71Xq/TlmRfKA8o8ZXJFrSuy2bcZ9ofphaO8dUv XGnA== X-Forwarded-Encrypted: i=1; AJvYcCWO7ig+Z7QNK+RADXUBmViNQXC8vaXmPdkZDkFLA8+aqkU7G3NRpBoGmM27veUvVN0DauyKScfJ3xCQgUg=@vger.kernel.org X-Gm-Message-State: AOJu0YybZqQb+jLnocQCQTVjyxrcwqG+dZvbHpEQ+PLhMopUNqhvHpQf TLPxNAAJgqIKn7tf+ZtHQMcj062zN+GhnbYvchb1TgzyKBV7w/5Uxcbse3T0zi2kUDM= X-Gm-Gg: ASbGncuy0BydQYXabQAz6bOnuGiGhLKC/rwXq+DpdKgBQU+jgiYz1bWA5UxKK5kjyei aCJ87PcmnFyqRqUcZSCP1jbvkPeG831cmFuDWVutbWY5B4fAatZ8fWc2biR4IF04PEeHww/XN44 U4f5GEJrGY7Id0/7uoQYlShxxZcjrD5ndd9t+mKwVj8uOmyPKdhwFzYUU4HBVfa+6S/vHYzdjTw dph9UBOZdxNUX4PHIjth68t6v/hxzeN8W/v+9w2+hc0B8oQuIyp1/CRbVvDHX26lxzPaqv8/bnJ 249zYbP+/PZVZ5R6MJUaCj6tx41VhOI3pk0+DnnhqtHZPWc9oU4hqBrAwW7yS9/kxrNops9+i50 SZyBpxOYTJIzwa0DNbQ== X-Google-Smtp-Source: AGHT+IGoMyew2ejAt7Lr7ji1BBEmYh0srRqGPcfXFixzpRQROZE2QwCLEt0GO1Sh7RlWtJaJUne8nw== X-Received: by 2002:a05:6a00:4b4a:b0:736:54c9:df2c with SMTP id d2e1a72fcca58-7489cfbb3b3mr21175650b3a.15.1750248965820; Wed, 18 Jun 2025 05:16:05 -0700 (PDT) Received: from localhost.localdomain ([122.171.23.44]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-748900d7e0asm11201177b3a.174.2025.06.18.05.15.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Jun 2025 05:16:05 -0700 (PDT) From: Anup Patel To: Michael Turquette , Stephen Boyd , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Jassi Brar , Thomas Gleixner , "Rafael J . Wysocki" , Mika Westerberg , Andy Shevchenko , Linus Walleij , Bartosz Golaszewski , =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= Cc: Palmer Dabbelt , Paul Walmsley , Len Brown , Sunil V L , Rahul Pathak , Leyfoon Tan , Atish Patra , Andrew Jones , Samuel Holland , Anup Patel , linux-clk@vger.kernel.org, devicetree@vger.kernel.org, linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, Anup Patel Subject: [PATCH v6 13/23] ACPI: property: Refactor acpi_fwnode_get_reference_args() Date: Wed, 18 Jun 2025 17:43:48 +0530 Message-ID: <20250618121358.503781-14-apatel@ventanamicro.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250618121358.503781-1-apatel@ventanamicro.com> References: <20250618121358.503781-1-apatel@ventanamicro.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Sunil V L Currently acpi_fwnode_get_reference_args() calls the public function __acpi_node_get_property_reference() which ignores the nargs_prop parameter. To fix this, make __acpi_node_get_property_reference() to call the static acpi_fwnode_get_reference() so that callers of fwnode_get_reference_args() can still pass a valid property name to fetch the number of arguments. Signed-off-by: Sunil V L Signed-off-by: Anup Patel --- drivers/acpi/property.c | 101 ++++++++++++++++++++-------------------- 1 file changed, 50 insertions(+), 51 deletions(-) diff --git a/drivers/acpi/property.c b/drivers/acpi/property.c index 436019d96027..d4863746fb11 100644 --- a/drivers/acpi/property.c +++ b/drivers/acpi/property.c @@ -882,45 +882,10 @@ static struct fwnode_handle *acpi_parse_string_ref(co= nst struct fwnode_handle *f return &dn->fwnode; } =20 -/** - * __acpi_node_get_property_reference - returns handle to the referenced o= bject - * @fwnode: Firmware node to get the property from - * @propname: Name of the property - * @index: Index of the reference to return - * @num_args: Maximum number of arguments after each reference - * @args: Location to store the returned reference with optional arguments - * (may be NULL) - * - * Find property with @name, verifify that it is a package containing at l= east - * one object reference and if so, store the ACPI device object pointer to= the - * target object in @args->adev. If the reference includes arguments, sto= re - * them in the @args->args[] array. - * - * If there's more than one reference in the property value package, @inde= x is - * used to select the one to return. - * - * It is possible to leave holes in the property value set like in the - * example below: - * - * Package () { - * "cs-gpios", - * Package () { - * ^GPIO, 19, 0, 0, - * ^GPIO, 20, 0, 0, - * 0, - * ^GPIO, 21, 0, 0, - * } - * } - * - * Calling this function with index %2 or index %3 return %-ENOENT. If the - * property does not contain any more values %-ENOENT is returned. The NULL - * entry must be single integer and preferably contain value %0. - * - * Return: %0 on success, negative error code on failure. - */ -int __acpi_node_get_property_reference(const struct fwnode_handle *fwnode, - const char *propname, size_t index, size_t num_args, - struct fwnode_reference_args *args) +static int acpi_fwnode_get_reference_args(const struct fwnode_handle *fwno= de, + const char *propname, const char *nargs_prop, + unsigned int args_count, unsigned int index, + struct fwnode_reference_args *args) { const union acpi_object *element, *end; const union acpi_object *obj; @@ -999,7 +964,7 @@ int __acpi_node_get_property_reference(const struct fwn= ode_handle *fwnode, =20 ret =3D acpi_get_ref_args(idx =3D=3D index ? args : NULL, acpi_fwnode_handle(device), - &element, end, num_args); + &element, end, args_count); if (ret < 0) return ret; =20 @@ -1017,7 +982,7 @@ int __acpi_node_get_property_reference(const struct fw= node_handle *fwnode, =20 ret =3D acpi_get_ref_args(idx =3D=3D index ? args : NULL, ref_fwnode, &element, end, - num_args); + args_count); if (ret < 0) return ret; =20 @@ -1039,6 +1004,50 @@ int __acpi_node_get_property_reference(const struct = fwnode_handle *fwnode, =20 return -ENOENT; } + +/** + * __acpi_node_get_property_reference - returns handle to the referenced o= bject + * @fwnode: Firmware node to get the property from + * @propname: Name of the property + * @index: Index of the reference to return + * @num_args: Maximum number of arguments after each reference + * @args: Location to store the returned reference with optional arguments + * (may be NULL) + * + * Find property with @name, verifify that it is a package containing at l= east + * one object reference and if so, store the ACPI device object pointer to= the + * target object in @args->adev. If the reference includes arguments, sto= re + * them in the @args->args[] array. + * + * If there's more than one reference in the property value package, @inde= x is + * used to select the one to return. + * + * It is possible to leave holes in the property value set like in the + * example below: + * + * Package () { + * "cs-gpios", + * Package () { + * ^GPIO, 19, 0, 0, + * ^GPIO, 20, 0, 0, + * 0, + * ^GPIO, 21, 0, 0, + * } + * } + * + * Calling this function with index %2 or index %3 return %-ENOENT. If the + * property does not contain any more values %-ENOENT is returned. The NULL + * entry must be single integer and preferably contain value %0. + * + * Return: %0 on success, negative error code on failure. + */ +int __acpi_node_get_property_reference(const struct fwnode_handle *fwnode, + const char *propname, size_t index, + size_t num_args, + struct fwnode_reference_args *args) +{ + return acpi_fwnode_get_reference_args(fwnode, propname, NULL, index, num_= args, args); +} EXPORT_SYMBOL_GPL(__acpi_node_get_property_reference); =20 static int acpi_data_prop_read_single(const struct acpi_device_data *data, @@ -1558,16 +1567,6 @@ acpi_fwnode_property_read_string_array(const struct = fwnode_handle *fwnode, val, nval); } =20 -static int -acpi_fwnode_get_reference_args(const struct fwnode_handle *fwnode, - const char *prop, const char *nargs_prop, - unsigned int args_count, unsigned int index, - struct fwnode_reference_args *args) -{ - return __acpi_node_get_property_reference(fwnode, prop, index, - args_count, args); -} - static const char *acpi_fwnode_get_name(const struct fwnode_handle *fwnode) { const struct acpi_device *adev; --=20 2.43.0