]> rtime.felk.cvut.cz Git - zynq/linux.git/commitdiff
memblock: replace memblock_alloc_base(ANYWHERE) with memblock_phys_alloc
authorMike Rapoport <rppt@linux.ibm.com>
Tue, 12 Mar 2019 06:29:06 +0000 (23:29 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Tue, 12 Mar 2019 17:04:01 +0000 (10:04 -0700)
The calls to memblock_alloc_base(size, align, MEMBLOCK_ALLOC_ANYWHERE)
and memblock_phys_alloc(size, align) are equivalent as both try to
allocate 'size' bytes with 'align' alignment anywhere in the memory and
panic if hte allocation fails.

The conversion is done using the following semantic patch:

  @@
  expression size, align;
  @@
  - memblock_alloc_base(size, align, MEMBLOCK_ALLOC_ANYWHERE)
  + memblock_phys_alloc(size, align)

Link: http://lkml.kernel.org/r/1548057848-15136-4-git-send-email-rppt@linux.ibm.com
Signed-off-by: Mike Rapoport <rppt@linux.ibm.com>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Christophe Leroy <christophe.leroy@c-s.fr>
Cc: Christoph Hellwig <hch@lst.de>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Dennis Zhou <dennis@kernel.org>
Cc: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Greentime Hu <green.hu@gmail.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Guan Xuetao <gxt@pku.edu.cn>
Cc: Guo Ren <guoren@kernel.org>
Cc: Guo Ren <ren_guo@c-sky.com> [c-sky]
Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
Cc: Juergen Gross <jgross@suse.com> [Xen]
Cc: Mark Salter <msalter@redhat.com>
Cc: Matt Turner <mattst88@gmail.com>
Cc: Max Filippov <jcmvbkbc@gmail.com>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: Michal Simek <monstr@monstr.eu>
Cc: Paul Burton <paul.burton@mips.com>
Cc: Petr Mladek <pmladek@suse.com>
Cc: Richard Weinberger <richard@nod.at>
Cc: Rich Felker <dalias@libc.org>
Cc: Rob Herring <robh+dt@kernel.org>
Cc: Rob Herring <robh@kernel.org>
Cc: Russell King <linux@armlinux.org.uk>
Cc: Stafford Horne <shorne@gmail.com>
Cc: Tony Luck <tony.luck@intel.com>
Cc: Vineet Gupta <vgupta@synopsys.com>
Cc: Yoshinori Sato <ysato@users.sourceforge.jp>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
arch/arm/mm/init.c
arch/sh/boards/mach-ap325rxa/setup.c
arch/sh/boards/mach-ecovec24/setup.c
arch/sh/boards/mach-kfr2r09/setup.c
arch/sh/boards/mach-migor/setup.c
arch/sh/boards/mach-se/7724/setup.c
arch/xtensa/mm/kasan_init.c

index 478ea8b7db877ae7426ce55d1b61e616bb6dad4e..b76b90eb935680b3fe71843701797037f762d16d 100644 (file)
@@ -205,7 +205,7 @@ phys_addr_t __init arm_memblock_steal(phys_addr_t size, phys_addr_t align)
 
        BUG_ON(!arm_memblock_steal_permitted);
 
-       phys = memblock_alloc_base(size, align, MEMBLOCK_ALLOC_ANYWHERE);
+       phys = memblock_phys_alloc(size, align);
        memblock_free(phys, size);
        memblock_remove(phys, size);
 
index 7899b4f51fdddddfc61adc227453b358e0b444ed..97774424fbee64fb544208ba7e1c7adb909e5eb7 100644 (file)
@@ -556,7 +556,7 @@ static void __init ap325rxa_mv_mem_reserve(void)
        phys_addr_t phys;
        phys_addr_t size = CEU_BUFFER_MEMORY_SIZE;
 
-       phys = memblock_alloc_base(size, PAGE_SIZE, MEMBLOCK_ALLOC_ANYWHERE);
+       phys = memblock_phys_alloc(size, PAGE_SIZE);
        memblock_free(phys, size);
        memblock_remove(phys, size);
 
index 3c59019c4695ec99543192d3348109d11b0792c3..d329bf3be487b5c651a04f7f2fba7649bb49b708 100644 (file)
@@ -1476,12 +1476,12 @@ static void __init ecovec_mv_mem_reserve(void)
        phys_addr_t phys;
        phys_addr_t size = CEU_BUFFER_MEMORY_SIZE;
 
-       phys = memblock_alloc_base(size, PAGE_SIZE, MEMBLOCK_ALLOC_ANYWHERE);
+       phys = memblock_phys_alloc(size, PAGE_SIZE);
        memblock_free(phys, size);
        memblock_remove(phys, size);
        ceu0_dma_membase = phys;
 
-       phys = memblock_alloc_base(size, PAGE_SIZE, MEMBLOCK_ALLOC_ANYWHERE);
+       phys = memblock_phys_alloc(size, PAGE_SIZE);
        memblock_free(phys, size);
        memblock_remove(phys, size);
        ceu1_dma_membase = phys;
index b8bf67c86eab60438fce39b687f6fd1b29b91195..5c258ae9c43af9230c94e2cc887f7172f05337f3 100644 (file)
@@ -630,7 +630,7 @@ static void __init kfr2r09_mv_mem_reserve(void)
        phys_addr_t phys;
        phys_addr_t size = CEU_BUFFER_MEMORY_SIZE;
 
-       phys = memblock_alloc_base(size, PAGE_SIZE, MEMBLOCK_ALLOC_ANYWHERE);
+       phys = memblock_phys_alloc(size, PAGE_SIZE);
        memblock_free(phys, size);
        memblock_remove(phys, size);
 
index 03579faa4ce3efd88cb566577b3bd16ad51a7e1f..193d91bb84bf19fb6386cda18b52000130d75394 100644 (file)
@@ -630,7 +630,7 @@ static void __init migor_mv_mem_reserve(void)
        phys_addr_t phys;
        phys_addr_t size = CEU_BUFFER_MEMORY_SIZE;
 
-       phys = memblock_alloc_base(size, PAGE_SIZE, MEMBLOCK_ALLOC_ANYWHERE);
+       phys = memblock_phys_alloc(size, PAGE_SIZE);
        memblock_free(phys, size);
        memblock_remove(phys, size);
 
index 13c2d3ce78f4ffde8b547ff3f0dd9a27bf747f55..5c7aa37bfd86ff8ae03e83dd1aeaf59ff3df5386 100644 (file)
@@ -963,12 +963,12 @@ static void __init ms7724se_mv_mem_reserve(void)
        phys_addr_t phys;
        phys_addr_t size = CEU_BUFFER_MEMORY_SIZE;
 
-       phys = memblock_alloc_base(size, PAGE_SIZE, MEMBLOCK_ALLOC_ANYWHERE);
+       phys = memblock_phys_alloc(size, PAGE_SIZE);
        memblock_free(phys, size);
        memblock_remove(phys, size);
        ceu0_dma_membase = phys;
 
-       phys = memblock_alloc_base(size, PAGE_SIZE, MEMBLOCK_ALLOC_ANYWHERE);
+       phys = memblock_phys_alloc(size, PAGE_SIZE);
        memblock_free(phys, size);
        memblock_remove(phys, size);
        ceu1_dma_membase = phys;
index 1734cda6bc4ae5f51f3b44ebfe63fb21fe0c2ecb..48dbb03f4f6f5eb6bc5ff7d0373dc9078e0f94e3 100644 (file)
@@ -52,8 +52,7 @@ static void __init populate(void *start, void *end)
 
                for (k = 0; k < PTRS_PER_PTE; ++k, ++j) {
                        phys_addr_t phys =
-                               memblock_alloc_base(PAGE_SIZE, PAGE_SIZE,
-                                                   MEMBLOCK_ALLOC_ANYWHERE);
+                               memblock_phys_alloc(PAGE_SIZE, PAGE_SIZE);
 
                        set_pte(pte + j, pfn_pte(PHYS_PFN(phys), PAGE_KERNEL));
                }