From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andy Shevchenko Subject: Re: [PATCH 12/12] PM / core: Add AVOID_RPM driver flag Date: Tue, 17 Oct 2017 18:33:17 +0300 Message-ID: <1508254397.16112.481.camel@linux.intel.com> References: <3806130.B2KCK0tvef@aspire.rjw.lan> <2517917.TZ0hdc7mRJ@aspire.rjw.lan> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit Return-path: Received: from mga02.intel.com ([134.134.136.20]:39809 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934172AbdJQPhz (ORCPT ); Tue, 17 Oct 2017 11:37:55 -0400 In-Reply-To: <2517917.TZ0hdc7mRJ@aspire.rjw.lan> Sender: linux-acpi-owner@vger.kernel.org List-Id: linux-acpi@vger.kernel.org To: "Rafael J. Wysocki" , Linux PM Cc: Bjorn Helgaas , Alan Stern , Greg Kroah-Hartman , LKML , Linux ACPI , Linux PCI , Linux Documentation , Mika Westerberg , Ulf Hansson , Kevin Hilman , Wolfram Sang , linux-i2c@vger.kernel.org, Lee Jones On Mon, 2017-10-16 at 03:32 +0200, Rafael J. Wysocki wrote: > From: Rafael J. Wysocki > > Define and document a new driver flag, DPM_FLAG_AVOID_RPM, to inform > the PM core and middle layer code that the driver has something > significant to do in its ->suspend and/or ->resume callbacks and > runtime PM should be disabled for the device when these callbacks > run. > > Setting DPM_FLAG_AVOID_RPM (in addition to DPM_FLAG_SMART_SUSPEND) > causes runtime PM to be disabled for the device before invoking the > driver's ->suspend callback for it and to be enabled again for it > only after the driver's ->resume callback has returned. In addition > to that, if the device is in runtime suspend right after disabling > runtime PM for it (which means that there was no reason to resume it > from runtime suspend beforehand), the invocation of the ->suspend > callback will be skipped for it and it will be left in runtime > suspend until the "noirq" phase of the subsequent system resume. > > If DPM_FLAG_SMART_SUSPEND is not set, DPM_FLAG_AVOID_RPM has no > effect. > > + if (dev_pm_test_driver_flags(dev, DPM_FLAG_SMART_SUSPEND) && > + dev_pm_test_driver_flags(dev, DPM_FLAG_AVOID_RPM)) { Wasn't interface designed to allow something like: if (dev_pm_test_driver_flags(dev, DPM_FLAG_SMART_SUSPEND | DPM_FLAG_AVOID_RPM)) { instead? Does it make sense to have a separate definition for DPM_FLAG_SMART_SUSPEND | DPM_FLAG_AVOID_RPM ? -- Andy Shevchenko Intel Finland Oy