Commit e1ab75dd authored by Geliang Tang's avatar Geliang Tang Committed by Greg Kroah-Hartman

IB/ipath: use offset_in_page macro

Use offset_in_page macro instead of (addr & ~PAGE_MASK).
Signed-off-by: default avatarGeliang Tang <geliangtang@163.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent e260e404
...@@ -239,7 +239,7 @@ static int ipath_user_sdma_num_pages(const struct iovec *iov) ...@@ -239,7 +239,7 @@ static int ipath_user_sdma_num_pages(const struct iovec *iov)
/* truncate length to page boundary */ /* truncate length to page boundary */
static int ipath_user_sdma_page_length(unsigned long addr, unsigned long len) 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; 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, ...@@ -298,7 +298,7 @@ static int ipath_user_sdma_pin_pages(const struct ipath_devdata *dd,
dma_addr_t dma_addr = dma_addr_t dma_addr =
dma_map_page(&dd->pcidev->dev, dma_map_page(&dd->pcidev->dev,
pages[j], 0, flen, DMA_TO_DEVICE); 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)) { if (dma_mapping_error(&dd->pcidev->dev, dma_addr)) {
ret = -ENOMEM; ret = -ENOMEM;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment