All of lore.kernel.org
 help / color / mirror / Atom feed
From: nicolas.ferre@atmel.com (Nicolas Ferre)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] ARM: at91: fix ramc standby function registration
Date: Mon, 1 Sep 2014 10:05:13 +0200	[thread overview]
Message-ID: <540428B9.4070400@atmel.com> (raw)
In-Reply-To: <1409155611-7574-1-git-send-email-alexandre.belloni@free-electrons.com>

On 27/08/2014 18:06, Alexandre Belloni :
> After the for_each_matching_node loop, we end up with a null value for np. Then,
> of_match_node() is not matching anything and we can't register the standby
> function and "ramc no standby function available" is printed.
> 
> Fix that by selecting the first available standby function. For now,
> at91_pm_set_standby doesn't support multiple different standby functions and no
> existing SoCs have different RAM controllers.
> 
> Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>

That makes sense for now.

Acked-by: Nicolas Ferre <nicolas.ferre@atmel.com>

> ---
>  arch/arm/mach-at91/setup.c | 11 +++++++----
>  1 file changed, 7 insertions(+), 4 deletions(-)
> 
> diff --git a/arch/arm/mach-at91/setup.c b/arch/arm/mach-at91/setup.c
> index 28ae63b8eb16..d2cade21ebd7 100644
> --- a/arch/arm/mach-at91/setup.c
> +++ b/arch/arm/mach-at91/setup.c
> @@ -343,25 +343,28 @@ static void at91_dt_ramc(void)
>  	struct device_node *np;
>  	const struct of_device_id *of_id;
>  	int idx = 0;
> +	const void *standby = NULL;
>  
> -	for_each_matching_node(np, ramc_ids) {
> +	for_each_matching_node_and_match(np, ramc_ids, &of_id) {
>  		at91_ramc_base[idx] = of_iomap(np, 0);
>  		if (!at91_ramc_base[idx])
>  			panic(pr_fmt("unable to map ramc[%d] cpu registers\n"), idx);
>  
> +		if (!standby)
> +			standby = of_id->data;
> +
>  		idx++;
>  	}
>  
>  	if (!idx)
>  		panic(pr_fmt("unable to find compatible ram controller node in dtb\n"));
>  
> -	of_id = of_match_node(ramc_ids, np);
> -	if (!of_id) {
> +	if (!standby) {
>  		pr_warn("ramc no standby function available\n");
>  		return;
>  	}
>  
> -	at91_pm_set_standby(of_id->data);
> +	at91_pm_set_standby(standby);
>  }
>  
>  void __init at91rm9200_dt_initialize(void)
> 


-- 
Nicolas Ferre

WARNING: multiple messages have this Message-ID (diff)
From: Nicolas Ferre <nicolas.ferre@atmel.com>
To: Alexandre Belloni <alexandre.belloni@free-electrons.com>
Cc: Jean-Christophe Plagniol-Villard <plagnioj@jcrosoft.com>,
	Maxime Ripard <maxime.ripard@free-electrons.com>,
	<linux-arm-kernel@lists.infradead.org>,
	<linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] ARM: at91: fix ramc standby function registration
Date: Mon, 1 Sep 2014 10:05:13 +0200	[thread overview]
Message-ID: <540428B9.4070400@atmel.com> (raw)
In-Reply-To: <1409155611-7574-1-git-send-email-alexandre.belloni@free-electrons.com>

On 27/08/2014 18:06, Alexandre Belloni :
> After the for_each_matching_node loop, we end up with a null value for np. Then,
> of_match_node() is not matching anything and we can't register the standby
> function and "ramc no standby function available" is printed.
> 
> Fix that by selecting the first available standby function. For now,
> at91_pm_set_standby doesn't support multiple different standby functions and no
> existing SoCs have different RAM controllers.
> 
> Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>

That makes sense for now.

Acked-by: Nicolas Ferre <nicolas.ferre@atmel.com>

> ---
>  arch/arm/mach-at91/setup.c | 11 +++++++----
>  1 file changed, 7 insertions(+), 4 deletions(-)
> 
> diff --git a/arch/arm/mach-at91/setup.c b/arch/arm/mach-at91/setup.c
> index 28ae63b8eb16..d2cade21ebd7 100644
> --- a/arch/arm/mach-at91/setup.c
> +++ b/arch/arm/mach-at91/setup.c
> @@ -343,25 +343,28 @@ static void at91_dt_ramc(void)
>  	struct device_node *np;
>  	const struct of_device_id *of_id;
>  	int idx = 0;
> +	const void *standby = NULL;
>  
> -	for_each_matching_node(np, ramc_ids) {
> +	for_each_matching_node_and_match(np, ramc_ids, &of_id) {
>  		at91_ramc_base[idx] = of_iomap(np, 0);
>  		if (!at91_ramc_base[idx])
>  			panic(pr_fmt("unable to map ramc[%d] cpu registers\n"), idx);
>  
> +		if (!standby)
> +			standby = of_id->data;
> +
>  		idx++;
>  	}
>  
>  	if (!idx)
>  		panic(pr_fmt("unable to find compatible ram controller node in dtb\n"));
>  
> -	of_id = of_match_node(ramc_ids, np);
> -	if (!of_id) {
> +	if (!standby) {
>  		pr_warn("ramc no standby function available\n");
>  		return;
>  	}
>  
> -	at91_pm_set_standby(of_id->data);
> +	at91_pm_set_standby(standby);
>  }
>  
>  void __init at91rm9200_dt_initialize(void)
> 


-- 
Nicolas Ferre

  reply	other threads:[~2014-09-01  8:05 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-27 16:06 [PATCH] ARM: at91: fix ramc standby function registration Alexandre Belloni
2014-08-27 16:06 ` Alexandre Belloni
2014-09-01  8:05 ` Nicolas Ferre [this message]
2014-09-01  8:05   ` Nicolas Ferre

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=540428B9.4070400@atmel.com \
    --to=nicolas.ferre@atmel.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.