From patchwork Wed Jun 17 14:28:03 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 6626621 Return-Path: X-Original-To: patchwork-linux-arm@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 CF7199F46A for ; Wed, 17 Jun 2015 14:33:01 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 111CD2086A for ; Wed, 17 Jun 2015 14:33:01 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 2C48020804 for ; Wed, 17 Jun 2015 14:33:00 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1Z5EMs-0002xP-5X; Wed, 17 Jun 2015 14:31:06 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1Z5ELN-0000dn-IL for linux-arm-kernel@lists.infradead.org; Wed, 17 Jun 2015 14:29:34 +0000 X-IronPort-AV: E=Sophos;i="5.13,633,1427760000"; d="scan'208";a="272885265" From: Julien Grall To: Subject: [PATCH v2 2/7] xen/xenbus: client: Fix call of virt_to_mfn in xenbus_grant_ring Date: Wed, 17 Jun 2015 15:28:03 +0100 Message-ID: <1434551288-14113-3-git-send-email-julien.grall@citrix.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1434551288-14113-1-git-send-email-julien.grall@citrix.com> References: <1434551288-14113-1-git-send-email-julien.grall@citrix.com> MIME-Version: 1.0 X-DLP: MIA2 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20150617_072933_779828_C3E6CA6B X-CRM114-Status: GOOD ( 10.44 ) X-Spam-Score: -5.6 (-----) Cc: Wei Liu , Konrad Rzeszutek Wilk , linux-kernel@vger.kernel.org, Julien Grall , David Vrabel , Boris Ostrovsky , linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.8 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable 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 virt_to_mfn should take a void* rather an unsigned long. While it doesn't really matter now, it would throw a compiler warning later when virt_to_mfn will enforce the type. At the same time, avoid to compute new virtual address every time in the loop and directly increment the parameter as we don't use it later. Signed-off-by: Julien Grall Reviewed-by: David Vrabel Cc: Wei Liu Cc: Konrad Rzeszutek Wilk Cc: Boris Ostrovsky --- Changes in v2: - Remove the cast to (char *) - Add David's Reviewed-by --- drivers/xen/xenbus/xenbus_client.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/xen/xenbus/xenbus_client.c b/drivers/xen/xenbus/xenbus_client.c index a014016..9ad3272 100644 --- a/drivers/xen/xenbus/xenbus_client.c +++ b/drivers/xen/xenbus/xenbus_client.c @@ -379,16 +379,16 @@ int xenbus_grant_ring(struct xenbus_device *dev, void *vaddr, int i, j; for (i = 0; i < nr_pages; i++) { - unsigned long addr = (unsigned long)vaddr + - (PAGE_SIZE * i); err = gnttab_grant_foreign_access(dev->otherend_id, - virt_to_mfn(addr), 0); + virt_to_mfn(vaddr), 0); if (err < 0) { xenbus_dev_fatal(dev, err, "granting access to ring page"); goto fail; } grefs[i] = err; + + vaddr = vaddr + PAGE_SIZE; } return 0;