/*
         * 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;
 
        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;
        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;