From patchwork Fri Oct 11 08:16:25 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "lan,Tianyu" X-Patchwork-Id: 3021461 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.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 2B386BF924 for ; Fri, 11 Oct 2013 08:27:07 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 0A59120333 for ; Fri, 11 Oct 2013 08:27:06 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id C362120221 for ; Fri, 11 Oct 2013 08:27:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756541Ab3JKI1B (ORCPT ); Fri, 11 Oct 2013 04:27:01 -0400 Received: from mga01.intel.com ([192.55.52.88]:47754 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752612Ab3JKI1A (ORCPT ); Fri, 11 Oct 2013 04:27:00 -0400 Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga101.fm.intel.com with ESMTP; 11 Oct 2013 01:26:55 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.90,1078,1371106800"; d="scan'208";a="415324537" Received: from lantianyu-ws.sh.intel.com (HELO localhost) ([10.239.37.18]) by fmsmga002.fm.intel.com with ESMTP; 11 Oct 2013 01:26:53 -0700 From: tianyu.lan@intel.com To: lenb@kernel.org, rjw@rjwysocki.net Cc: Lan Tianyu , linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] ACPI/Power: Check physical device's runtime pm status before requesting to resume it Date: Fri, 11 Oct 2013 16:16:25 +0800 Message-Id: <1381479385-1614-1-git-send-email-tianyu.lan@intel.com> X-Mailer: git-send-email 1.7.9.5 Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, 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 From: Lan Tianyu Currently, when one power resource is turned on, devices owning it will be requested to resume regardless of their runtime pm status. ACPI power resource maybe turn on in some devices' runtime pm resume callback(E.G, usb port) while turning on the power resource will trigger one new resume request of the device. It causes infinite loop between resume and suspend. This has happened on clearing usb port's PM Qos NO_POWER_OFF flag twice. This patch is to add check of physical device's runtime pm status and request resume if the device is suspended. Signed-off-by: Lan Tianyu --- drivers/acpi/power.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/acpi/power.c b/drivers/acpi/power.c index 0dbe5cd..228c138 100644 --- a/drivers/acpi/power.c +++ b/drivers/acpi/power.c @@ -250,8 +250,10 @@ static void acpi_power_resume_dependent(struct work_struct *work) mutex_lock(&adev->physical_node_lock); - list_for_each_entry(pn, &adev->physical_node_list, node) - pm_request_resume(pn->dev); + list_for_each_entry(pn, &adev->physical_node_list, node) { + if (pm_runtime_suspended(pn->dev)) + pm_request_resume(pn->dev); + } list_for_each_entry(pn, &adev->power_dependent, node) pm_request_resume(pn->dev);