mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Yisheng Xie <xieyisheng1@huawei.com>
To: <gregkh@linuxfoundation.org>
Cc: <thomas.lendacky@amd.com>, <lorenzo.pieralisi@arm.com>,
	<bp@suse.de>, <tglx@linutronix.de>,
	<kstewart@linuxfoundation.org>, <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v2] devres: use MACRO instead of function for devm_ioremap
Date: Mon, 11 Dec 2017 16:23:11 +0800	[thread overview]
Message-ID: <fe05c850-3768-00a7-081f-a7ab9d137557@huawei.com> (raw)
In-Reply-To: <1511601813-20533-1-git-send-email-xieyisheng1@huawei.com>

Ping... and sorry to disturb.

Hi maintainers,
Could you please help to review this patch?

Thanks
Yisheng xie

On 2017/11/25 17:23, Yisheng Xie wrote:
> Default ioremap is ioremap_nocache, so devm_ioremap has the same function
> with devm_ioremap_nocache, which may just be killed. However, there are
> many places which use devm_ioremap_nocache, while many use devm_ioremap.
> 
> This patch is to use MACRO for devm_ioremap, which will reduce the size of
> devres.o from 206824 Bytes to 203768 Bytes.
> 
> Signed-off-by: Yisheng Xie <xieyisheng1@huawei.com>
> ---
> v2:
>   * MACRO devm_ioremap instead of devm_ioremap_nocache
> 
>  include/linux/io.h |  4 ++--
>  lib/devres.c       | 30 +-----------------------------
>  2 files changed, 3 insertions(+), 31 deletions(-)
> 
> diff --git a/include/linux/io.h b/include/linux/io.h
> index 32e30e8..3759882 100644
> --- a/include/linux/io.h
> +++ b/include/linux/io.h
> @@ -73,8 +73,6 @@ static inline void devm_ioport_unmap(struct device *dev, void __iomem *addr)
>  
>  #define IOMEM_ERR_PTR(err) (__force void __iomem *)ERR_PTR(err)
>  
> -void __iomem *devm_ioremap(struct device *dev, resource_size_t offset,
> -			   resource_size_t size);
>  void __iomem *devm_ioremap_nocache(struct device *dev, resource_size_t offset,
>  				   resource_size_t size);
>  void __iomem *devm_ioremap_wc(struct device *dev, resource_size_t offset,
> @@ -84,6 +82,8 @@ int check_signature(const volatile void __iomem *io_addr,
>  			const unsigned char *signature, int length);
>  void devm_ioremap_release(struct device *dev, void *res);
>  
> +#define devm_ioremap devm_ioremap_nocache
> +
>  void *devm_memremap(struct device *dev, resource_size_t offset,
>  		size_t size, unsigned long flags);
>  void devm_memunmap(struct device *dev, void *addr);
> diff --git a/lib/devres.c b/lib/devres.c
> index 5f2aedd..ebfaab1 100644
> --- a/lib/devres.c
> +++ b/lib/devres.c
> @@ -16,34 +16,6 @@ static int devm_ioremap_match(struct device *dev, void *res, void *match_data)
>  }
>  
>  /**
> - * devm_ioremap - Managed ioremap()
> - * @dev: Generic device to remap IO address for
> - * @offset: Resource address to map
> - * @size: Size of map
> - *
> - * Managed ioremap().  Map is automatically unmapped on driver detach.
> - */
> -void __iomem *devm_ioremap(struct device *dev, resource_size_t offset,
> -			   resource_size_t size)
> -{
> -	void __iomem **ptr, *addr;
> -
> -	ptr = devres_alloc(devm_ioremap_release, sizeof(*ptr), GFP_KERNEL);
> -	if (!ptr)
> -		return NULL;
> -
> -	addr = ioremap(offset, size);
> -	if (addr) {
> -		*ptr = addr;
> -		devres_add(dev, ptr);
> -	} else
> -		devres_free(ptr);
> -
> -	return addr;
> -}
> -EXPORT_SYMBOL(devm_ioremap);
> -
> -/**
>   * devm_ioremap_nocache - Managed ioremap_nocache()
>   * @dev: Generic device to remap IO address for
>   * @offset: Resource address to map
> @@ -153,7 +125,7 @@ void __iomem *devm_ioremap_resource(struct device *dev, struct resource *res)
>  		return IOMEM_ERR_PTR(-EBUSY);
>  	}
>  
> -	dest_ptr = devm_ioremap(dev, res->start, size);
> +	dest_ptr = devm_ioremap_nocache(dev, res->start, size);
>  	if (!dest_ptr) {
>  		dev_err(dev, "ioremap failed for resource %pR\n", res);
>  		devm_release_mem_region(dev, res->start, size);
> 

  reply	other threads:[~2017-12-11  8:23 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-25  9:23 Yisheng Xie
2017-12-11  8:23 ` Yisheng Xie [this message]
2017-12-18 14:40   ` Greg KH
2017-12-19  1:31     ` Yisheng Xie
2017-12-19  8:46 ` Greg KH
2017-12-19 10:52   ` Yisheng Xie
2017-12-21 11:50     ` Yisheng Xie
2017-12-21 15:08       ` Greg KH
2017-12-22  9:06         ` Yisheng Xie

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=fe05c850-3768-00a7-081f-a7ab9d137557@huawei.com \
    --to=xieyisheng1@huawei.com \
    --cc=bp@suse.de \
    --cc=gregkh@linuxfoundation.org \
    --cc=kstewart@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lorenzo.pieralisi@arm.com \
    --cc=tglx@linutronix.de \
    --cc=thomas.lendacky@amd.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

Powered by JetHome