The patch titled Subject: drivers-base-memoryc-get-rid-of-find_memory_block_hinted-v3 has been added to the -mm tree. Its filename is drivers-base-memoryc-get-rid-of-find_memory_block_hinted-v3.patch This patch should soon appear at http://ozlabs.org/~akpm/mmots/broken-out/drivers-base-memoryc-get-rid-of-find_memory_block_hinted-v3.patch and later at http://ozlabs.org/~akpm/mmotm/broken-out/drivers-base-memoryc-get-rid-of-find_memory_block_hinted-v3.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-memoryc-get-rid-of-find_memory_block_hinted-v3 No longer needed, let's remove it. Also, drop the "hint" parameter completely from "find_memory_block_by_id", as nobody needs it anymore. Link: http://lkml.kernel.org/r/20190620183139.4352-7-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> Cc: David Hildenbrand <david@xxxxxxxxxx> Cc: Stephen Rothwell <sfr@xxxxxxxxxxxxxxxx> Cc: Pavel Tatashin <pasha.tatashin@xxxxxxxxxx> Cc: Andrew Banman <andrew.banman@xxxxxxx> Cc: Mike Travis <mike.travis@xxxxxxx> Cc: Oscar Salvador <osalvador@xxxxxxxx> Cc: Michal Hocko <mhocko@xxxxxxxx> Cc: Wei Yang <richard.weiyang@xxxxxxxxx> Cc: Arun KS <arunks@xxxxxxxxxxxxxx> Cc: Qian Cai <cai@xxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- drivers/base/memory.c | 27 +++++++++------------------ 1 file changed, 9 insertions(+), 18 deletions(-) --- a/drivers/base/memory.c~drivers-base-memoryc-get-rid-of-find_memory_block_hinted-v3 +++ a/drivers/base/memory.c @@ -588,22 +588,13 @@ int __weak arch_get_memory_phys_device(u return 0; } -/* - * 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(unsigned long block_id, - struct memory_block *hint) +/* A reference for the returned memory block device is acquired. */ +static struct memory_block *find_memory_block_by_id(unsigned long block_id) { - struct device *hintdev = hint ? &hint->dev : NULL; struct device *dev; - dev = subsys_find_device_by_id(&memory_subsys, block_id, hintdev); - if (hint) - put_device(&hint->dev); - if (!dev) - return NULL; - return to_memory_block(dev); + dev = subsys_find_device_by_id(&memory_subsys, block_id, NULL); + return dev ? to_memory_block(dev) : NULL; } /* @@ -618,7 +609,7 @@ struct memory_block *find_memory_block(s { unsigned long block_id = base_memory_block_id(__section_nr(section)); - return find_memory_block_by_id(block_id, hint); + return find_memory_block_by_id(block_id); } static struct attribute *memory_memblk_attrs[] = { @@ -669,7 +660,7 @@ static int init_memory_block(struct memo unsigned long start_pfn; int ret = 0; - mem = find_memory_block_by_id(block_id, NULL); + mem = find_memory_block_by_id(block_id); if (mem) { put_device(&mem->dev); return -EEXIST; @@ -749,7 +740,7 @@ int create_memory_block_devices(unsigned end_block_id = block_id; for (block_id = start_block_id; block_id != end_block_id; block_id++) { - mem = find_memory_block_by_id(block_id, NULL); + mem = find_memory_block_by_id(block_id); mem->section_count = 0; unregister_memory(mem); } @@ -776,7 +767,7 @@ void remove_memory_block_devices(unsigne mutex_lock(&mem_sysfs_mutex); for (block_id = start_block_id; block_id != end_block_id; block_id++) { - mem = find_memory_block_by_id(block_id, NULL); + mem = find_memory_block_by_id(block_id); if (WARN_ON_ONCE(!mem)) continue; mem->section_count = 0; @@ -876,7 +867,7 @@ int walk_memory_blocks(unsigned long sta int ret = 0; for (block_id = start_block_id; block_id <= end_block_id; block_id++) { - mem = find_memory_block_by_id(block_id, NULL); + mem = find_memory_block_by_id(block_id); if (!mem) continue; _ 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 mm-section-numbers-use-the-type-unsigned-long-v3.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 drivers-base-memoryc-get-rid-of-find_memory_block_hinted-v3.patch