linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] IB/ipath: use offset_in_page macro
@ 2015-10-03  2:43 Geliang Tang
  0 siblings, 0 replies; only message in thread
From: Geliang Tang @ 2015-10-03  2:43 UTC (permalink / raw)
  To: Mike Marciniszyn, Doug Ledford, Sean Hefty, Hal Rosenstock,
	Greg Kroah-Hartman
  Cc: Geliang Tang, linux-rdma, devel, linux-kernel

Use offset_in_page macro instead of (addr & ~PAGE_MASK).

Signed-off-by: Geliang Tang <geliangtang@163.com>
---
 drivers/staging/rdma/ipath/ipath_user_sdma.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/rdma/ipath/ipath_user_sdma.c b/drivers/staging/rdma/ipath/ipath_user_sdma.c
index cc04b7b..e82b3ee 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;
-- 
2.5.0



^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2015-10-03  2:44 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-10-03  2:43 [PATCH] IB/ipath: use offset_in_page macro Geliang Tang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).