From mboxrd@z Thu Jan 1 00:00:00 1970 From: Alan Stern Subject: Re: Runtime power management during system resume Date: Wed, 25 Aug 2010 10:51:16 -0400 (EDT) Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: linux-pm-bounces@lists.linux-foundation.org Errors-To: linux-pm-bounces@lists.linux-foundation.org To: Raj Kumar Cc: linux-pm@lists.linux-foundation.org List-Id: linux-pm@vger.kernel.org On Wed, 25 Aug 2010, Raj Kumar wrote: > But since during system suspend power_usage counter is incremented by 1 But if the device is active > > means its state is RPM_ACTIVE, its power_usage counter is 1 in run time power management core. > > > > when the system suspend happens, it will also increment the power_usage_counter by 1 during dpm_prepare > > > > Now the power_usage_counter is 2. > > > > So when dpm_complete is invoked, it will decrement the power_usage_counter by 1 during dpm_complete. > > > > So now when the drivers gets system suspend, its power_usage counter is still 1. > > > > So what in this scenario, does the device decrements the power_usage counter itself? Firstly, the _device_ can't change the power_usage counter. Only the _driver_ can. You seem to keep forgetting this point; you need to keep it straight: Driver != Device Secondly, after the system suspend the power_usage counter has the same value as it did before. In your case the usage_counter was 1 before the system suspend and it is 1 after the system suspend. Whatever routine was responsible for setting the counter to 1 originally will also be responsible for decrementing the counter to 0 some time later. Alan Stern