From: Wei Yang <richardw.yang@linux.intel.com>
To: linux-kernel@vger.kernel.org
Cc: akpm@linux-foundation.org, dan.j.williams@intel.com,
jglisse@redhat.com, dave.jiang@intel.com, osalvador@suse.com,
mhocko@suse.com, Wei Yang <richardw.yang@linux.intel.com>
Subject: [PATCH] kernel/memremap.c: use ALIGN/ALIGN_DOWN to calculate align_start/end
Date: Fri, 14 Jun 2019 14:01:43 +0800 [thread overview]
Message-ID: <20190614060143.17867-1-richardw.yang@linux.intel.com> (raw)
The purpose of align_start/end is to expand to SECTION boundary. Use
ALIGN/ALIGN_DOWN directly is more self-explain and clean.
Signed-off-by: Wei Yang <richardw.yang@linux.intel.com>
---
kernel/memremap.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/kernel/memremap.c b/kernel/memremap.c
index 1490e63f69a9..53cf751f0721 100644
--- a/kernel/memremap.c
+++ b/kernel/memremap.c
@@ -159,10 +159,9 @@ void *devm_memremap_pages(struct device *dev, struct dev_pagemap *pgmap)
if (!pgmap->ref || !pgmap->kill)
return ERR_PTR(-EINVAL);
- align_start = res->start & ~(SECTION_SIZE - 1);
- align_size = ALIGN(res->start + resource_size(res), SECTION_SIZE)
- - align_start;
- align_end = align_start + align_size - 1;
+ align_start = ALIGN_DOWN(res->start, SECTION_SIZE);
+ align_end = ALIGN(res->end, SECTION_SIZE) - 1;
+ align_size = align_end - align_start + 1;
conflict_pgmap = get_dev_pagemap(PHYS_PFN(align_start), NULL);
if (conflict_pgmap) {
--
2.19.1
next reply other threads:[~2019-06-14 6:02 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-06-14 6:01 Wei Yang [this message]
2019-06-14 6:06 ` [PATCH] kernel/memremap.c: use ALIGN/ALIGN_DOWN to calculate align_start/end Dan Williams
2019-06-14 8:08 ` Wei Yang
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=20190614060143.17867-1-richardw.yang@linux.intel.com \
--to=richardw.yang@linux.intel.com \
--cc=akpm@linux-foundation.org \
--cc=dan.j.williams@intel.com \
--cc=dave.jiang@intel.com \
--cc=jglisse@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mhocko@suse.com \
--cc=osalvador@suse.com \
/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;
as well as URLs for NNTP newsgroup(s).