diff --git a/drivers/acpi/acpi_memhotplug.c b/drivers/acpi/acpi_memhotplug.c
index b02fd51e55896e1d3ec291f1f515d96ec72c8a52..e9b9e2db32cf33e0d7ca5d618b61d8a09a4b29c6 100644
--- a/drivers/acpi/acpi_memhotplug.c
+++ b/drivers/acpi/acpi_memhotplug.c
@@ -56,6 +56,9 @@ struct acpi_memory_device {
 	struct list_head res_list;
 };
 
+struct acpi_device *hotplug_mdev[MAX_NUMNODES];
+EXPORT_SYMBOL_GPL(hotplug_mdev);
+
 static acpi_status
 acpi_memory_get_resource(struct acpi_resource *resource, void *context)
 {
@@ -217,6 +220,8 @@ static int acpi_memory_enable_device(struct acpi_memory_device *mem_device)
 		 * Add num_enable even if add_memory() returns -EEXIST, so the
 		 * device is bound to this driver.
 		 */
+
+		hotplug_mdev[node] = mem_device->device;
 		num_enabled++;
 	}
 	if (!num_enabled) {
@@ -240,6 +245,7 @@ static void acpi_memory_remove_memory(struct acpi_memory_device *mem_device)
 	struct acpi_memory_info *info, *n;
 	int nid = acpi_get_node(handle);
 
+	hotplug_mdev[nid] = NULL;
 	list_for_each_entry_safe(info, n, &mem_device->res_list, list) {
 		if (!info->enabled)
 			continue;
diff --git a/include/linux/memory_hotplug.h b/include/linux/memory_hotplug.h
index b9aeabcce49aaea251c7c3e515ed9fba8145e0d9..3debe1f7a6c192e78f52911d343aa0ee5165c8fb 100644
--- a/include/linux/memory_hotplug.h
+++ b/include/linux/memory_hotplug.h
@@ -316,6 +316,8 @@ extern void set_zone_contiguous(struct zone *zone);
 extern void clear_zone_contiguous(struct zone *zone);
 
 #ifdef CONFIG_MEMORY_HOTPLUG
+extern struct acpi_device *hotplug_mdev[MAX_NUMNODES];
+
 extern void __ref free_area_init_core_hotplug(int nid);
 extern int __add_memory(int nid, u64 start, u64 size, mhp_t mhp_flags);
 extern int add_memory(int nid, u64 start, u64 size, mhp_t mhp_flags);