From patchwork Sat Oct 3 03:00:14 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geliang Tang X-Patchwork-Id: 7320011 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 DFD1A9F1B9 for ; Sat, 3 Oct 2015 03:04:07 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 0348D20856 for ; Sat, 3 Oct 2015 03:04:07 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id AEE072084F for ; Sat, 3 Oct 2015 03:04:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751635AbbJCDED (ORCPT ); Fri, 2 Oct 2015 23:04:03 -0400 Received: from m50-134.163.com ([123.125.50.134]:54621 "EHLO m50-134.163.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751569AbbJCDEC (ORCPT ); Fri, 2 Oct 2015 23:04:02 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=163.com; s=s110527; h=From:Subject:Date:Message-Id; bh=C//xrbDsFG522fwPof 3MluP+eOk2xVj6YnGHKqnwo7Y=; b=c9YLyunjg+TAVXCg78jUlrvKu2gODLkXrs GJFQvUXtJLdOInKkuNtQIC1zuZ2dAuk4XIb6n/OkGy+y6gJpb2pNXWb+UKhcA6ql +0rPg/joIRcCoqz26M6qD/PF06SzYB1O0UVUhcDGv9DY2SDZAjuSuPHz3To16GGg iVMYdzbAo= Received: from localhost (unknown [116.77.141.25]) by smtp4 (Coremail) with SMTP id DtGowEAp0k7ERA9WbO+1AA--.6799S3; Sat, 03 Oct 2015 11:00:22 +0800 (CST) From: Geliang Tang To: Doug Ledford , Sean Hefty , Hal Rosenstock , Greg Kroah-Hartman , Steve Wise , Ira Weiny , Matan Barak , Jason Gunthorpe , Michael Wang , Haggai Eran Cc: Geliang Tang , linux-rdma@vger.kernel.org, devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org Subject: [PATCH] RDMA/amso1100: use offset_in_page macro Date: Sat, 3 Oct 2015 11:00:14 +0800 Message-Id: <53f0aa15e8f3df09245cddb23875e16700121550.1443840917.git.geliangtang@163.com> X-Mailer: git-send-email 2.5.0 X-CM-TRANSID: DtGowEAp0k7ERA9WbO+1AA--.6799S3 X-Coremail-Antispam: 1Uf129KBjvJXoWxJrWfXrWfAF1fJw1UArWxXrb_yoW8Xr17pF 4rKw1jkrs8tF1UGF1kX3Z2kFW3Cas7uFyxWFWDG3sY9ryfXF1jqw1rtr9xJr42qrZ2yayY yFyrWr1rZwsrJFUanT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDUYxBIdaVFxhVjvjDU0xZFpf9x07UZ4SwUUUUU= X-Originating-IP: [116.77.141.25] X-CM-SenderInfo: 5jhoxtpqjwt0rj6rljoofrz/1tbivweImVWBNdLpLAAAsf 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/amso1100/c2_alloc.c | 2 +- drivers/staging/rdma/amso1100/c2_provider.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/rdma/amso1100/c2_alloc.c b/drivers/staging/rdma/amso1100/c2_alloc.c index 78d247e..039872d 100644 --- a/drivers/staging/rdma/amso1100/c2_alloc.c +++ b/drivers/staging/rdma/amso1100/c2_alloc.c @@ -131,7 +131,7 @@ void c2_free_mqsp(__be16 *mqsp) *mqsp = (__force __be16) head->head; /* Compute the shared_ptr index */ - idx = ((unsigned long) mqsp & ~PAGE_MASK) >> 1; + idx = (offset_in_page(mqsp)) >> 1; idx -= (unsigned long) &(((struct sp_chunk *) 0)->shared_ptr[0]) >> 1; /* Point this index at the head */ diff --git a/drivers/staging/rdma/amso1100/c2_provider.c b/drivers/staging/rdma/amso1100/c2_provider.c index 25c3f00..956d76b 100644 --- a/drivers/staging/rdma/amso1100/c2_provider.c +++ b/drivers/staging/rdma/amso1100/c2_provider.c @@ -359,7 +359,7 @@ static struct ib_mr *c2_reg_phys_mr(struct ib_pd *ib_pd, for (i = 0; i < num_phys_buf; i++) { - if (buffer_list[i].addr & ~PAGE_MASK) { + if (offset_in_page(buffer_list[i].addr)) { pr_debug("Unaligned Memory Buffer: 0x%x\n", (unsigned int) buffer_list[i].addr); return ERR_PTR(-EINVAL);