From patchwork Thu Jul 11 09:06:03 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ming Lei X-Patchwork-Id: 2826145 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 2A7D1C0AB2 for ; Thu, 11 Jul 2013 09:14:47 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 0A10E20134 for ; Thu, 11 Jul 2013 09:14:46 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id D0FBE200D0 for ; Thu, 11 Jul 2013 09:14:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932533Ab3GKJMB (ORCPT ); Thu, 11 Jul 2013 05:12:01 -0400 Received: from mail-pb0-f48.google.com ([209.85.160.48]:38726 "EHLO mail-pb0-f48.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932451Ab3GKJL5 (ORCPT ); Thu, 11 Jul 2013 05:11:57 -0400 Received: by mail-pb0-f48.google.com with SMTP id ma3so7646149pbc.35 for ; Thu, 11 Jul 2013 02:11:57 -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:x-mailer:in-reply-to:references; bh=U8SF01cfstvvnoTCwGV5sagSTY5cI1aT9b/kTdnc5uA=; b=dadulK3YabWIkdHL+ogBLE4ZkVJ5m7/7u8aUbXCS7FzFemxe9qM0kMxrFI20pg5nnw mX4QsCHZT6eYqYT9ro5nerUVbsjSqwF2xjQsf93A2UQZn5ZZsZsCpQZnHbvFFuXzHad2 M8FmvMQ6YR7MaGgmwJ/JmKRlsnNAXQmHQ+1PdNAbtGX7MDRYV5pCbvtA7Ji91XT6Qri6 gGLQI2lHjzba8HONHqzCXnRgW5hLaXbu1xVA+JtDDaJ77TtvEl+r+0CzjZ4VvUkxuguo UkW32z8/B+Tp9uZTMSrAEGgkQsV0PQblfUMQIjyqXtKop9xIBpj2nEZ8HDP43D1GFuzU Fr4A== X-Received: by 10.68.197.33 with SMTP id ir1mr35670636pbc.197.1373533917274; Thu, 11 Jul 2013 02:11:57 -0700 (PDT) Received: from localhost ([183.37.203.123]) by mx.google.com with ESMTPSA id rb1sm26178597pbb.29.2013.07.11.02.11.52 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Thu, 11 Jul 2013 02:11:56 -0700 (PDT) From: Ming Lei To: Greg Kroah-Hartman Cc: linux-usb@vger.kernel.org, Oliver Neukum , Alan Stern , linux-input@vger.kernel.org, linux-bluetooth@vger.kernel.org, netdev@vger.kernel.org, linux-wireless@vger.kernel.org, linux-media@vger.kernel.org, alsa-devel@alsa-project.org, Ming Lei , Mauro Carvalho Chehab Subject: [PATCH 40/50] media: dvb-core: spin_lock in complete() cleanup Date: Thu, 11 Jul 2013 17:06:03 +0800 Message-Id: <1373533573-12272-41-git-send-email-ming.lei@canonical.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1373533573-12272-1-git-send-email-ming.lei@canonical.com> References: <1373533573-12272-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=-7.2 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(). These functions may be called inside URB->complete(), so use spin_lock_irqsave(). Cc: Mauro Carvalho Chehab Cc: linux-media@vger.kernel.org Signed-off-by: Ming Lei --- drivers/media/dvb-core/dvb_demux.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/drivers/media/dvb-core/dvb_demux.c b/drivers/media/dvb-core/dvb_demux.c index 3485655..58de441 100644 --- a/drivers/media/dvb-core/dvb_demux.c +++ b/drivers/media/dvb-core/dvb_demux.c @@ -476,7 +476,9 @@ static void dvb_dmx_swfilter_packet(struct dvb_demux *demux, const u8 *buf) void dvb_dmx_swfilter_packets(struct dvb_demux *demux, const u8 *buf, size_t count) { - spin_lock(&demux->lock); + unsigned long flags; + + spin_lock_irqsave(&demux->lock, flags); while (count--) { if (buf[0] == 0x47) @@ -484,7 +486,7 @@ void dvb_dmx_swfilter_packets(struct dvb_demux *demux, const u8 *buf, buf += 188; } - spin_unlock(&demux->lock); + spin_unlock_irqrestore(&demux->lock, flags); } EXPORT_SYMBOL(dvb_dmx_swfilter_packets); @@ -519,8 +521,9 @@ static inline void _dvb_dmx_swfilter(struct dvb_demux *demux, const u8 *buf, { int p = 0, i, j; const u8 *q; + unsigned long flags; - spin_lock(&demux->lock); + spin_lock_irqsave(&demux->lock, flags); if (demux->tsbufp) { /* tsbuf[0] is now 0x47. */ i = demux->tsbufp; @@ -564,7 +567,7 @@ static inline void _dvb_dmx_swfilter(struct dvb_demux *demux, const u8 *buf, } bailout: - spin_unlock(&demux->lock); + spin_unlock_irqrestore(&demux->lock, flags); } void dvb_dmx_swfilter(struct dvb_demux *demux, const u8 *buf, size_t count) @@ -581,11 +584,13 @@ EXPORT_SYMBOL(dvb_dmx_swfilter_204); void dvb_dmx_swfilter_raw(struct dvb_demux *demux, const u8 *buf, size_t count) { - spin_lock(&demux->lock); + unsigned long flags; + + spin_lock_irqsave(&demux->lock, flags); demux->feed->cb.ts(buf, count, NULL, 0, &demux->feed->feed.ts, DMX_OK); - spin_unlock(&demux->lock); + spin_unlock_irqrestore(&demux->lock, flags); } EXPORT_SYMBOL(dvb_dmx_swfilter_raw);