From patchwork Wed Jul 25 19:51:13 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rafael Wysocki X-Patchwork-Id: 1239521 X-Patchwork-Delegate: bhelgaas@google.com Return-Path: X-Original-To: patchwork-linux-pci@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id BF1BEDFFCD for ; Wed, 25 Jul 2012 19:45:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752322Ab2GYTp1 (ORCPT ); Wed, 25 Jul 2012 15:45:27 -0400 Received: from ogre.sisk.pl ([193.178.161.156]:57018 "EHLO ogre.sisk.pl" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752259Ab2GYTp0 (ORCPT ); Wed, 25 Jul 2012 15:45:26 -0400 Received: from localhost (localhost.localdomain [127.0.0.1]) by ogre.sisk.pl (Postfix) with ESMTP id 43C491DB233; Wed, 25 Jul 2012 21:39:27 +0200 (CEST) Received: from ogre.sisk.pl ([127.0.0.1]) by localhost (ogre.sisk.pl [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 27581-08; Wed, 25 Jul 2012 21:39:18 +0200 (CEST) Received: from ferrari.rjw.lan (62-121-64-87.home.aster.pl [62.121.64.87]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ogre.sisk.pl (Postfix) with ESMTP id 6F3BD1DB20D; Wed, 25 Jul 2012 21:39:18 +0200 (CEST) From: "Rafael J. Wysocki" To: Bjorn Helgaas Subject: [PATCH] PCI / PM: Fix messages printed by acpi_pci_set_power_state() Date: Wed, 25 Jul 2012 21:51:13 +0200 User-Agent: KMail/1.13.6 (Linux/3.5.0+; KDE/4.6.0; x86_64; ; ) Cc: huang ying , =?utf-8?q?Bj=C3=B8rn_Mork?= , Huang Ying , Zheng Yan , linux-pci@vger.kernel.org, linux-usb@vger.kernel.org, Alan Stern , Linux PM list References: <87k3xskvqq.fsf@nemi.mork.no> In-Reply-To: MIME-Version: 1.0 Message-Id: <201207252151.14069.rjw@sisk.pl> X-Virus-Scanned: amavisd-new at ogre.sisk.pl using MkS_Vir for Linux Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org If a PCI device is put into D3_cold by acpi_bus_set_power(), the message printed by acpi_pci_set_power_state() says that its power state has been changed to D4, which doesn't make sense. In turn, if the device is put into D3_hot, the message says just "D3" without specifying which variant of D3 it is. Fix that by using an array of state names corresponding to the PCI device power states instead of building the state name from the numeric value corresponding to the given state directly. Signed-off-by: Rafael J. Wysocki --- drivers/pci/pci-acpi.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe linux-pci" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Index: linux/drivers/pci/pci-acpi.c =================================================================== --- linux.orig/drivers/pci/pci-acpi.c +++ linux/drivers/pci/pci-acpi.c @@ -265,9 +265,17 @@ static int acpi_pci_set_power_state(stru error = acpi_bus_set_power(handle, state_conv[state]); } - if (!error) - dev_printk(KERN_INFO, &dev->dev, - "power state changed by ACPI to D%d\n", state); + if (!error) { + static const char *state_name[] = { + [PCI_D0] = "D0", + [PCI_D1] = "D1", + [PCI_D2] = "D2", + [PCI_D3hot] = "D3hot", + [PCI_D3cold] = "D3cold" + }; + dev_info(&dev->dev, "power state changed by ACPI to %s\n", + state_name[state]); + } return error; }