[PATCH 1/3] blspec: take compatible name as argument

Sascha Hauer sha at pengutronix.de
Thu Sep 21 05:38:57 PDT 2023


On Wed, Sep 20, 2023 at 02:37:18PM +0200, Rouven Czerwinski wrote:
> Instead of retrieving the root compatible itself, let
> entry_is_of_compatible take the compatible as an argument. Pass in
> of_get_machine_compatible for now, no functional changes.
> 
> Signed-off-by: Rouven Czerwinski <r.czerwinski at pengutronix.de>
> ---
>  common/blspec.c | 9 ++-------
>  1 file changed, 2 insertions(+), 7 deletions(-)
> 
> diff --git a/common/blspec.c b/common/blspec.c
> index b70332a54c..f8d47f20d2 100644
> --- a/common/blspec.c
> +++ b/common/blspec.c
> @@ -422,13 +422,12 @@ static char *parse_nfs_url(const char *url)
>   *
>   * returns true if the entry is compatible, false otherwise
>   */
> -static bool entry_is_of_compatible(struct blspec_entry *entry)
> +static bool entry_is_of_compatible(struct blspec_entry *entry, const char* compat)
>  {
>  	const char *devicetree;
>  	const char *abspath;
>  	int ret;
>  	struct device_node *root = NULL, *barebox_root;
> -	const char *compat;
>  	char *filename;
>  
>  	/* If the entry doesn't specify a devicetree we are compatible */
> @@ -444,10 +443,6 @@ static bool entry_is_of_compatible(struct blspec_entry *entry)
>  	if (!barebox_root)
>  		return true;
>  
> -	ret = of_property_read_string(barebox_root, "compatible", &compat);
> -	if (ret)
> -		return false;
> -
>  	if (entry->rootpath)
>  		abspath = entry->rootpath;
>  	else
> @@ -521,7 +516,7 @@ int blspec_scan_file(struct bootentries *bootentries, const char *root,
>  	entry->configpath = xstrdup(configname);
>  	entry->cdev = get_cdev_by_mountpath(root);
>  
> -	if (!entry_is_of_compatible(entry)) {
> +	if (!entry_is_of_compatible(entry, of_get_machine_compatible())) {

of_get_machine_compatible() returns the machine name without the vendor
prefix, i.e. from "fsl,imx6dl-sabrelite" it will make "imx6dl-sabrelite"

Sascha

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |



More information about the barebox mailing list