mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <sha@pengutronix.de>
To: Ahmad Fatoum <ahmad@a3f.at>
Cc: barebox@lists.infradead.org
Subject: Re: [PATCH] driver: provide dev_request_mem_resource_by_name() helper
Date: Tue, 5 Jan 2021 13:55:27 +0100	[thread overview]
Message-ID: <20210105125527.GE19063@pengutronix.de> (raw)
In-Reply-To: <20210101225139.2165289-1-ahmad@a3f.at>

On Fri, Jan 01, 2021 at 11:51:39PM +0100, Ahmad Fatoum wrote:
> There are both dev_request_mem_resource() and dev_request_mem_region(),
> which return the struct resource and a IOMEM(.start) respectively.
> 
> There is only dev_request_mem_region_by_name(), but
> no dev_request_mem_resource_by_name(), so add the latter for symmetry.
> 
> Signed-off-by: Ahmad Fatoum <ahmad@a3f.at>
> ---
>  drivers/base/driver.c | 12 ++++++++++--
>  include/driver.h      |  5 +++++
>  2 files changed, 15 insertions(+), 2 deletions(-)

Applied, thanks

Sascha

> 
> diff --git a/drivers/base/driver.c b/drivers/base/driver.c
> index 3205bbc3c33b..6763bbc6f512 100644
> --- a/drivers/base/driver.c
> +++ b/drivers/base/driver.c
> @@ -372,7 +372,7 @@ struct resource *dev_get_resource_by_name(struct device_d *dev,
>  	return ERR_PTR(-ENOENT);
>  }
>  
> -void __iomem *dev_request_mem_region_by_name(struct device_d *dev, const char *name)
> +struct resource *dev_request_mem_resource_by_name(struct device_d *dev, const char *name)
>  {
>  	struct resource *res;
>  
> @@ -380,7 +380,15 @@ void __iomem *dev_request_mem_region_by_name(struct device_d *dev, const char *n
>  	if (IS_ERR(res))
>  		return ERR_CAST(res);
>  
> -	res = request_iomem_region(dev_name(dev), res->start, res->end);
> +	return request_iomem_region(dev_name(dev), res->start, res->end);
> +}
> +EXPORT_SYMBOL(dev_request_mem_resource_by_name);
> +
> +void __iomem *dev_request_mem_region_by_name(struct device_d *dev, const char *name)
> +{
> +	struct resource *res;
> +
> +	res = dev_request_mem_resource_by_name(dev, name);
>  	if (IS_ERR(res))
>  		return ERR_CAST(res);
>  
> diff --git a/include/driver.h b/include/driver.h
> index e2886d051d4f..0d43b3614863 100644
> --- a/include/driver.h
> +++ b/include/driver.h
> @@ -214,6 +214,11 @@ void __iomem *dev_request_mem_region(struct device_d *dev, int num);
>   */
>  struct resource *dev_request_mem_resource(struct device_d *dev, int num);
>  
> +/*
> + * exlusively request resource 'name' for a device
> + */
> +struct resource *dev_request_mem_resource_by_name(struct device_d *dev, const char *name);
> +
>  /*
>   * exlusively request register base 'num' for a device
>   * will return NULL on error
> -- 
> 2.29.2
> 
> 
> _______________________________________________
> barebox mailing list
> barebox@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox
> 

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

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

      reply	other threads:[~2021-01-05 12:55 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-01 22:51 Ahmad Fatoum
2021-01-05 12:55 ` Sascha Hauer [this message]

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=20210105125527.GE19063@pengutronix.de \
    --to=sha@pengutronix.de \
    --cc=ahmad@a3f.at \
    --cc=barebox@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox