diff options
author | Gavin Shan <gshan@redhat.com> | 2023-01-20 08:57:26 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2023-01-20 16:15:00 +0300 |
commit | 7c09f4281cb6ec0fc202f53924ed6c389c61bf0e (patch) | |
tree | fc50740429024ac5b92d5d10889ae65eda12866e /drivers/base | |
parent | f7d85515bd21902b218370a1a6301f76e4e636ff (diff) | |
download | linux-7c09f4281cb6ec0fc202f53924ed6c389c61bf0e.tar.xz |
drivers/base/memory: Fix comments for phys_index_show()
According to 'admin-guide/mm/memory-hotplug.rst', the memory block ID,
instead of the section index, is shown by '/sys/devices/system/memory/
memoryX/phys_index'.
Fix the comments to match with 'admin-guide/mm/memory-hotplug.rst'.
Besides, use the existing helper memory_block_id() to convert the section
index to the memory block index.
No functional change intended.
Signed-off-by: Gavin Shan <gshan@redhat.com>
Link: https://lore.kernel.org/r/20230120055727.355483-2-gshan@redhat.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/base')
-rw-r--r-- | drivers/base/memory.c | 9 |
1 files changed, 2 insertions, 7 deletions
diff --git a/drivers/base/memory.c b/drivers/base/memory.c index fe98fb8d94e5..b456ac213610 100644 --- a/drivers/base/memory.c +++ b/drivers/base/memory.c @@ -115,18 +115,13 @@ unsigned long __weak memory_block_size_bytes(void) } EXPORT_SYMBOL_GPL(memory_block_size_bytes); -/* - * Show the first physical section index (number) of this memory block. - */ +/* Show the memory block ID, relative to the memory block size */ static ssize_t phys_index_show(struct device *dev, struct device_attribute *attr, char *buf) { struct memory_block *mem = to_memory_block(dev); - unsigned long phys_index; - - phys_index = mem->start_section_nr / sections_per_block; - return sysfs_emit(buf, "%08lx\n", phys_index); + return sysfs_emit(buf, "%08lx\n", memory_block_id(mem->start_section_nr)); } /* |