mirror of
https://github.com/linux-msm/laptops-kernel.git
synced 2026-08-13 14:19:53 -07:00
mm/memory_hotplug: add mhp_online_type_to_str() and export string helpers
Add mhp_online_type_to_str() as the inverse of mhp_online_type_from_str(), and export both so a driver can render and parse the memory online type through its own sysfs interface. Link: https://lore.kernel.org/20260712154505.3564379-3-gourry@gourry.net Signed-off-by: Gregory Price <gourry@gourry.net> Reviewed-by: Dave Jiang <dave.jiang@intel.com> Acked-by: David Hildenbrand (Arm) <david@kernel.org> Reviewed-by: Dan Williams <djbw@kernel.org> Cc: Alison Schofield <alison.schofield@intel.com> Cc: Danilo Krummrich <dakr@kernel.org> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Cc: Hannes Reinecke <hare@suse.de> Cc: Liam R. Howlett <liam@infradead.org> Cc: Lorenzo Stoakes <ljs@kernel.org> Cc: Michal Hocko <mhocko@suse.com> Cc: Mike Rapoport <rppt@kernel.org> Cc: Oscar Salvador <osalvador@suse.de> Cc: Pankaj Gupta <pankaj.gupta@amd.com> Cc: "Rafael J. Wysocki" <rafael@kernel.org> Cc: Shuah Khan <shuah@kernel.org> Cc: Suren Baghdasaryan <surenb@google.com> Cc: Vishal Verma <vishal.l.verma@intel.com> Cc: Vlastimil Babka <vbabka@kernel.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
This commit is contained in:
committed by
Andrew Morton
parent
23860341bf
commit
0a69590680
@@ -46,6 +46,15 @@ int mhp_online_type_from_str(const char *str)
|
||||
}
|
||||
return -EINVAL;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(mhp_online_type_from_str);
|
||||
|
||||
const char *mhp_online_type_to_str(int online_type)
|
||||
{
|
||||
if (online_type < 0 || online_type >= (int)ARRAY_SIZE(online_type_to_str))
|
||||
return NULL;
|
||||
return online_type_to_str[online_type];
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(mhp_online_type_to_str);
|
||||
|
||||
#define to_memory_block(dev) container_of(dev, struct memory_block, dev)
|
||||
|
||||
|
||||
@@ -127,6 +127,7 @@ extern int arch_add_memory(int nid, u64 start, u64 size,
|
||||
extern u64 max_mem_size;
|
||||
|
||||
extern int mhp_online_type_from_str(const char *str);
|
||||
const char *mhp_online_type_to_str(int online_type);
|
||||
|
||||
/* If movable_node boot option specified */
|
||||
extern bool movable_node_enabled;
|
||||
|
||||
Reference in New Issue
Block a user