From patchwork Wed Mar 4 22:24:24 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Salter X-Patchwork-Id: 5940961 X-Patchwork-Delegate: bhelgaas@google.com Return-Path: X-Original-To: patchwork-linux-pci@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 BE40C9F318 for ; Wed, 4 Mar 2015 22:25:00 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id E2EB42035B for ; Wed, 4 Mar 2015 22:24:59 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 16EBA201BC for ; Wed, 4 Mar 2015 22:24:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753021AbbCDWY5 (ORCPT ); Wed, 4 Mar 2015 17:24:57 -0500 Received: from mx1.redhat.com ([209.132.183.28]:43962 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752966AbbCDWY5 (ORCPT ); Wed, 4 Mar 2015 17:24:57 -0500 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id t24MOTJS028052 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Wed, 4 Mar 2015 17:24:29 -0500 Received: from deneb.redhat.com (ovpn-113-181.phx2.redhat.com [10.3.113.181]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t24MOSVG011767; Wed, 4 Mar 2015 17:24:28 -0500 From: Mark Salter To: Tanmay Inamdar Cc: Bjorn Helgaas , Rob Herring , linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Mark Salter Subject: [PATCH] PCI: xgene: fix breakage from generic config usage Date: Wed, 4 Mar 2015 17:24:24 -0500 Message-Id: <1425507864-22055-1-git-send-email-msalter@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@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 Commit 350f8be5bb402 ("PCI: xgene: Convert to use generic config accessors") breaks PCI on the X-Gene platform. It creates two problems with the xgene_pcie_map_bus() function. First, it returns an int but should return a void __iomem *, but that's just a compile-time warning. The breakage is caused by the offset not being added to the base of the config map. So all config reads and writes operate on the first four bytes of config space. This patch fixes both issues. Signed-off-by: Mark Salter Acked-by: Feng Kan --- drivers/pci/host/pci-xgene.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/drivers/pci/host/pci-xgene.c b/drivers/pci/host/pci-xgene.c index 52bb25c..b87f80b 100644 --- a/drivers/pci/host/pci-xgene.c +++ b/drivers/pci/host/pci-xgene.c @@ -129,17 +129,21 @@ static bool xgene_pcie_hide_rc_bars(struct pci_bus *bus, int offset) return false; } -static int xgene_pcie_map_bus(struct pci_bus *bus, unsigned int devfn, - int offset) +static void __iomem *xgene_pcie_map_bus(struct pci_bus *bus, unsigned int devfn, + int offset) { struct xgene_pcie_port *port = bus->sysdata; + void __iomem *base; if ((pci_is_root_bus(bus) && devfn != 0) || !port->link_up || xgene_pcie_hide_rc_bars(bus, offset)) return NULL; xgene_pcie_set_rtdid_reg(bus, devfn); - return xgene_pcie_get_cfg_base(bus); + base = xgene_pcie_get_cfg_base(bus); + if (base) + base += offset; + return base; } static struct pci_ops xgene_pcie_ops = {