mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-09-18 22:14:16 +00:00
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>
This commit is contained in:
parent
f7d85515bd
commit
7c09f4281c
1 changed files with 2 additions and 7 deletions
|
@ -115,18 +115,13 @@ unsigned long __weak memory_block_size_bytes(void)
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL_GPL(memory_block_size_bytes);
|
EXPORT_SYMBOL_GPL(memory_block_size_bytes);
|
||||||
|
|
||||||
/*
|
/* Show the memory block ID, relative to the memory block size */
|
||||||
* Show the first physical section index (number) of this memory block.
|
|
||||||
*/
|
|
||||||
static ssize_t phys_index_show(struct device *dev,
|
static ssize_t phys_index_show(struct device *dev,
|
||||||
struct device_attribute *attr, char *buf)
|
struct device_attribute *attr, char *buf)
|
||||||
{
|
{
|
||||||
struct memory_block *mem = to_memory_block(dev);
|
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", memory_block_id(mem->start_section_nr));
|
||||||
|
|
||||||
return sysfs_emit(buf, "%08lx\n", phys_index);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
Loading…
Add table
Reference in a new issue