[alsa-devel] [PATCH v1 44/49] sound: usb: midi: prepare for enabling irq in complete()

Takashi Iwai tiwai at suse.de
Mon Aug 19 15:47:55 CEST 2013


At Sun, 18 Aug 2013 00:25:09 +0800,
Ming Lei wrote:
> 
> Complete() will be run with interrupt enabled, so change to
> spin_lock_irqsave().
> 
> Cc: Jaroslav Kysela <perex at perex.cz>
> Cc: Takashi Iwai <tiwai at suse.de>

Acked-by: Takashi Iwai <tiwai at suse.de>


thanks,

Takashi


> Cc: Clemens Ladisch <clemens at ladisch.de>
> Cc: alsa-devel at alsa-project.org
> Signed-off-by: Ming Lei <ming.lei at canonical.com>
> ---
>  sound/usb/midi.c |    5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/sound/usb/midi.c b/sound/usb/midi.c
> index b901f46..86af276 100644
> --- a/sound/usb/midi.c
> +++ b/sound/usb/midi.c
> @@ -279,15 +279,16 @@ static void snd_usbmidi_out_urb_complete(struct urb* urb)
>  	struct out_urb_context *context = urb->context;
>  	struct snd_usb_midi_out_endpoint* ep = context->ep;
>  	unsigned int urb_index;
> +	unsigned long flags;
>  
> -	spin_lock(&ep->buffer_lock);
> +	spin_lock_irqsave(&ep->buffer_lock, flags);
>  	urb_index = context - ep->urbs;
>  	ep->active_urbs &= ~(1 << urb_index);
>  	if (unlikely(ep->drain_urbs)) {
>  		ep->drain_urbs &= ~(1 << urb_index);
>  		wake_up(&ep->drain_wait);
>  	}
> -	spin_unlock(&ep->buffer_lock);
> +	spin_unlock_irqrestore(&ep->buffer_lock, flags);
>  	if (urb->status < 0) {
>  		int err = snd_usbmidi_urb_error(urb->status);
>  		if (err < 0) {
> -- 
> 1.7.9.5
> 


More information about the Alsa-devel mailing list