The patch titled Subject: drivers/base/memory: Use "unsigned long" for block ids has been added to the -mm tree. Its filename is drivers-base-memory-use-unsigned-long-for-block-ids.patch This patch should soon appear at http://ozlabs.org/~akpm/mmots/broken-out/drivers-base-memory-use-unsigned-long-for-block-ids.patch and later at http://ozlabs.org/~akpm/mmotm/broken-out/drivers-base-memory-use-unsigned-long-for-block-ids.patch Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/process/submit-checklist.rst when testing your code *** The -mm tree is included into linux-next and is updated there every 3-4 working days ------------------------------------------------------ From: David Hildenbrand <david@xxxxxxxxxx> Subject: drivers/base/memory: Use "unsigned long" for block ids Block ids are just shifted section numbers, so let's also use "unsigned long" for them, too. Link: http://lkml.kernel.org/r/20190614100114.311-3-david@xxxxxxxxxx Signed-off-by: David Hildenbrand <david@xxxxxxxxxx> Reviewed-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> Cc: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> Cc: "Rafael J. Wysocki" <rafael@xxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- drivers/base/memory.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) --- a/drivers/base/memory.c~drivers-base-memory-use-unsigned-long-for-block-ids +++ a/drivers/base/memory.c @@ -34,12 +34,12 @@ static DEFINE_MUTEX(mem_sysfs_mutex); static int sections_per_block; -static inline int base_memory_block_id(unsigned long section_nr) +static inline unsigned long base_memory_block_id(unsigned long section_nr) { return section_nr / sections_per_block; } -static inline int pfn_to_block_id(unsigned long pfn) +static inline unsigned long pfn_to_block_id(unsigned long pfn) { return base_memory_block_id(pfn_to_section_nr(pfn)); } @@ -587,7 +587,7 @@ int __weak arch_get_memory_phys_device(u * A reference for the returned object is held and the reference for the * hinted object is released. */ -static struct memory_block *find_memory_block_by_id(int block_id, +static struct memory_block *find_memory_block_by_id(unsigned long block_id, struct memory_block *hint) { struct device *hintdev = hint ? &hint->dev : NULL; @@ -604,7 +604,7 @@ static struct memory_block *find_memory_ struct memory_block *find_memory_block_hinted(struct mem_section *section, struct memory_block *hint) { - int block_id = base_memory_block_id(__section_nr(section)); + unsigned long block_id = base_memory_block_id(__section_nr(section)); return find_memory_block_by_id(block_id, hint); } @@ -663,8 +663,8 @@ int register_memory(struct memory_block return ret; } -static int init_memory_block(struct memory_block **memory, int block_id, - unsigned long state) +static int init_memory_block(struct memory_block **memory, + unsigned long block_id, unsigned long state) { struct memory_block *mem; unsigned long start_pfn; @@ -730,8 +730,8 @@ static void unregister_memory(struct mem */ int create_memory_block_devices(unsigned long start, unsigned long size) { - const int start_block_id = pfn_to_block_id(PFN_DOWN(start)); - int end_block_id = pfn_to_block_id(PFN_DOWN(start + size)); + const unsigned long start_block_id = pfn_to_block_id(PFN_DOWN(start)); + unsigned long end_block_id = pfn_to_block_id(PFN_DOWN(start + size)); struct memory_block *mem; unsigned long block_id; int ret = 0; @@ -767,10 +767,10 @@ int create_memory_block_devices(unsigned */ void remove_memory_block_devices(unsigned long start, unsigned long size) { - const int start_block_id = pfn_to_block_id(PFN_DOWN(start)); - const int end_block_id = pfn_to_block_id(PFN_DOWN(start + size)); + const unsigned long start_block_id = pfn_to_block_id(PFN_DOWN(start)); + const unsigned long end_block_id = pfn_to_block_id(PFN_DOWN(start + size)); struct memory_block *mem; - int block_id; + unsigned long block_id; if (WARN_ON_ONCE(!IS_ALIGNED(start, memory_block_size_bytes()) || !IS_ALIGNED(size, memory_block_size_bytes()))) _ Patches currently in -mm which might be from david@xxxxxxxxxx are mm-memory_hotplug-simplify-and-fix-check_hotplug_memory_range.patch s390x-mm-fail-when-an-altmap-is-used-for-arch_add_memory.patch s390x-mm-implement-arch_remove_memory.patch arm64-mm-add-temporary-arch_remove_memory-implementation.patch drivers-base-memory-pass-a-block_id-to-init_memory_block.patch mm-memory_hotplug-allow-arch_remove_pages-without-config_memory_hotremove.patch mm-memory_hotplug-create-memory-block-devices-after-arch_add_memory.patch mm-memory_hotplug-drop-mhp_memblock_api.patch mm-memory_hotplug-remove-memory-block-devices-before-arch_remove_memory.patch mm-memory_hotplug-make-unregister_memory_block_under_nodes-never-fail.patch mm-memory_hotplug-remove-zone-parameter-from-sparse_remove_one_section.patch mm-section-numbers-use-the-type-unsigned-long.patch drivers-base-memory-use-unsigned-long-for-block-ids.patch mm-make-register_mem_sect_under_node-static.patch mm-memory_hotplug-rename-walk_memory_range-and-pass-startsize-instead-of-pfns.patch mm-memory_hotplug-move-and-simplify-walk_memory_blocks.patch drivers-base-memoryc-get-rid-of-find_memory_block_hinted.patch