diff mbox series

[v5,RESEND,17/17] mm: ioremap: remove unneeded ioremap_allowed and iounmap_allowed

Message ID 20230515090848.833045-18-bhe@redhat.com (mailing list archive)
State New
Headers show
Series mm: ioremap: Convert architectures to take GENERIC_IOREMAP way | expand

Commit Message

Baoquan He May 15, 2023, 9:08 a.m. UTC
Now there are no users of ioremap_allowed and iounmap_allowed, clean
them up.

Signed-off-by: Baoquan He <bhe@redhat.com>
---
 include/asm-generic/io.h | 26 --------------------------
 mm/ioremap.c             |  6 ------
 2 files changed, 32 deletions(-)

Comments

Mike Rapoport May 16, 2023, 7:02 a.m. UTC | #1
On Mon, May 15, 2023 at 05:08:48PM +0800, Baoquan He wrote:
> Now there are no users of ioremap_allowed and iounmap_allowed, clean
> them up.
> 
> Signed-off-by: Baoquan He <bhe@redhat.com>

Reviewed-by: Mike Rapoport (IBM) <rppt@kernel.org>

> ---
>  include/asm-generic/io.h | 26 --------------------------
>  mm/ioremap.c             |  6 ------
>  2 files changed, 32 deletions(-)
> 
> diff --git a/include/asm-generic/io.h b/include/asm-generic/io.h
> index 39244c3ee797..bac63e874c7b 100644
> --- a/include/asm-generic/io.h
> +++ b/include/asm-generic/io.h
> @@ -1047,32 +1047,6 @@ static inline void iounmap(volatile void __iomem *addr)
>  #elif defined(CONFIG_GENERIC_IOREMAP)
>  #include <linux/pgtable.h>
>  
> -/*
> - * Arch code can implement the following two hooks when using GENERIC_IOREMAP
> - * ioremap_allowed() return a bool,
> - *   - true means continue to remap
> - *   - false means skip remap and return directly
> - * iounmap_allowed() return a bool,
> - *   - true means continue to vunmap
> - *   - false means skip vunmap and return directly
> - */
> -#ifndef ioremap_allowed
> -#define ioremap_allowed ioremap_allowed
> -static inline bool ioremap_allowed(phys_addr_t phys_addr, size_t size,
> -				   unsigned long prot)
> -{
> -	return true;
> -}
> -#endif
> -
> -#ifndef iounmap_allowed
> -#define iounmap_allowed iounmap_allowed
> -static inline bool iounmap_allowed(void *addr)
> -{
> -	return true;
> -}
> -#endif
> -
>  void __iomem *generic_ioremap_prot(phys_addr_t phys_addr, size_t size,
>  				   pgprot_t prot);
>  
> diff --git a/mm/ioremap.c b/mm/ioremap.c
> index 4a7749d85044..8cb337446bba 100644
> --- a/mm/ioremap.c
> +++ b/mm/ioremap.c
> @@ -32,9 +32,6 @@ void __iomem *generic_ioremap_prot(phys_addr_t phys_addr, size_t size,
>  	phys_addr -= offset;
>  	size = PAGE_ALIGN(size + offset);
>  
> -	if (!ioremap_allowed(phys_addr, size, pgprot_val(prot)))
> -		return NULL;
> -
>  #ifdef IOREMAP_START
>  	area = __get_vm_area_caller(size, VM_IOREMAP, IOREMAP_START,
>  				    IOREMAP_END, __builtin_return_address(0));
> @@ -68,9 +65,6 @@ void generic_iounmap(volatile void __iomem *addr)
>  {
>  	void *vaddr = (void *)((unsigned long)addr & PAGE_MASK);
>  
> -	if (!iounmap_allowed(vaddr))
> -		return;
> -
>  	if (is_ioremap_addr(vaddr))
>  		vunmap(vaddr);
>  }
> -- 
> 2.34.1
> 
>
Christoph Hellwig May 17, 2023, 6:43 a.m. UTC | #2
Looks good:

Reviewed-by: Christoph Hellwig <hch@lst.de>
Kefeng Wang May 18, 2023, 1:58 a.m. UTC | #3
On 2023/5/15 17:08, Baoquan He wrote:
> Now there are no users of ioremap_allowed and iounmap_allowed, clean
> them up.
> 
> Signed-off-by: Baoquan He <bhe@redhat.com>
> ---
>   include/asm-generic/io.h | 26 --------------------------
>   mm/ioremap.c             |  6 ------
>   2 files changed, 32 deletions(-)
> 

Reviewed-by: Kefeng Wang <wangkefeng.wang@huawei.com>
diff mbox series

Patch

diff --git a/include/asm-generic/io.h b/include/asm-generic/io.h
index 39244c3ee797..bac63e874c7b 100644
--- a/include/asm-generic/io.h
+++ b/include/asm-generic/io.h
@@ -1047,32 +1047,6 @@  static inline void iounmap(volatile void __iomem *addr)
 #elif defined(CONFIG_GENERIC_IOREMAP)
 #include <linux/pgtable.h>
 
-/*
- * Arch code can implement the following two hooks when using GENERIC_IOREMAP
- * ioremap_allowed() return a bool,
- *   - true means continue to remap
- *   - false means skip remap and return directly
- * iounmap_allowed() return a bool,
- *   - true means continue to vunmap
- *   - false means skip vunmap and return directly
- */
-#ifndef ioremap_allowed
-#define ioremap_allowed ioremap_allowed
-static inline bool ioremap_allowed(phys_addr_t phys_addr, size_t size,
-				   unsigned long prot)
-{
-	return true;
-}
-#endif
-
-#ifndef iounmap_allowed
-#define iounmap_allowed iounmap_allowed
-static inline bool iounmap_allowed(void *addr)
-{
-	return true;
-}
-#endif
-
 void __iomem *generic_ioremap_prot(phys_addr_t phys_addr, size_t size,
 				   pgprot_t prot);
 
diff --git a/mm/ioremap.c b/mm/ioremap.c
index 4a7749d85044..8cb337446bba 100644
--- a/mm/ioremap.c
+++ b/mm/ioremap.c
@@ -32,9 +32,6 @@  void __iomem *generic_ioremap_prot(phys_addr_t phys_addr, size_t size,
 	phys_addr -= offset;
 	size = PAGE_ALIGN(size + offset);
 
-	if (!ioremap_allowed(phys_addr, size, pgprot_val(prot)))
-		return NULL;
-
 #ifdef IOREMAP_START
 	area = __get_vm_area_caller(size, VM_IOREMAP, IOREMAP_START,
 				    IOREMAP_END, __builtin_return_address(0));
@@ -68,9 +65,6 @@  void generic_iounmap(volatile void __iomem *addr)
 {
 	void *vaddr = (void *)((unsigned long)addr & PAGE_MASK);
 
-	if (!iounmap_allowed(vaddr))
-		return;
-
 	if (is_ioremap_addr(vaddr))
 		vunmap(vaddr);
 }