Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753105AbZK3JG1 (ORCPT ); Mon, 30 Nov 2009 04:06:27 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1752280AbZK3JG0 (ORCPT ); Mon, 30 Nov 2009 04:06:26 -0500 Received: from cantor.suse.de ([195.135.220.2]:34866 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751442AbZK3JG0 (ORCPT ); Mon, 30 Nov 2009 04:06:26 -0500 Date: Mon, 30 Nov 2009 10:06:31 +0100 Message-ID: From: Takashi Iwai To: 640E9920 <640e9920@gmail.com> Cc: linux-pm@lists.linux-foundation.org, linux-kernel@vger.kernel.org, perex@perex.cz Subject: Re: [RFC]PM_QOS api update to use handles 5/5 (pcm updates) In-Reply-To: <20091130011045.GE4732@mgross-laptop> References: <20091130011045.GE4732@mgross-laptop> User-Agent: Wanderlust/2.15.6 (Almost Unreal) SEMI/1.14.6 (Maruoka) FLIM/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL/10.7 Emacs/23.1 (x86_64-suse-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1813 Lines: 50 At Sun, 29 Nov 2009 17:10:46 -0800, 640E9920 wrote: > > diff --git a/sound/core/pcm_native.c b/sound/core/pcm_native.c > index ab73edf..e52eeec 100644 > --- a/sound/core/pcm_native.c > +++ b/sound/core/pcm_native.c > @@ -447,11 +447,12 @@ static int snd_pcm_hw_params(struct snd_pcm_substream *substream, > snd_pcm_timer_resolution_change(substream); > runtime->status->state = SNDRV_PCM_STATE_SETUP; > > - pm_qos_remove_requirement(PM_QOS_CPU_DMA_LATENCY, > - substream->latency_id); > + if (substream->latency_pm_qos_req) > + pm_qos_remove_request(substream->latency_pm_qos_req); > + Since pm_qos_add_request() below isn't called always, substream->latency_pm_qos_req needs the NULL re-initialization after removal, I guess. The PCM hw_params and hw_free callbacks can be called multiple times, and invalid pointers may be passed. > if ((usecs = period_to_usecs(runtime)) >= 0) > - pm_qos_add_requirement(PM_QOS_CPU_DMA_LATENCY, > - substream->latency_id, usecs); > + substream->latency_pm_qos_req = pm_qos_add_request( > + PM_QOS_CPU_DMA_LATENCY, usecs); > return 0; > _error: > /* hardware might be unuseable from this time, > @@ -506,8 +507,7 @@ static int snd_pcm_hw_free(struct snd_pcm_substream *substream) > if (substream->ops->hw_free) > result = substream->ops->hw_free(substream); > runtime->status->state = SNDRV_PCM_STATE_OPEN; > - pm_qos_remove_requirement(PM_QOS_CPU_DMA_LATENCY, > - substream->latency_id); > + pm_qos_remove_request(substream->latency_pm_qos_req); > return result; Ditto. thanks, Takashi -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/