Skip to content

Commit

Permalink
mm/early_ioremap: use offset_in_page macro
Browse files Browse the repository at this point in the history
linux/mm.h provides offset_in_page() macro.  Let's use already predefined
macro instead of (addr & ~PAGE_MASK).

Signed-off-by: Alexander Kuleshov <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
0xAX authored and torvalds committed Nov 6, 2015
1 parent e7bbdd0 commit 5d57b01
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions mm/early_ioremap.c
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ __early_ioremap(resource_size_t phys_addr, unsigned long size, pgprot_t prot)
/*
* Mappings have to be page-aligned
*/
offset = phys_addr & ~PAGE_MASK;
offset = offset_in_page(phys_addr);
phys_addr &= PAGE_MASK;
size = PAGE_ALIGN(last_addr + 1) - phys_addr;

Expand Down Expand Up @@ -189,7 +189,7 @@ void __init early_iounmap(void __iomem *addr, unsigned long size)
if (WARN_ON(virt_addr < fix_to_virt(FIX_BTMAP_BEGIN)))
return;

offset = virt_addr & ~PAGE_MASK;
offset = offset_in_page(virt_addr);
nrpages = PAGE_ALIGN(offset + size) >> PAGE_SHIFT;

idx = FIX_BTMAP_BEGIN - NR_FIX_BTMAPS*slot;
Expand Down Expand Up @@ -234,7 +234,7 @@ void __init copy_from_early_mem(void *dest, phys_addr_t src, unsigned long size)
char *p;

while (size) {
slop = src & ~PAGE_MASK;
slop = offset_in_page(src);
clen = size;
if (clen > MAX_MAP_CHUNK - slop)
clen = MAX_MAP_CHUNK - slop;
Expand Down

0 comments on commit 5d57b01

Please sign in to comment.