From patchwork Thu May 28 22:35:49 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ross Zwisler X-Patchwork-Id: 6502741 Return-Path: X-Original-To: patchwork-linux-acpi@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 2EBDB9F6CE for ; Thu, 28 May 2015 22:36:43 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 07C872076A for ; Thu, 28 May 2015 22:36:42 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 1B5022076C for ; Thu, 28 May 2015 22:36:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754676AbbE1Wga (ORCPT ); Thu, 28 May 2015 18:36:30 -0400 Received: from mga09.intel.com ([134.134.136.24]:4632 "EHLO mga09.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755021AbbE1WgT (ORCPT ); Thu, 28 May 2015 18:36:19 -0400 Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga102.jf.intel.com with ESMTP; 28 May 2015 15:36:17 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.13,514,1427785200"; d="scan'208";a="578479031" Received: from rzwisler-mobl1.amr.corp.intel.com (HELO theros.lm.intel.com) ([10.232.112.154]) by orsmga003.jf.intel.com with ESMTP; 28 May 2015 15:36:09 -0700 From: Ross Zwisler To: linux-kernel@vger.kernel.org, linux-acpi@vger.kernel.org, linux-nvdimm@lists.01.org Cc: Ross Zwisler , Dan Williams , "Rafael J. Wysocki" Subject: [PATCH 2/6] nfit: Fix up address spaces, sparse warnings Date: Thu, 28 May 2015 16:35:49 -0600 Message-Id: <1432852553-24865-3-git-send-email-ross.zwisler@linux.intel.com> X-Mailer: git-send-email 1.9.3 In-Reply-To: <1432852553-24865-1-git-send-email-ross.zwisler@linux.intel.com> References: <1432852553-24865-1-git-send-email-ross.zwisler@linux.intel.com> Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_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 Fix a couple of sparse warnings (duplicate const, incorrect address space), and go back to using memcpy() instead of memcpy_toio() and memcpy_fromio() when talking to our block apertures. Instead, include a union to alias mmio->base and mmio->aperture so that we can continue to reuse common code for ioremapping and deinterleaving. mmio->base still has the __iomem annotation and is used via readq() and writeq() for the control and status registers. mmio->aperture is used via normal memcpy() for aperture I/O. Signed-off-by: Ross Zwisler Cc: Dan Williams Cc: "Rafael J. Wysocki" Cc: linux-nvdimm@lists.01.org Cc: linux-acpi@vger.kernel.org --- drivers/acpi/nfit.c | 10 +++++----- drivers/acpi/nfit.h | 5 ++++- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/drivers/acpi/nfit.c b/drivers/acpi/nfit.c index 34f879808ada..df14652ea13e 100644 --- a/drivers/acpi/nfit.c +++ b/drivers/acpi/nfit.c @@ -60,7 +60,7 @@ static int acpi_nfit_ctl(struct nd_bus_descriptor *nd_desc, unsigned int buf_len) { struct acpi_nfit_desc *acpi_desc = to_acpi_nfit_desc(nd_desc); - const struct nd_cmd_desc const *desc = NULL; + const struct nd_cmd_desc *desc = NULL; union acpi_object in_obj, in_buf, *out_obj; struct device *dev = acpi_desc->dev; const char *cmd_name, *dimm_name; @@ -895,7 +895,7 @@ static u64 to_interleave_offset(u64 offset, struct nfit_blk_mmio *mmio) static u64 read_blk_stat(struct nfit_blk *nfit_blk, unsigned int bw) { - struct nfit_blk_mmio __iomem *mmio = &nfit_blk->mmio[DCR]; + struct nfit_blk_mmio *mmio = &nfit_blk->mmio[DCR]; u64 offset = nfit_blk->stat_offset + mmio->size * bw; if (mmio->num_lines) @@ -908,7 +908,7 @@ static void write_blk_ctl(struct nfit_blk *nfit_blk, unsigned int bw, resource_size_t dpa, unsigned int len, unsigned int write) { u64 cmd, offset; - struct nfit_blk_mmio __iomem *mmio = &nfit_blk->mmio[DCR]; + struct nfit_blk_mmio *mmio = &nfit_blk->mmio[DCR]; enum { BCW_OFFSET_MASK = (1ULL << 48)-1, @@ -959,9 +959,9 @@ static int acpi_nfit_blk_single_io(struct nfit_blk *nfit_blk, void *iobuf, } if (write) - memcpy_fromio(mmio->base + offset, iobuf + copied, c); + memcpy(mmio->aperture + offset, iobuf + copied, c); else - memcpy_toio(iobuf + copied, mmio->base + offset, c); + memcpy(iobuf + copied, mmio->aperture + offset, c); copied += c; len -= c; diff --git a/drivers/acpi/nfit.h b/drivers/acpi/nfit.h index e462214f94cd..b882a22ee7bb 100644 --- a/drivers/acpi/nfit.h +++ b/drivers/acpi/nfit.h @@ -115,7 +115,10 @@ enum nd_blk_mmio_selector { struct nfit_blk { struct nfit_blk_mmio { - void __iomem *base; + union { + void __iomem *base; + void *aperture; + }; u64 size; u64 base_offset; u32 line_size;