Alsa-Devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Clemens Ladisch <clemens@ladisch.de>
To: Takashi Iwai <tiwai@suse.de>
Cc: Jonathan Nieder <jrnieder@gmail.com>,
	David Banks <amoebae@gmail.com>,
	alsa-devel@alsa-project.org, Olivier MATZ <zer0@droids-corp.org>
Subject: Re: [PATCH 2/2] ALSA: usb-audio: Fix missing autopm for MIDI input
Date: Mon, 03 Dec 2012 21:47:48 +0100	[thread overview]
Message-ID: <50BD0FF4.50301@ladisch.de> (raw)
In-Reply-To: <1354531738-22046-3-git-send-email-tiwai@suse.de>

Takashi Iwai wrote:
> The commit [88a8516a: ALSA: usbaudio: implement USB autosuspend] added
> the support of autopm for USB MIDI output, but it didn't take the MIDI
> input into account.
>
> This patch adds the following for fixing the autopm:
> - Manage the URB start at the first MIDI input stream open, instead of
>   the time of instance creation
> - Move autopm code to the common substream_open()
> - Make snd_usbmidi_input_start/_stop() more robust and add the running
>   state check
>
> Cc: <stable@vger.kernel.org>
> Signed-off-by: Takashi Iwai <tiwai@suse.de>
> ...
> +static int substream_open(struct snd_rawmidi_substream *substream, int dir,
> +			  int open)
>  {
>  	struct snd_usb_midi* umidi = substream->rmidi->private_data;
>  	struct snd_kcontrol *ctl;
> +	int err;
>
>  	down_read(&umidi->disc_rwsem);
>  	if (umidi->disconnected) {
>  		up_read(&umidi->disc_rwsem);
> +		return open ? -ENODEV : 0;
>  	}
>
>  	mutex_lock(&umidi->mutex);
>  	if (open) {
> +		if (!umidi->opened[0] && !umidi->opened[1]) {
> +			err = usb_autopm_get_interface(umidi->iface);
> +			umidi->autopm_reference = err >= 0;
> +			if (err < 0 && err != -EACCES) {
> +				up_read(&umidi->disc_rwsem);
> +				return -EIO;

umidi->mutex is still held here.

Otherwise, for both patches:
Reviewd-by: Clemens Ladisch <clemens@ladisch.de>
Tested-by: Clemens Ladisch <clemens@ladisch.de>


Regards,
Clemens

  reply	other threads:[~2012-12-03 20:48 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-12-03 10:48 [PATCH 0/2] USB MIDI fixes Takashi Iwai
2012-12-03 10:48 ` [PATCH 1/2] ALSA: usb-audio: Avoid autopm calls after disconnection Takashi Iwai
2012-12-03 10:48 ` [PATCH 2/2] ALSA: usb-audio: Fix missing autopm for MIDI input Takashi Iwai
2012-12-03 20:47   ` Clemens Ladisch [this message]
2012-12-04  7:01     ` Takashi Iwai

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=50BD0FF4.50301@ladisch.de \
    --to=clemens@ladisch.de \
    --cc=alsa-devel@alsa-project.org \
    --cc=amoebae@gmail.com \
    --cc=jrnieder@gmail.com \
    --cc=tiwai@suse.de \
    --cc=zer0@droids-corp.org \
    /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