]> asedeno.scripts.mit.edu Git - linux.git/blobdiff - include/rdma/ib_umem.h
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/hid/hid
[linux.git] / include / rdma / ib_umem.h
index 040d853077c6015fc7ac8ebb40938c1b56ccc5c2..1052d0d62be7d2b5d623717d218b3085054f5614 100644 (file)
@@ -46,7 +46,6 @@ struct ib_umem {
        struct mm_struct       *owning_mm;
        size_t                  length;
        unsigned long           address;
-       int                     page_shift;
        u32 writable : 1;
        u32 is_odp : 1;
        struct work_struct      work;
@@ -58,24 +57,14 @@ struct ib_umem {
 /* Returns the offset of the umem start relative to the first page. */
 static inline int ib_umem_offset(struct ib_umem *umem)
 {
-       return umem->address & (BIT(umem->page_shift) - 1);
-}
-
-/* Returns the first page of an ODP umem. */
-static inline unsigned long ib_umem_start(struct ib_umem *umem)
-{
-       return umem->address - ib_umem_offset(umem);
-}
-
-/* Returns the address of the page after the last one of an ODP umem. */
-static inline unsigned long ib_umem_end(struct ib_umem *umem)
-{
-       return ALIGN(umem->address + umem->length, BIT(umem->page_shift));
+       return umem->address & ~PAGE_MASK;
 }
 
 static inline size_t ib_umem_num_pages(struct ib_umem *umem)
 {
-       return (ib_umem_end(umem) - ib_umem_start(umem)) >> umem->page_shift;
+       return (ALIGN(umem->address + umem->length, PAGE_SIZE) -
+               ALIGN_DOWN(umem->address, PAGE_SIZE)) >>
+              PAGE_SHIFT;
 }
 
 #ifdef CONFIG_INFINIBAND_USER_MEM