From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 19C572E3AE5; Tue, 15 Jul 2025 13:32:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1752586333; cv=none; b=iEu+Cxnc8YbDwqW86zdMTFJ2gxvKlmHazfhHxuMOGkPMG9NTvP5h4Hq+o6ZAvxa1xaeZnSHGndqhX2bmhMYTFnmLO8bjlAC7SRtXrfGY1MHrAgenpcxSSIf1UgWOwsX4xJIf/uCPVs4vzJ5XRsa3raZdk04eiP6MC58BHZ9G6sg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1752586333; c=relaxed/simple; bh=No43g16yquKWyxuaS8aQ4VnwcyQuKrTywxQqqVOfsXk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ejw8dgXDWTZdchgNVL+FpNpwugrn+vPk3/TOinFBsNXmV0Pgy74Rx4DC9/RwYIkZ3kYL3oj39FXTAVG6kSb0VwQ/6kJDVcRTOWDIehoDodo2llkeAnyTPIe5JOE+woJsGdI8DKLH3DcCFirLQ3pa2HHC4bA/8ssf0zSudDs0fy8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=JJGyIUqw; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="JJGyIUqw" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2F5C2C4CEE3; Tue, 15 Jul 2025 13:32:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1752586332; bh=No43g16yquKWyxuaS8aQ4VnwcyQuKrTywxQqqVOfsXk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JJGyIUqwWWaKdNVA2o7cy34u7uLR7fdw8xUE3CAV2fcaLE6gUx44O8BPo4NiOGmh4 vYmrcfriLEa2VT2TrUrsQKF9MT1luiL/ywQck157Y41wntEuy9Wh6t7GCAijWCFPOo H4lxypddk+8r44Qwimbde+OboSGJKHUt9oKABKTo= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Frank Rowand , Rob Herring , Sasha Levin Subject: [PATCH 5.4 025/148] of: Add of_property_present() helper Date: Tue, 15 Jul 2025 15:12:27 +0200 Message-ID: <20250715130801.326099907@linuxfoundation.org> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20250715130800.293690950@linuxfoundation.org> References: <20250715130800.293690950@linuxfoundation.org> User-Agent: quilt/0.68 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 5.4-stable review patch. If anyone has any objections, please let me know. ------------------ From: Rob Herring [ Upstream commit 9cbad37ce8122de32a1529e394b468bc101c9e7f ] Add an of_property_present() function similar to fwnode_property_present(). of_property_read_bool() could be used directly, but it is cleaner to not use it on non-boolean properties. Reviewed-by: Frank Rowand Tested-by: Frank Rowand Link: https://lore.kernel.org/all/20230215215547.691573-1-robh@kernel.org/ Signed-off-by: Rob Herring Stable-dep-of: 171eb6f71e9e ("ASoC: meson: meson-card-utils: use of_property_present() for DT parsing") Signed-off-by: Sasha Levin --- include/linux/of.h | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/include/linux/of.h b/include/linux/of.h index ec6b8a1af73cf..728b9df20a521 100644 --- a/include/linux/of.h +++ b/include/linux/of.h @@ -1044,7 +1044,8 @@ static inline int of_property_read_string_index(const struct device_node *np, * @np: device node from which the property value is to be read. * @propname: name of the property to be searched. * - * Search for a property in a device node. + * Search for a boolean property in a device node. Usage on non-boolean + * property types is deprecated. * * Return: true if the property exists false otherwise. */ @@ -1056,6 +1057,20 @@ static inline bool of_property_read_bool(const struct device_node *np, return prop ? true : false; } +/** + * of_property_present - Test if a property is present in a node + * @np: device node to search for the property. + * @propname: name of the property to be searched. + * + * Test for a property present in a device node. + * + * Return: true if the property exists false otherwise. + */ +static inline bool of_property_present(const struct device_node *np, const char *propname) +{ + return of_property_read_bool(np, propname); +} + /** * of_property_read_u8_array - Find and read an array of u8 from a property. * -- 2.39.5