drivers/base/memory: rename base_memory_block_id to memory_block_id
memory_block may have a larger granularity than section, this is why we have base_section_nr. But base_memory_block_id seems a little misleading, since there is no larger granularity concept which groups several memory_block. What we need here is the exact memory_block_id to a section_nr. Let's rename it to make it more precise. Signed-off-by: Wei Yang <richard.weiyang@linux.alibaba.com> Link: https://lore.kernel.org/r/20200623025701.2016-2-richard.weiyang@linux.alibaba.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
Родитель
40ba2cde77
Коммит
178bdbed3e
|
@ -50,14 +50,14 @@ int memhp_online_type_from_str(const char *str)
|
||||||
|
|
||||||
static int sections_per_block;
|
static int sections_per_block;
|
||||||
|
|
||||||
static inline unsigned long base_memory_block_id(unsigned long section_nr)
|
static inline unsigned long memory_block_id(unsigned long section_nr)
|
||||||
{
|
{
|
||||||
return section_nr / sections_per_block;
|
return section_nr / sections_per_block;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline unsigned long pfn_to_block_id(unsigned long pfn)
|
static inline unsigned long pfn_to_block_id(unsigned long pfn)
|
||||||
{
|
{
|
||||||
return base_memory_block_id(pfn_to_section_nr(pfn));
|
return memory_block_id(pfn_to_section_nr(pfn));
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline unsigned long phys_to_block_id(unsigned long phys)
|
static inline unsigned long phys_to_block_id(unsigned long phys)
|
||||||
|
@ -517,7 +517,7 @@ static struct memory_block *find_memory_block_by_id(unsigned long block_id)
|
||||||
*/
|
*/
|
||||||
struct memory_block *find_memory_block(struct mem_section *section)
|
struct memory_block *find_memory_block(struct mem_section *section)
|
||||||
{
|
{
|
||||||
unsigned long block_id = base_memory_block_id(__section_nr(section));
|
unsigned long block_id = memory_block_id(__section_nr(section));
|
||||||
|
|
||||||
return find_memory_block_by_id(block_id);
|
return find_memory_block_by_id(block_id);
|
||||||
}
|
}
|
||||||
|
@ -608,7 +608,7 @@ static int add_memory_block(unsigned long base_section_nr)
|
||||||
|
|
||||||
if (section_count == 0)
|
if (section_count == 0)
|
||||||
return 0;
|
return 0;
|
||||||
return init_memory_block(base_memory_block_id(base_section_nr),
|
return init_memory_block(memory_block_id(base_section_nr),
|
||||||
MEM_ONLINE);
|
MEM_ONLINE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче