* [PATCH 2/2] s390/crash_dump: Use PFN_PHYS and PFN_DOWN macros
@ 2015-09-15 18:54 Alexander Kuleshov
2015-09-18 11:19 ` Heiko Carstens
0 siblings, 1 reply; 2+ messages in thread
From: Alexander Kuleshov @ 2015-09-15 18:54 UTC (permalink / raw)
To: Martin Schwidefsky
Cc: Heiko Carstens, Michael Holzheu, Tony Luck, David Hildenbrand,
linux-s390, linux-kernel, Alexander Kuleshov
The <linux/pfn.h> provides PFN_PHYS and PFN_DOWN macros for the
getting page frame number and physical address of a page frame number.
This patch replaces (pfn << PAGE_SHIFT) and (addr >> PAGE_SHIFT)
expressions with the PFN_PHYS and PFN_DOWN macros.
Signed-off-by: Alexander Kuleshov <kuleshovmail@gmail.com>
---
arch/s390/kernel/crash_dump.c | 18 ++++++++++--------
1 file changed, 10 insertions(+), 8 deletions(-)
diff --git a/arch/s390/kernel/crash_dump.c b/arch/s390/kernel/crash_dump.c
index 1e4fcfa..f8da32c 100644
--- a/arch/s390/kernel/crash_dump.c
+++ b/arch/s390/kernel/crash_dump.c
@@ -136,7 +136,7 @@ ssize_t copy_oldmem_page(unsigned long pfn, char *buf, size_t csize,
if (!csize)
return 0;
- src = (pfn << PAGE_SHIFT) + offset;
+ src = (PFN_PHYS(pfn)) + offset;
if (OLDMEM_BASE)
return copy_oldmem_page_kdump(buf, csize, src, userbuf);
else
@@ -156,16 +156,17 @@ static int remap_oldmem_pfn_range_kdump(struct vm_area_struct *vma,
unsigned long size_old;
int rc;
- if (pfn < OLDMEM_SIZE >> PAGE_SHIFT) {
- size_old = min(size, OLDMEM_SIZE - (pfn << PAGE_SHIFT));
+ if (pfn < PFN_DOWN(OLDMEM_SIZE)) {
+ size_old = min(size,
+ OLDMEM_SIZE - (unsigned long)(PFN_PHYS(pfn)));
rc = remap_pfn_range(vma, from,
- pfn + (OLDMEM_BASE >> PAGE_SHIFT),
+ pfn + (PFN_DOWN(OLDMEM_BASE)),
size_old, prot);
if (rc || size == size_old)
return rc;
size -= size_old;
from += size_old;
- pfn += size_old >> PAGE_SHIFT;
+ pfn += PFN_DOWN(size_old);
}
return remap_pfn_range(vma, from, pfn, size, prot);
}
@@ -184,13 +185,14 @@ static int remap_oldmem_pfn_range_zfcpdump(struct vm_area_struct *vma,
unsigned long hsa_end = sclp.hsa_size;
unsigned long size_hsa;
- if (pfn < hsa_end >> PAGE_SHIFT) {
- size_hsa = min(size, hsa_end - (pfn << PAGE_SHIFT));
+ if (pfn < PFN_DOWN(hsa_end)) {
+ size_hsa = min(size,
+ hsa_end - (unsigned long)(PFN_PHYS(pfn)));
if (size == size_hsa)
return 0;
size -= size_hsa;
from += size_hsa;
- pfn += size_hsa >> PAGE_SHIFT;
+ pfn += PFN_DOWN(size_hsa);
}
return remap_pfn_range(vma, from, pfn, size, prot);
}
--
2.5.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH 2/2] s390/crash_dump: Use PFN_PHYS and PFN_DOWN macros
2015-09-15 18:54 [PATCH 2/2] s390/crash_dump: Use PFN_PHYS and PFN_DOWN macros Alexander Kuleshov
@ 2015-09-18 11:19 ` Heiko Carstens
0 siblings, 0 replies; 2+ messages in thread
From: Heiko Carstens @ 2015-09-18 11:19 UTC (permalink / raw)
To: Alexander Kuleshov
Cc: Martin Schwidefsky, Michael Holzheu, Tony Luck, David Hildenbrand,
linux-s390, linux-kernel
On Wed, Sep 16, 2015 at 12:54:38AM +0600, Alexander Kuleshov wrote:
> The <linux/pfn.h> provides PFN_PHYS and PFN_DOWN macros for the
> getting page frame number and physical address of a page frame number.
> This patch replaces (pfn << PAGE_SHIFT) and (addr >> PAGE_SHIFT)
> expressions with the PFN_PHYS and PFN_DOWN macros.
>
> Signed-off-by: Alexander Kuleshov <kuleshovmail@gmail.com>
> ---
> arch/s390/kernel/crash_dump.c | 18 ++++++++++--------
> 1 file changed, 10 insertions(+), 8 deletions(-)
>
> diff --git a/arch/s390/kernel/crash_dump.c b/arch/s390/kernel/crash_dump.c
> index 1e4fcfa..f8da32c 100644
> --- a/arch/s390/kernel/crash_dump.c
> +++ b/arch/s390/kernel/crash_dump.c
> @@ -136,7 +136,7 @@ ssize_t copy_oldmem_page(unsigned long pfn, char *buf, size_t csize,
>
> if (!csize)
> return 0;
> - src = (pfn << PAGE_SHIFT) + offset;
> + src = (PFN_PHYS(pfn)) + offset;
> if (OLDMEM_BASE)
> return copy_oldmem_page_kdump(buf, csize, src, userbuf);
> else
> @@ -156,16 +156,17 @@ static int remap_oldmem_pfn_range_kdump(struct vm_area_struct *vma,
> unsigned long size_old;
> int rc;
>
> - if (pfn < OLDMEM_SIZE >> PAGE_SHIFT) {
> - size_old = min(size, OLDMEM_SIZE - (pfn << PAGE_SHIFT));
> + if (pfn < PFN_DOWN(OLDMEM_SIZE)) {
> + size_old = min(size,
> + OLDMEM_SIZE - (unsigned long)(PFN_PHYS(pfn)));
Cleanup patches like this are supposed to increase readability. That's
certainly not the case here.
Therefore I'm not applying this one.
Thanks,
Heiko
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-09-18 11:19 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-09-15 18:54 [PATCH 2/2] s390/crash_dump: Use PFN_PHYS and PFN_DOWN macros Alexander Kuleshov
2015-09-18 11:19 ` Heiko Carstens
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).