From: Wei Yang <richard.weiyang@linux.alibaba.com>
To: gregkh@linuxfoundation.org, rafael@kernel.org
Cc: linux-kernel@vger.kernel.org,
Wei Yang <richard.weiyang@linux.alibaba.com>
Subject: [PATCH 2/2] drivers/base/memory: rename base_memory_block_id to memory_block_id
Date: Tue, 23 Jun 2020 10:57:01 +0800 [thread overview]
Message-ID: <20200623025701.2016-2-richard.weiyang@linux.alibaba.com> (raw)
In-Reply-To: <20200623025701.2016-1-richard.weiyang@linux.alibaba.com>
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>
---
drivers/base/memory.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/base/memory.c b/drivers/base/memory.c
index 35f9a1aa0a2e..4db3c660de83 100644
--- a/drivers/base/memory.c
+++ b/drivers/base/memory.c
@@ -50,14 +50,14 @@ int memhp_online_type_from_str(const char *str)
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;
}
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)
@@ -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)
{
- 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);
}
@@ -608,7 +608,7 @@ static int add_memory_block(unsigned long base_section_nr)
if (section_count == 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);
}
--
2.20.1 (Apple Git-117)
prev parent reply other threads:[~2020-06-23 2:57 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-06-23 2:57 [PATCH 1/2] drivers/base/memory: init_memory_block() first parameter is not necessary Wei Yang
2020-06-23 2:57 ` Wei Yang [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200623025701.2016-2-richard.weiyang@linux.alibaba.com \
--to=richard.weiyang@linux.alibaba.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=rafael@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®