From: Geliang Tang Date: Sat, 3 Oct 2015 02:43:11 +0000 (+0800) Subject: IB/ipath: use offset_in_page macro X-Git-Tag: firefly_0821_release~176^2~802^2~1158 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=e1ab75dd6212992cdc0803315f29fdefc45735f1;p=firefly-linux-kernel-4.4.55.git IB/ipath: use offset_in_page macro Use offset_in_page macro instead of (addr & ~PAGE_MASK). Signed-off-by: Geliang Tang Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/rdma/ipath/ipath_user_sdma.c b/drivers/staging/rdma/ipath/ipath_user_sdma.c index cc04b7ba3488..e82b3ee2dbe0 100644 --- a/drivers/staging/rdma/ipath/ipath_user_sdma.c +++ b/drivers/staging/rdma/ipath/ipath_user_sdma.c @@ -239,7 +239,7 @@ static int ipath_user_sdma_num_pages(const struct iovec *iov) /* truncate length to page boundary */ static int ipath_user_sdma_page_length(unsigned long addr, unsigned long len) { - const unsigned long offset = addr & ~PAGE_MASK; + const unsigned long offset = offset_in_page(addr); return ((offset + len) > PAGE_SIZE) ? (PAGE_SIZE - offset) : len; } @@ -298,7 +298,7 @@ static int ipath_user_sdma_pin_pages(const struct ipath_devdata *dd, dma_addr_t dma_addr = dma_map_page(&dd->pcidev->dev, pages[j], 0, flen, DMA_TO_DEVICE); - unsigned long fofs = addr & ~PAGE_MASK; + unsigned long fofs = offset_in_page(addr); if (dma_mapping_error(&dd->pcidev->dev, dma_addr)) { ret = -ENOMEM;