From patchwork Sat Oct 3 02:43:11 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geliang Tang X-Patchwork-Id: 7319991 Return-Path: X-Original-To: patchwork-linux-rdma@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 6D1559F1D5 for ; Sat, 3 Oct 2015 02:45:40 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 8888420856 for ; Sat, 3 Oct 2015 02:45:39 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id AA3692084F for ; Sat, 3 Oct 2015 02:45:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751519AbbJCCou (ORCPT ); Fri, 2 Oct 2015 22:44:50 -0400 Received: from m50-135.163.com ([123.125.50.135]:33608 "EHLO m50-135.163.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751326AbbJCCou (ORCPT ); Fri, 2 Oct 2015 22:44:50 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=163.com; s=s110527; h=From:Subject:Date:Message-Id; bh=O+jSOpr1QyAfykZxD6 FdF6NC/pkVQhYso4S0j/JgNSU=; b=j68jFNi89RKbACIsfpJmchTsT9KFMN1oiD VzjVEH/e5AwTVzSGrmHUJV+4DjplFQ4tNM+47e2QUGLCzi1seGUi91OTyI5FXeWs kwuBvjwFrvOCGaOk+ivJr+HK2GZ7TerrNSVrC5p+/9Ne31q7By/eO4jj3Pw/UQs+ N9Sn4nOTQ= Received: from localhost (unknown [116.77.141.25]) by smtp5 (Coremail) with SMTP id D9GowAB31lDEQA9WpKk0Cw--.55866S3; Sat, 03 Oct 2015 10:43:18 +0800 (CST) From: Geliang Tang To: Mike Marciniszyn , Doug Ledford , Sean Hefty , Hal Rosenstock , Greg Kroah-Hartman Cc: Geliang Tang , linux-rdma@vger.kernel.org, devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org Subject: [PATCH] IB/ipath: use offset_in_page macro Date: Sat, 3 Oct 2015 10:43:11 +0800 Message-Id: X-Mailer: git-send-email 2.5.0 X-CM-TRANSID: D9GowAB31lDEQA9WpKk0Cw--.55866S3 X-Coremail-Antispam: 1Uf129KBjvJXoW7Wr1DGFyrWF48urW5tr4fKrg_yoW8JrW5pr WUGan8Cr42q3WYkr1xAr4DXFy5C3s8GrWIkF12y3sxZ3ySqF1YvF1Fva4DKF4xJF95ArW7 JayUKry5Z34UJ3JanT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDUYxBIdaVFxhVjvjDU0xZFpf9x07U75rxUUUUU= X-Originating-IP: [116.77.141.25] X-CM-SenderInfo: 5jhoxtpqjwt0rj6rljoofrz/1tbiNQaImVSIJPOTDAAAs2 Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, FREEMAIL_FROM,RCVD_IN_DNSWL_HI,T_DKIM_INVALID,T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Use offset_in_page macro instead of (addr & ~PAGE_MASK). Signed-off-by: Geliang Tang --- 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;