mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Cc: barebox@lists.infradead.org
Subject: Re: [PATCH 2/2] driver: workarroud resource request that conflist with errno PTR
Date: Tue, 6 Jan 2015 13:44:23 +0100	[thread overview]
Message-ID: <20150106124423.GB17225@pengutronix.de> (raw)
In-Reply-To: <1420544226-30497-2-git-send-email-plagnioj@jcrosoft.com>

On Tue, Jan 06, 2015 at 12:37:06PM +0100, Jean-Christophe PLAGNIOL-VILLARD wrote:
> broken since
> 
> commit ed6e965824303255cacc1c1a195d3684caa26bce
> Author:     Sascha Hauer <s.hauer@pengutronix.de>
> resource: Let dev_request_mem_region return an error pointer
> 
> Introduce dev_request_mem_region_err_null
> 
> only used on platform like at91 where the Ressource address collision with
> 
> Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
> ---
>  arch/arm/mach-at91/at91sam926x_time.c |  6 +++---
>  drivers/base/driver.c                 | 31 +++++++++++++++++++++++++++++--
>  drivers/pinctrl/pinctrl-at91.c        |  6 +++---
>  drivers/serial/atmel.c                |  6 +++---
>  include/driver.h                      |  8 ++++++++
>  5 files changed, 46 insertions(+), 11 deletions(-)
> 
> diff --git a/arch/arm/mach-at91/at91sam926x_time.c b/arch/arm/mach-at91/at91sam926x_time.c
> index 789e1ec..cc7ad2f 100644
> --- a/arch/arm/mach-at91/at91sam926x_time.c
> +++ b/arch/arm/mach-at91/at91sam926x_time.c
> @@ -89,9 +89,9 @@ static int at91_pit_probe(struct device_d *dev)
>  		return ret;
>  	}
>  
> -	pit_base = dev_request_mem_region(dev, 0);
> -	if (IS_ERR(pit_base))
> -		return PTR_ERR(pit_base);
> +	pit_base = dev_request_mem_region_err_null(dev, 0);
> +	if (!pit_base)
> +		return -ENOENT;
>  
>  	pit_rate = clk_get_rate(clk) / 16;
>  
> diff --git a/drivers/base/driver.c b/drivers/base/driver.c
> index e0125a1..2375004 100644
> --- a/drivers/base/driver.c
> +++ b/drivers/base/driver.c
> @@ -242,8 +242,8 @@ int register_driver(struct driver_d *drv)
>  }
>  EXPORT_SYMBOL(register_driver);
>  
> -struct resource *dev_get_resource(struct device_d *dev, unsigned long type,
> -				  int num)
> +static struct resource *__dev_get_resource(struct device_d *dev,
> +		unsigned long type, int num)
>  {
>  	int i, n = 0;
>  
> @@ -256,6 +256,17 @@ struct resource *dev_get_resource(struct device_d *dev, unsigned long type,
>  		}
>  	}
>  
> +	return NULL;
> +}
> +
> +struct resource *dev_get_resource(struct device_d *dev, unsigned long type,
> +				  int num)
> +{
> +	struct resource *res = __dev_get_resource(dev, type, num);
> +
> +	if (res)
> +		return res;
> +
>  	return ERR_PTR(-ENOENT);
>  }

No need to change dev_get_resource(), it returns a struct resource *
which will never conflict with an err ptr.

Sascha

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

  reply	other threads:[~2015-01-06 12:44 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-26  9:51 [REGRESSION BUG] at91 is broken on barebox Jean-Christophe PLAGNIOL-VILLARD
2015-01-05 10:23 ` Sascha Hauer
2015-01-05 11:51   ` Simon Aittamaa
2015-01-06 11:32 ` [PATCH 0/2] FIX AT91 support Jean-Christophe PLAGNIOL-VILLARD
2015-01-06 11:37   ` [PATCH 1/2] arm: at91: fix ecc_mode on non atmel boards Jean-Christophe PLAGNIOL-VILLARD
2015-01-06 11:37     ` [PATCH 2/2] driver: workarroud resource request that conflist with errno PTR Jean-Christophe PLAGNIOL-VILLARD
2015-01-06 12:44       ` Sascha Hauer [this message]
2015-01-07  3:14         ` Jean-Christophe PLAGNIOL-VILLARD
2015-01-07  7:34           ` Sascha Hauer
2015-01-08  7:11       ` Sascha Hauer
2015-01-06 12:36     ` [PATCH 1/2] arm: at91: fix ecc_mode on non atmel boards Raphaël Poggi
2015-01-06 12:59     ` 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=20150106124423.GB17225@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    --cc=plagnioj@jcrosoft.com \
    /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