From patchwork Thu Mar 12 17:35:40 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bjorn Helgaas X-Patchwork-Id: 5997691 Return-Path: X-Original-To: patchwork-linux-acpi@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id B39EDBF90F for ; Thu, 12 Mar 2015 17:35:45 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id CED762037C for ; Thu, 12 Mar 2015 17:35:44 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id EF64B20373 for ; Thu, 12 Mar 2015 17:35:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1161025AbbCLRfn (ORCPT ); Thu, 12 Mar 2015 13:35:43 -0400 Received: from mail-ob0-f170.google.com ([209.85.214.170]:38976 "EHLO mail-ob0-f170.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1030316AbbCLRfm (ORCPT ); Thu, 12 Mar 2015 13:35:42 -0400 Received: by obcwp18 with SMTP id wp18so15497861obc.6 for ; Thu, 12 Mar 2015 10:35:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=subject:to:from:cc:date:message-id:in-reply-to:references :user-agent:mime-version:content-type:content-transfer-encoding; bh=B3B79OgrRv0BbeZexcwKUahMeI7a5apRYkPmhZNZN9g=; b=WjTV8oe+AXYHuJpqoLIDcHsWu+8QTyZ7fLomnL4K3z561QAsREwUdlEpaxp/mGiEEk ++WHx2Gajh4y18igkNnmCg3hnIvoPIR36gYmheetKXyVAWzcZR81AjtOptICvKtvKzqj qEtrLni3r1WB6F3FS17rMVpC9FSDqUWmbcguB4ccgaN6cPNdZbRwJgu4IhRKee90MMJV d4MhcojBbwKJUrxsyROGc6buc+EvzCDAMOX5vn6whlVMXNU40htXvsIm0Jivah6Da8qt bvyR9INM9VrZyqFcgALup6gk7m+4WVomoyC2g0MuSCBDwrBTlV7OqsSXzX3Rzh65mKzw QRFg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:subject:to:from:cc:date:message-id:in-reply-to :references:user-agent:mime-version:content-type :content-transfer-encoding; bh=B3B79OgrRv0BbeZexcwKUahMeI7a5apRYkPmhZNZN9g=; b=XfvwRjOMgI1uh36kqGFk31cTmxrDT0g1VdYqi7aJdS39q9Ixft3cFLL3vp+pDqmlnz AG6R5O6jTwC83MLOvwDeci6Rd/Q4MzBueac3CgudkmaPWas9GveWFngMZMVRsoCwMMZK SS9gCPLtHpE0++upeojwOBxrWLbh8+RhEyPOcw0tOLBzsM8QKAwPJOGpFojVLZQTTtc0 PvYYrgyylqrGAkxFKUhcwUZjcanhSlyfieR9Q8ycCPIVzOJ+LKX6bzNBTda5ta6XGdll 81cP1UxVYMHV0hm2sal3SjdIS7uIXQuTl7yDvR/V/BHO7TIKASqPM4SY9JMvGr7tXaOA 8LGQ== X-Gm-Message-State: ALoCoQmbM7t60YKhyUPjb6SL+rNqnmG4Isxk9h54O3+WFAQUA3H4Rx5Li9ZpqkH2yk8ojzZsZtJB X-Received: by 10.60.132.144 with SMTP id ou16mr35141591oeb.36.1426181741784; Thu, 12 Mar 2015 10:35:41 -0700 (PDT) Received: from localhost ([146.7.4.76]) by mx.google.com with ESMTPSA id ku2sm4932684obc.12.2015.03.12.10.35.41 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Thu, 12 Mar 2015 10:35:41 -0700 (PDT) Subject: [PATCH v1 3/4] PCI: Show driver, BAR#, and resource on pci_ioremap_bar() failure To: linux-pci@vger.kernel.org From: Bjorn Helgaas Cc: linux-acpi@vger.kernel.org Date: Thu, 12 Mar 2015 12:35:40 -0500 Message-ID: <20150312173540.1052.39833.stgit@bhelgaas-glaptop2.roam.corp.google.com> In-Reply-To: <20150312173201.1052.28341.stgit@bhelgaas-glaptop2.roam.corp.google.com> References: <20150312173201.1052.28341.stgit@bhelgaas-glaptop2.roam.corp.google.com> User-Agent: StGit/0.16 MIME-Version: 1.0 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.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,RCVD_IN_DNSWL_HI,T_DKIM_INVALID,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 Use dev_warn() to complain about a pci_ioremap_bar() failure so we can include the driver name, BAR number, and the resource itself. We could use dev_WARN() to also get the backtrace as we did previously, but I think that's more information than we need. Signed-off-by: Bjorn Helgaas --- drivers/pci/pci.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe linux-acpi" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c index 81f06e8dcc04..a6d191ad9743 100644 --- a/drivers/pci/pci.c +++ b/drivers/pci/pci.c @@ -126,15 +126,16 @@ EXPORT_SYMBOL_GPL(pci_bus_max_busnr); #ifdef CONFIG_HAS_IOMEM void __iomem *pci_ioremap_bar(struct pci_dev *pdev, int bar) { + struct resource *res = &pdev->resource[bar]; + /* * Make sure the BAR is actually a memory resource, not an IO resource */ - if (!(pci_resource_flags(pdev, bar) & IORESOURCE_MEM)) { - WARN_ON(1); + if (!(res->flags & IORESOURCE_MEM)) { + dev_warn(&pdev->dev, "can't ioremap BAR %d: %pR\n", bar, res); return NULL; } - return ioremap_nocache(pci_resource_start(pdev, bar), - pci_resource_len(pdev, bar)); + return ioremap_nocache(res->start, resource_size(res)); } EXPORT_SYMBOL_GPL(pci_ioremap_bar); #endif