int nid, pgprot_t prot);
 extern int remove_section_mapping(unsigned long start, unsigned long end);
 
-#ifdef CONFIG_PPC_BOOK3S_64
-extern int resize_hpt_for_hotplug(unsigned long new_mem_size);
-#else
-static inline int resize_hpt_for_hotplug(unsigned long new_mem_size) { return 0; }
-#endif
-
 #ifdef CONFIG_NUMA
 extern int hot_add_scn_to_nid(unsigned long scn_addr);
 #else
 
 }
 
 #ifdef CONFIG_MEMORY_HOTPLUG
-int resize_hpt_for_hotplug(unsigned long new_mem_size)
+static int resize_hpt_for_hotplug(unsigned long new_mem_size)
 {
        unsigned target_hpt_shift;
 
                return -1;
        }
 
+       resize_hpt_for_hotplug(memblock_phys_mem_size());
+
        rc = htab_bolt_mapping(start, end, __pa(start),
                               pgprot_val(prot), mmu_linear_psize,
                               mmu_kernel_ssize);
        int rc = htab_remove_mapping(start, end, mmu_linear_psize,
                                     mmu_kernel_ssize);
        WARN_ON(rc < 0);
+
+       if (resize_hpt_for_hotplug(memblock_phys_mem_size()) == -ENOSPC)
+               pr_warn("Hash collision while resizing HPT\n");
+
        return rc;
 }
 #endif /* CONFIG_MEMORY_HOTPLUG */
 
        unsigned long nr_pages = size >> PAGE_SHIFT;
        int rc;
 
-       resize_hpt_for_hotplug(memblock_phys_mem_size());
-
        start = (unsigned long)__va(start);
        rc = create_section_mapping(start, start + size, nid,
                                    params->pgprot);
         * hit that section of memory
         */
        vm_unmap_aliases();
-
-       if (resize_hpt_for_hotplug(memblock_phys_mem_size()) == -ENOSPC)
-               pr_warn("Hash collision while resizing HPT\n");
 }
 #endif