mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Takashi Iwai <tiwai@suse.de>
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)
Date: Mon, 30 Nov 2009 10:06:31 +0100	[thread overview]
Message-ID: <s5hbpik1iw8.wl%tiwai@suse.de> (raw)
In-Reply-To: <20091130011045.GE4732@mgross-laptop>

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

      reply	other threads:[~2009-11-30  9:06 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-11-30  1:10 640E9920
2009-11-30  9:06 ` Takashi Iwai [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=s5hbpik1iw8.wl%tiwai@suse.de \
    --to=tiwai@suse.de \
    --cc=640e9920@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@lists.linux-foundation.org \
    --cc=perex@perex.cz \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®