From mboxrd@z Thu Jan 1 00:00:00 1970 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 lists.ozlabs.org (lists.ozlabs.org [112.213.38.117]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id ED3BBCA5FF6 for ; Mon, 19 Jan 2026 11:07:02 +0000 (UTC) Received: from boromir.ozlabs.org (localhost [127.0.0.1]) by lists.ozlabs.org (Postfix) with ESMTP id 4dvnj13xYZz2yql; Mon, 19 Jan 2026 22:07:01 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; arc=none smtp.remote-ip="2600:3c0a:e001:78e:0:1991:8:25" ARC-Seal: i=1; a=rsa-sha256; d=lists.ozlabs.org; s=201707; t=1768820821; cv=none; b=MMS10rZ7lX1QYZYQqchfPRZt7mkZx+kvHb3/EZWHVnNGFCpL/3OvvX9GXyL2W/qGsOoaBWS3lO4j8rSBA69UFyEND4g2nXY8LxveecDS8nXKa9zQwlgBMgCWSP6bqtrztd0ckJ8TWqYvUR5JG7UnZUmjbE0/cFctUOqSRF+vj96vECHEtsGm5CWJcsdb/qAmeNtKoUqX8rutvFm5Nws8Iy9htUYJn0kqgcNotOdnAsPdhAHkjy5dhuwLvOStGlzxMEQVdHjd2GmYcrobuSfYdZtsO0PyQ1TJifgLelhIWmGU5qbV1l45lUlUERPtjvNdxqhDeBZFgpsVpsD/xAYv9g== ARC-Message-Signature: i=1; a=rsa-sha256; d=lists.ozlabs.org; s=201707; t=1768820821; c=relaxed/relaxed; bh=InzMZ2sKPU+dBiXuXrFvQIinli9OSxMqyO9gWD6Sl84=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=B0+9RadB/epFMF8JKvrboOPNUWOfCY35z3DiQV0hDIgqDP9c1xo6F1ifHmf9/6MrxeQuU4eP+2c4zwFwjw7Xi86VQFw04hiDEyIGXnVBX4COZBomxfpR4scs3RzdHE1TICrWkPSGQ+5kx1gvPgEoFNXRzf+a+1ISeqQxYQeVbt7LJXQRBpXFeWJsIEjKFOEJkDknk/aK+YrzCJwx+pO37iH24iEZ2IQGgZ1MVg2A16XZL56gJ36fMAvVUytR0+H9qNrqxH9ZkrUQpoAzfH5dBxhsKNgdX8E65QJC595/TuFOq3wrVcBqDBLCwjL8s7Z/CAhhg7Ffsy4ezf70keJT6A== ARC-Authentication-Results: i=1; lists.ozlabs.org; dmarc=pass (p=quarantine dis=none) header.from=kernel.org; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20201202 header.b=M/3rPe+V; dkim-atps=neutral; spf=pass (client-ip=2600:3c0a:e001:78e:0:1991:8:25; helo=sea.source.kernel.org; envelope-from=chleroy@kernel.org; receiver=lists.ozlabs.org) smtp.mailfrom=kernel.org Authentication-Results: lists.ozlabs.org; dmarc=pass (p=quarantine dis=none) header.from=kernel.org Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20201202 header.b=M/3rPe+V; dkim-atps=neutral Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=kernel.org (client-ip=2600:3c0a:e001:78e:0:1991:8:25; helo=sea.source.kernel.org; envelope-from=chleroy@kernel.org; receiver=lists.ozlabs.org) Received: from sea.source.kernel.org (sea.source.kernel.org [IPv6:2600:3c0a:e001:78e:0:1991:8:25]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4dvnj05jbKz2xHW for ; Mon, 19 Jan 2026 22:07:00 +1100 (AEDT) Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sea.source.kernel.org (Postfix) with ESMTP id 12BBD41A4E; Mon, 19 Jan 2026 11:06:59 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7BEC8C116C6; Mon, 19 Jan 2026 11:06:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1768820818; bh=FSHtm5y+0kZFCu8h7MAlOolnmcLEJiXQsqC8mgqCK0I=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=M/3rPe+VeDwVPcMY41CgntHHzX52DrZ0Q9LntDEdhFwNDiNZ+STK82e5P8+fTyKDM DyPXKjY5ovs4CJIuPMfV4bFzgLkuVtS9YVZxtJVrjT3KTCx6Lt50yKGHNFtwjJiioZ nRo+/iFAN2Yo41CvjEQUqCEYz+oCH0IdS9UATPlAo/IjYIH20q8aTsdTpeQSk7f+Qz 8eou2/M7Ip9TXxzlIaBsgTffX6DujbxZky1fjiNwbe1DQLng6YsJKWQD40SP/jF/2q 1OLSx6lcmdOrWzcG4u/cDPaN57epDjYD//Wwa+BRG53He0SLZsLR2jz5ALHlw9R7Rn 813vdS2ZEk1iA== Message-ID: Date: Mon, 19 Jan 2026 12:06:51 +0100 X-Mailing-List: linuxppc-dev@lists.ozlabs.org List-Id: List-Help: List-Owner: List-Post: List-Archive: , List-Subscribe: , , List-Unsubscribe: Precedence: list MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH 1/8] of: provide of_machine_get_compatible() To: Bartosz Golaszewski , Rob Herring , Saravana Kannan , Greg Kroah-Hartman , "Rafael J. Wysocki" , Danilo Krummrich , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , Geert Uytterhoeven , Magnus Damm , Chen-Yu Tsai , Jernej Skrabec , Samuel Holland Cc: devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-arm-kernel@lists.infradead.org, imx@lists.linux.dev, linux-renesas-soc@vger.kernel.org, linux-sunxi@lists.linux.dev References: <20260119-soc-of-root-v1-0-32a0fa9a78b4@oss.qualcomm.com> <20260119-soc-of-root-v1-1-32a0fa9a78b4@oss.qualcomm.com> Content-Language: fr-FR From: "Christophe Leroy (CS GROUP)" In-Reply-To: <20260119-soc-of-root-v1-1-32a0fa9a78b4@oss.qualcomm.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Le 19/01/2026 à 11:40, Bartosz Golaszewski a écrit : > Provide a helper function allowing users to read the compatible string > of the machine, hiding the access to the root node. > > Signed-off-by: Bartosz Golaszewski Reviewed-by: Christophe Leroy (CS GROUP) > --- > drivers/of/base.c | 13 +++++++++++++ > include/linux/of.h | 2 ++ > 2 files changed, 15 insertions(+) > > diff --git a/drivers/of/base.c b/drivers/of/base.c > index 0b65039ece53aa90f30da2420a893a02ab4c6dd8..a7e27d5355929abd6d156b80c52f8f8b08fe6da1 100644 > --- a/drivers/of/base.c > +++ b/drivers/of/base.c > @@ -434,6 +434,19 @@ bool of_machine_compatible_match(const char *const *compats) > } > EXPORT_SYMBOL(of_machine_compatible_match); > > +/** > + * of_machine_get_compatible - Get the compatible string of this machine > + * @compatible: address at which the compatible string will be stored > + * > + * Returns: > + * 0 on success, negative error number on failure. > + */ > +int of_machine_get_compatible(const char **compatible) > +{ > + return of_property_read_string(of_root, "compatible", compatible); > +} > +EXPORT_SYMBOL_GPL(of_machine_get_compatible); > + > /** > * of_machine_device_match - Test root of device tree against a of_device_id array > * @matches: NULL terminated array of of_device_id match structures to search in > diff --git a/include/linux/of.h b/include/linux/of.h > index 9bbdcf25a2b448ba4ec5ddee8b35a105ca4aab8b..75423fb556ee4c108ce25144a0bdc252a89f7d1d 100644 > --- a/include/linux/of.h > +++ b/include/linux/of.h > @@ -426,6 +426,8 @@ static inline bool of_machine_is_compatible(const char *compat) > return of_machine_compatible_match(compats); > } > > +int of_machine_get_compatible(const char **compatible); > + > extern int of_add_property(struct device_node *np, struct property *prop); > extern int of_remove_property(struct device_node *np, struct property *prop); > extern int of_update_property(struct device_node *np, struct property *newprop); >