From patchwork Fri Jan 18 11:42:22 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Konstantin Khlebnikov X-Patchwork-Id: 2001181 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 CF85ADF280 for ; Fri, 18 Jan 2013 11:43:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751629Ab3ARLm2 (ORCPT ); Fri, 18 Jan 2013 06:42:28 -0500 Received: from mail-lb0-f179.google.com ([209.85.217.179]:44001 "EHLO mail-lb0-f179.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753846Ab3ARLm0 (ORCPT ); Fri, 18 Jan 2013 06:42:26 -0500 Received: by mail-lb0-f179.google.com with SMTP id gm13so2593768lbb.24 for ; Fri, 18 Jan 2013 03:42:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:sender:subject:to:from:cc:date:message-id:in-reply-to :references:user-agent:mime-version:content-type :content-transfer-encoding; bh=xcEy0dLgbuBly2WZH38r3vtdb8T/hccWnJ4ASsn8JeQ=; b=LMLqKgzEK2TAY/HZouTXgG0kkFaZX935yYGIeIlQWFATMSj0yPinUAqEgwVBVsk/3D aiY6iymE4mcNvwsttIZ8gmx2xhamU/g2qddyEJyOZJrRsUREAebJnh2qtQMUXZb7DHt7 wYhEptbvoXM7McmqrvBdT+DMYyXqOnC20gJ1Xg/g6g0JW3+TBdjqPdcWWqNYKSC3muae FD8A741ESf40gTjMhb1ksEKIDfomh/FOqtHIrEHRIhKQeAnmQW1mLZw3atS4wGI6lgJ7 guUP09TnIp7hhY4iz60i7e52jXmw8sBWGMUY+wlwYArKnaivAoPLOsAoSLKNYi9Y9Y1E pLsA== X-Received: by 10.152.131.168 with SMTP id on8mr8188412lab.38.1358509344870; Fri, 18 Jan 2013 03:42:24 -0800 (PST) Received: from localhost (swsoft-msk-nat.sw.ru. [195.214.232.10]) by mx.google.com with ESMTPS id fv12sm1908670lab.12.2013.01.18.03.42.23 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Fri, 18 Jan 2013 03:42:24 -0800 (PST) Subject: [PATCH 3/5] PCI: revert preparing for wakeup in runtime-suspend finalization To: linux-kernel@vger.kernel.org From: Konstantin Khlebnikov Cc: e1000-devel@lists.sourceforge.net, linux-pci@vger.kernel.org, Bjorn Helgaas , Dave Airlie Date: Fri, 18 Jan 2013 15:42:22 +0400 Message-ID: <20130118114222.6698.7103.stgit@zurg> In-Reply-To: <20130118113019.6698.25941.stgit@zurg> References: <20130118113019.6698.25941.stgit@zurg> User-Agent: StGit/0.15 MIME-Version: 1.0 Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org This patch effectively reverts commit 42eca2302146fed51335b95128e949ee6f54478f ("PCI: Don't touch card regs after runtime suspend D3") | This patch checks whether the pci state is saved and doesn't attempt to hit | any registers after that point if it is. This seems completely wrong. Yes, PCI configuration space has been saved by driver, but this doesn't means that all job is done and device has been suspended and ready for waking up in the future. For example driver e1000e for ethernet in my thinkpad x220 saves pci-state but device cannot wakeup after that, because it needs some ACPI callbacks which usually called from pci_finish_runtime_suspend(). | Optimus (dual-gpu) laptops seem to have their own form of D3cold, but | unfortunately enter it on normal D3 transitions via the ACPI callback. Hardware which disappears from the bus unexpectedly is exception, so let's handle it as an exception. Its driver should set device state to D3cold and the rest code will handle it properly. Signed-off-by: Konstantin Khlebnikov Cc: linux-pci@vger.kernel.org Cc: Bjorn Helgaas Cc: Dave Airlie --- drivers/pci/pci-driver.c | 5 +++-- 1 file changed, 3 insertions(+), 2 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 diff --git a/drivers/pci/pci-driver.c b/drivers/pci/pci-driver.c index f79cbcd..030dbf0 100644 --- a/drivers/pci/pci-driver.c +++ b/drivers/pci/pci-driver.c @@ -1005,10 +1005,11 @@ static int pci_pm_runtime_suspend(struct device *dev) return 0; } - if (!pci_dev->state_saved) { + if (!pci_dev->state_saved) pci_save_state(pci_dev); + + if (pci_dev->current_state != PCI_D3cold) pci_finish_runtime_suspend(pci_dev); - } return 0; }