From patchwork Thu Oct 17 21:28:50 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bjorn Helgaas X-Patchwork-Id: 11197203 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id BA3CC112B for ; Thu, 17 Oct 2019 21:29:23 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 999C321D7D for ; Thu, 17 Oct 2019 21:29:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1571347763; bh=Bc3HCFc6y6+gN2QfwO1d6iGBdnhOT8r7h4mEEpAH98U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=pC6YgBkp/CO10eX+lGZ6bquYZqX7gaYwv69ZypWNwE9SNgnPROmO+HzMvGqhz9h7k OmbZA23AefCWF5NVnImbpPZOXxwFGGqls5NfgPipcUNxaIsIUNKhljEUT9Gjn8JMRM 8dmDZLB9Wkmj7sL98H1VOXWhHe78FuIHIfCfqSe4= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2503599AbfJQV3C (ORCPT ); Thu, 17 Oct 2019 17:29:02 -0400 Received: from mail.kernel.org ([198.145.29.99]:40954 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727683AbfJQV3B (ORCPT ); Thu, 17 Oct 2019 17:29:01 -0400 Received: from localhost (unknown [69.71.4.100]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id B03B321A49; Thu, 17 Oct 2019 21:29:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1571347740; bh=Bc3HCFc6y6+gN2QfwO1d6iGBdnhOT8r7h4mEEpAH98U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=THiR1MPGnsFaVzoHvGizfzyBLLJZUGaZuUbK7m/D0TvLSZTgJbE8XcPNtsJn3sQTh PLxMkKAGwTY4SlhtSOLkwtRUcwcWFTwxtbDifp4SpZyDhr07+yjnIIHvozWgFjKl9k PKC9EO2rnZBJG6LPnYLB3GlhWpU30QgmZxWq7z4Q= From: Bjorn Helgaas To: linux-pci@vger.kernel.org Cc: "Rafael J . Wysocki" , linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, Bjorn Helgaas Subject: [PATCH 1/2] PCI/PM: Use PCI dev_printk() wrappers for consistency Date: Thu, 17 Oct 2019 16:28:50 -0500 Message-Id: <20191017212851.54237-2-helgaas@kernel.org> X-Mailer: git-send-email 2.23.0.866.gb869b98d4c-goog In-Reply-To: <20191017212851.54237-1-helgaas@kernel.org> References: <20191017212851.54237-1-helgaas@kernel.org> MIME-Version: 1.0 Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org From: Bjorn Helgaas Use the PCI dev_printk() wrappers for consistency with the rest of the PCI core. No functional change intended. Signed-off-by: Bjorn Helgaas --- drivers/pci/pci-driver.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/drivers/pci/pci-driver.c b/drivers/pci/pci-driver.c index dd70ab2519c9..407b1df5ea7c 100644 --- a/drivers/pci/pci-driver.c +++ b/drivers/pci/pci-driver.c @@ -315,7 +315,8 @@ static long local_pci_probe(void *_ddi) * Probe function should return < 0 for failure, 0 for success * Treat values > 0 as success, but warn. */ - dev_warn(dev, "Driver probe function unexpectedly returned %d\n", rc); + pci_warn(pci_dev, "Driver probe function unexpectedly returned %d\n", + rc); return 0; } @@ -865,7 +866,7 @@ static int pci_pm_suspend_noirq(struct device *dev) pci_prepare_to_sleep(pci_dev); } - dev_dbg(dev, "PCI PM: Suspend power state: %s\n", + pci_dbg(pci_dev, "PCI PM: Suspend power state: %s\n", pci_power_name(pci_dev->current_state)); if (pci_dev->current_state == PCI_D0) { @@ -880,7 +881,7 @@ static int pci_pm_suspend_noirq(struct device *dev) } if (pci_dev->skip_bus_pm && pm_suspend_no_platform()) { - dev_dbg(dev, "PCI PM: Skipped\n"); + pci_dbg(pci_dev, "PCI PM: Skipped\n"); goto Fixup; } @@ -1295,11 +1296,11 @@ static int pci_pm_runtime_suspend(struct device *dev) * log level. */ if (error == -EBUSY || error == -EAGAIN) { - dev_dbg(dev, "can't suspend now (%ps returned %d)\n", + pci_dbg(pci_dev, "can't suspend now (%ps returned %d)\n", pm->runtime_suspend, error); return error; } else if (error) { - dev_err(dev, "can't suspend (%ps returned %d)\n", + pci_err(pci_dev, "can't suspend (%ps returned %d)\n", pm->runtime_suspend, error); return error; } From patchwork Thu Oct 17 21:28:51 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bjorn Helgaas X-Patchwork-Id: 11197193 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id EAD3F4B64 for ; Thu, 17 Oct 2019 21:29:06 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id C9AFA21D7C for ; Thu, 17 Oct 2019 21:29:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1571347746; bh=j7zh1mvjgnbLlrLEg0jZQ1d4/6qSUS30PoJk196vWi4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=qq90K6IXJWPnvG8hHS9u7IxENL/9m/RV4Ms1V6T9R/8vt/A3ndvjSVI3I9nsC71CA u0J/oevHb9v47bLCq6bqQGq84YRkl6Sv6KW/o1XZwLMGgdEgvkfY+vjs/nML4mpmjG VdhJflO8+UYBOw4u+V0LrLLeBEEVC/RU1uif06QI= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2503636AbfJQV3G (ORCPT ); Thu, 17 Oct 2019 17:29:06 -0400 Received: from mail.kernel.org ([198.145.29.99]:40980 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727683AbfJQV3E (ORCPT ); Thu, 17 Oct 2019 17:29:04 -0400 Received: from localhost (unknown [69.71.4.100]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 3EC5521D7A; Thu, 17 Oct 2019 21:29:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1571347743; bh=j7zh1mvjgnbLlrLEg0jZQ1d4/6qSUS30PoJk196vWi4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FTFb6uHfG/KwbOLYb7b2V7owWfoakFzhRsPcayuF4R2WuhjG0PQBYXwDlVzxDrq19 MkdHjK99NHU7BBuCEAC/8oUtNJvjnsPZFZjBG4ft6j1/EH2Tq9BztVQOd9eOMhySO+ 4cDtH+ciNok+U8bCACILfuTEhAQxWCIxGroN56Ek= From: Bjorn Helgaas To: linux-pci@vger.kernel.org Cc: "Rafael J . Wysocki" , linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, Bjorn Helgaas Subject: [PATCH 2/2] PCI/PM: Use pci_WARN() to include device information Date: Thu, 17 Oct 2019 16:28:51 -0500 Message-Id: <20191017212851.54237-3-helgaas@kernel.org> X-Mailer: git-send-email 2.23.0.866.gb869b98d4c-goog In-Reply-To: <20191017212851.54237-1-helgaas@kernel.org> References: <20191017212851.54237-1-helgaas@kernel.org> MIME-Version: 1.0 Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org From: Bjorn Helgaas Add and use pci_WARN() wrappers so warnings include device information. Signed-off-by: Bjorn Helgaas --- drivers/pci/pci-driver.c | 34 +++++++++++++++++----------------- include/linux/pci.h | 8 ++++++++ 2 files changed, 25 insertions(+), 17 deletions(-) diff --git a/drivers/pci/pci-driver.c b/drivers/pci/pci-driver.c index 407b1df5ea7c..5337cbbd69de 100644 --- a/drivers/pci/pci-driver.c +++ b/drivers/pci/pci-driver.c @@ -585,9 +585,9 @@ static int pci_legacy_suspend(struct device *dev, pm_message_t state) if (!pci_dev->state_saved && pci_dev->current_state != PCI_D0 && pci_dev->current_state != PCI_UNKNOWN) { - WARN_ONCE(pci_dev->current_state != prev, - "PCI PM: Device state not saved by %pS\n", - drv->suspend); + pci_WARN_ONCE(pci_dev, pci_dev->current_state != prev, + "PCI PM: Device state not saved by %pS\n", + drv->suspend); } } @@ -612,9 +612,9 @@ static int pci_legacy_suspend_late(struct device *dev, pm_message_t state) if (!pci_dev->state_saved && pci_dev->current_state != PCI_D0 && pci_dev->current_state != PCI_UNKNOWN) { - WARN_ONCE(pci_dev->current_state != prev, - "PCI PM: Device state not saved by %pS\n", - drv->suspend_late); + pci_WARN_ONCE(pci_dev, pci_dev->current_state != prev, + "PCI PM: Device state not saved by %pS\n", + drv->suspend_late); goto Fixup; } } @@ -670,8 +670,8 @@ static bool pci_has_legacy_pm_support(struct pci_dev *pci_dev) * supported as well. Drivers are supposed to support either the * former, or the latter, but not both at the same time. */ - WARN(ret && drv->driver.pm, "driver %s device %04x:%04x\n", - drv->name, pci_dev->vendor, pci_dev->device); + pci_WARN(pci_dev, ret && drv->driver.pm, "device %04x:%04x\n", + pci_dev->vendor, pci_dev->device); return ret; } @@ -794,9 +794,9 @@ static int pci_pm_suspend(struct device *dev) if (!pci_dev->state_saved && pci_dev->current_state != PCI_D0 && pci_dev->current_state != PCI_UNKNOWN) { - WARN_ONCE(pci_dev->current_state != prev, - "PCI PM: State of device not saved by %pS\n", - pm->suspend); + pci_WARN_ONCE(pci_dev, pci_dev->current_state != prev, + "PCI PM: State of device not saved by %pS\n", + pm->suspend); } } @@ -842,9 +842,9 @@ static int pci_pm_suspend_noirq(struct device *dev) if (!pci_dev->state_saved && pci_dev->current_state != PCI_D0 && pci_dev->current_state != PCI_UNKNOWN) { - WARN_ONCE(pci_dev->current_state != prev, - "PCI PM: State of device not saved by %pS\n", - pm->suspend_noirq); + pci_WARN_ONCE(pci_dev, pci_dev->current_state != prev, + "PCI PM: State of device not saved by %pS\n", + pm->suspend_noirq); goto Fixup; } } @@ -1311,9 +1311,9 @@ static int pci_pm_runtime_suspend(struct device *dev) if (pm && pm->runtime_suspend && !pci_dev->state_saved && pci_dev->current_state != PCI_D0 && pci_dev->current_state != PCI_UNKNOWN) { - WARN_ONCE(pci_dev->current_state != prev, - "PCI PM: State of device not saved by %pS\n", - pm->runtime_suspend); + pci_WARN_ONCE(pci_dev, pci_dev->current_state != prev, + "PCI PM: State of device not saved by %pS\n", + pm->runtime_suspend); return 0; } diff --git a/include/linux/pci.h b/include/linux/pci.h index f9088c89a534..4846306d521c 100644 --- a/include/linux/pci.h +++ b/include/linux/pci.h @@ -2400,4 +2400,12 @@ void pci_uevent_ers(struct pci_dev *pdev, enum pci_ers_result err_type); #define pci_info_ratelimited(pdev, fmt, arg...) \ dev_info_ratelimited(&(pdev)->dev, fmt, ##arg) +#define pci_WARN(pdev, condition, fmt, arg...) \ + WARN(condition, "%s %s: " fmt, \ + dev_driver_string(&(pdev)->dev), pci_name(pdev), ##arg) + +#define pci_WARN_ONCE(pdev, condition, fmt, arg...) \ + WARN_ONCE(condition, "%s %s: " fmt, \ + dev_driver_string(&(pdev)->dev), pci_name(pdev), ##arg) + #endif /* LINUX_PCI_H */