Re: [RFC]PM_QOS api update to use handles 5/5 (pcm updates)

From: Takashi Iwai
Date: Mon Nov 30 2009 - 04:06:39 EST


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@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/