* [PATCH] kernel/memremap.c: use ALIGN/ALIGN_DOWN to calculate align_start/end
@ 2019-06-14 6:01 Wei Yang
2019-06-14 6:06 ` Dan Williams
0 siblings, 1 reply; 3+ messages in thread
From: Wei Yang @ 2019-06-14 6:01 UTC (permalink / raw)
To: linux-kernel
Cc: akpm, dan.j.williams, jglisse, dave.jiang, osalvador, mhocko, Wei Yang
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
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] kernel/memremap.c: use ALIGN/ALIGN_DOWN to calculate align_start/end
2019-06-14 6:01 [PATCH] kernel/memremap.c: use ALIGN/ALIGN_DOWN to calculate align_start/end Wei Yang
@ 2019-06-14 6:06 ` Dan Williams
2019-06-14 8:08 ` Wei Yang
0 siblings, 1 reply; 3+ messages in thread
From: Dan Williams @ 2019-06-14 6:06 UTC (permalink / raw)
To: Wei Yang
Cc: Linux Kernel Mailing List, Andrew Morton,
Jérôme Glisse, Dave Jiang, Oscar Salvador,
Michal Hocko
On Thu, Jun 13, 2019 at 11:02 PM Wei Yang <richardw.yang@linux.intel.com> wrote:
>
> The purpose of align_start/end is to expand to SECTION boundary. Use
> ALIGN/ALIGN_DOWN directly is more self-explain and clean.
I'm actively trying to kill this code [1] so I don't see the need for
this patch.
[1]: https://lore.kernel.org/lkml/155977193326.2443951.14201009973429527491.stgit@dwillia2-desk3.amr.corp.intel.com/
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] kernel/memremap.c: use ALIGN/ALIGN_DOWN to calculate align_start/end
2019-06-14 6:06 ` Dan Williams
@ 2019-06-14 8:08 ` Wei Yang
0 siblings, 0 replies; 3+ messages in thread
From: Wei Yang @ 2019-06-14 8:08 UTC (permalink / raw)
To: Dan Williams
Cc: Wei Yang, Linux Kernel Mailing List, Andrew Morton,
Jérôme Glisse, Dave Jiang, Oscar Salvador,
Michal Hocko
On Thu, Jun 13, 2019 at 11:06:13PM -0700, Dan Williams wrote:
>On Thu, Jun 13, 2019 at 11:02 PM Wei Yang <richardw.yang@linux.intel.com> wrote:
>>
>> The purpose of align_start/end is to expand to SECTION boundary. Use
>> ALIGN/ALIGN_DOWN directly is more self-explain and clean.
>
>I'm actively trying to kill this code [1] so I don't see the need for
>this patch.
>
>[1]: https://lore.kernel.org/lkml/155977193326.2443951.14201009973429527491.stgit@dwillia2-desk3.amr.corp.intel.com/
Ah, thanks :-)
--
Wei Yang
Help you, Help me
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2019-06-14 8:09 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-06-14 6:01 [PATCH] kernel/memremap.c: use ALIGN/ALIGN_DOWN to calculate align_start/end Wei Yang
2019-06-14 6:06 ` Dan Williams
2019-06-14 8:08 ` Wei Yang
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).