From patchwork Sat Aug 17 16:25:05 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ming Lei X-Patchwork-Id: 2846009 Return-Path: X-Original-To: patchwork-linux-media@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id C1349BF546 for ; Sat, 17 Aug 2013 16:31:55 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id D5A81201E9 for ; Sat, 17 Aug 2013 16:31:54 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id BF940201DA for ; Sat, 17 Aug 2013 16:31:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754507Ab3HQQbu (ORCPT ); Sat, 17 Aug 2013 12:31:50 -0400 Received: from mail-pb0-f53.google.com ([209.85.160.53]:36836 "EHLO mail-pb0-f53.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753672Ab3HQQbt (ORCPT ); Sat, 17 Aug 2013 12:31:49 -0400 Received: by mail-pb0-f53.google.com with SMTP id up15so3193853pbc.40 for ; Sat, 17 Aug 2013 09:31:49 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=Ipp0HuDGJ1o8XoFe3SH7GtLaPBDX4zIlcpg88ZAWRNA=; b=PV7KT+pY8Yc8gBCToHzTmzocYG7NeyOJwmMqgd9wMsE6H/9Kz7e226wAuTuiLSm2OQ t4nVFIKoTqbkroT0RCDV3RJeTzuPrM5zdSsXTnHjXJ4ncPcHB74wP+TQ02DvZM8ril82 gM+uoFLA8Jc60Fsrdiu0ZLIOm8JfmeoSnizyicWm55+7U69eszCix+Jpxqyj2E3ov3LO r9UK7WC6dZX9bzYu0ZtPUGzN8KQi7ftnWKtUgviLHQvzZuj9NfwGCQT3bQQaMNV1QO4D fIn+4gFPda8HiSYumFvZOK2v9iXS4J94mOEXOtkZ/6vvp5nBn9wn4SVtgGM7xYKySi3S +TSg== X-Received: by 10.68.170.133 with SMTP id am5mr3745869pbc.104.1376757109196; Sat, 17 Aug 2013 09:31:49 -0700 (PDT) Received: from localhost ([183.37.213.217]) by mx.google.com with ESMTPSA id tr10sm4558173pbc.22.1969.12.31.16.00.00 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Sat, 17 Aug 2013 09:31:48 -0700 (PDT) From: Ming Lei To: Greg Kroah-Hartman Cc: linux-usb@vger.kernel.org, Oliver Neukum , Alan Stern , Ming Lei , Mauro Carvalho Chehab , linux-media@vger.kernel.org Subject: [PATCH v1 40/49] media: usb: tlg2300: prepare for enabling irq in complete() Date: Sun, 18 Aug 2013 00:25:05 +0800 Message-Id: <1376756714-25479-41-git-send-email-ming.lei@canonical.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1376756714-25479-1-git-send-email-ming.lei@canonical.com> References: <1376756714-25479-1-git-send-email-ming.lei@canonical.com> Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Spam-Status: No, score=-9.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Complete() will be run with interrupt enabled, so change to spin_lock_irqsave(). Cc: Mauro Carvalho Chehab Cc: linux-media@vger.kernel.org Signed-off-by: Ming Lei Acked-by: Hans Verkuil --- drivers/media/usb/tlg2300/pd-alsa.c | 5 +++-- drivers/media/usb/tlg2300/pd-video.c | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/drivers/media/usb/tlg2300/pd-alsa.c b/drivers/media/usb/tlg2300/pd-alsa.c index 3f3e141..65c46a2 100644 --- a/drivers/media/usb/tlg2300/pd-alsa.c +++ b/drivers/media/usb/tlg2300/pd-alsa.c @@ -141,6 +141,7 @@ static inline void handle_audio_data(struct urb *urb, int *period_elapsed) int len = urb->actual_length / stride; unsigned char *cp = urb->transfer_buffer; unsigned int oldptr = pa->rcv_position; + unsigned long flags; if (urb->actual_length == AUDIO_BUF_SIZE - 4) len -= (AUDIO_TRAILER_SIZE / stride); @@ -156,7 +157,7 @@ static inline void handle_audio_data(struct urb *urb, int *period_elapsed) memcpy(runtime->dma_area + oldptr * stride, cp, len * stride); /* update the statas */ - snd_pcm_stream_lock(pa->capture_pcm_substream); + snd_pcm_stream_lock_irqsave(pa->capture_pcm_substream, flags); pa->rcv_position += len; if (pa->rcv_position >= runtime->buffer_size) pa->rcv_position -= runtime->buffer_size; @@ -166,7 +167,7 @@ static inline void handle_audio_data(struct urb *urb, int *period_elapsed) pa->copied_position -= runtime->period_size; *period_elapsed = 1; } - snd_pcm_stream_unlock(pa->capture_pcm_substream); + snd_pcm_stream_unlock_irqrestore(pa->capture_pcm_substream, flags); } static void complete_handler_audio(struct urb *urb) diff --git a/drivers/media/usb/tlg2300/pd-video.c b/drivers/media/usb/tlg2300/pd-video.c index 8df668d..4e5bd07 100644 --- a/drivers/media/usb/tlg2300/pd-video.c +++ b/drivers/media/usb/tlg2300/pd-video.c @@ -151,11 +151,12 @@ static void init_copy(struct video_data *video, bool index) static bool get_frame(struct front_face *front, int *need_init) { struct videobuf_buffer *vb = front->curr_frame; + unsigned long flags; if (vb) return true; - spin_lock(&front->queue_lock); + spin_lock_irqsave(&front->queue_lock, flags); if (!list_empty(&front->active)) { vb = list_entry(front->active.next, struct videobuf_buffer, queue); @@ -164,7 +165,7 @@ static bool get_frame(struct front_face *front, int *need_init) front->curr_frame = vb; list_del_init(&vb->queue); } - spin_unlock(&front->queue_lock); + spin_unlock_irqrestore(&front->queue_lock, flags); return !!vb; }