mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: Rouven Czerwinski <r.czerwinski@pengutronix.de>,
	barebox@lists.infradead.org
Subject: Re: [PATCH 1/3] blspec: take compatible name as argument
Date: Thu, 21 Sep 2023 14:33:00 +0200	[thread overview]
Message-ID: <2a8fbd5c-ad49-d37d-9914-463b174199fc@pengutronix.de> (raw)
In-Reply-To: <20230920123720.767063-1-r.czerwinski@pengutronix.de>

On 20.09.23 14:37, 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@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 has an unfortunate name, as it strips away the vendor prefix,
so this change does introduce breakage.

>  		blspec_entry_free(&entry->entry);
>  		return -ENODEV;
>  	}

-- 
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 |




  parent reply	other threads:[~2023-09-21 12:34 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-20 12:37 Rouven Czerwinski
2023-09-20 12:37 ` [PATCH 2/3] blspec: add new blspec.compatible.extra variable Rouven Czerwinski
2023-09-21 12:37   ` Ahmad Fatoum
2023-09-22  5:19     ` Ahmad Fatoum
2023-09-21 12:57   ` Sascha Hauer
2023-09-20 12:37 ` [PATCH 3/3] blspec: take extra entries into account Rouven Czerwinski
2023-09-21 12:33 ` Ahmad Fatoum [this message]
2023-09-21 12:38 ` [PATCH 1/3] blspec: take compatible name as argument Sascha Hauer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2a8fbd5c-ad49-d37d-9914-463b174199fc@pengutronix.de \
    --to=a.fatoum@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    --cc=r.czerwinski@pengutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox