From patchwork Thu Jul 11 09:05:35 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ming Lei X-Patchwork-Id: 2826081 Return-Path: X-Original-To: patchwork-linux-media@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 147C29F7D6 for ; Thu, 11 Jul 2013 09:08:30 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id D628D20121 for ; Thu, 11 Jul 2013 09:08:28 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 9D83D2011B for ; Thu, 11 Jul 2013 09:08:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932168Ab3GKJIS (ORCPT ); Thu, 11 Jul 2013 05:08:18 -0400 Received: from mail-pa0-f44.google.com ([209.85.220.44]:41015 "EHLO mail-pa0-f44.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932090Ab3GKJIP (ORCPT ); Thu, 11 Jul 2013 05:08:15 -0400 Received: by mail-pa0-f44.google.com with SMTP id lj1so7627986pab.31 for ; Thu, 11 Jul 2013 02:08:14 -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=Y84R71N/WQFMtT+sbht8POT3yxAdnLUfxkBp5V8u4LA=; b=ZRJlH4+ph1SkOvJkgq0ISprf5Up2RVrqDXHJHk5xdy7bMNCXX138+R9TrPXx1L0KzF P2gYi+Z3fNJZAzaFUHIVl2znJLizTgNzKiqc6JRrFs28DYOvNjHDEY93GYcrguR3puTj vkd4+eMcxpbBLpzRctQ/yuKgM7gFUGMw2Bb3f1MRT/50Q0yy/XdVTZiT1Jk6StXJOtuI W0n598SQ25VTHHNUXW73ImIyrmleqMOgAecVrZ7Z0DEqdy2AEFKnwnoe5X/nH0gxkoVK orR0w4S06UZgwpeBYeLzzkNT7g1XZYiCFsr6WdJxHF6AhgZGcJsPMqPZ3auC479abQs+ zz6g== X-Received: by 10.68.106.67 with SMTP id gs3mr35800383pbb.126.1373533694307; Thu, 11 Jul 2013 02:08:14 -0700 (PDT) Received: from localhost ([183.37.203.123]) by mx.google.com with ESMTPSA id at1sm38656127pbc.10.2013.07.11.02.08.09 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Thu, 11 Jul 2013 02:08:13 -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 , Johan Hovold Subject: [PATCH 12/50] USB: serial: io_edgeport: spin_lock in complete() cleanup Date: Thu, 11 Jul 2013 17:05:35 +0800 Message-Id: <1373533573-12272-13-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(). Cc: Johan Hovold Signed-off-by: Ming Lei --- drivers/usb/serial/io_edgeport.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/drivers/usb/serial/io_edgeport.c b/drivers/usb/serial/io_edgeport.c index dc2803b..af2f7d8 100644 --- a/drivers/usb/serial/io_edgeport.c +++ b/drivers/usb/serial/io_edgeport.c @@ -569,6 +569,7 @@ static void edge_interrupt_callback(struct urb *urb) int portNumber; int result; int status = urb->status; + unsigned long flags; switch (status) { case 0: @@ -594,7 +595,7 @@ static void edge_interrupt_callback(struct urb *urb) if (length > 1) { bytes_avail = data[0] | (data[1] << 8); if (bytes_avail) { - spin_lock(&edge_serial->es_lock); + spin_lock_irqsave(&edge_serial->es_lock, flags); edge_serial->rxBytesAvail += bytes_avail; dev_dbg(dev, "%s - bytes_avail=%d, rxBytesAvail=%d, read_in_progress=%d\n", @@ -617,7 +618,7 @@ static void edge_interrupt_callback(struct urb *urb) edge_serial->read_in_progress = false; } } - spin_unlock(&edge_serial->es_lock); + spin_unlock_irqrestore(&edge_serial->es_lock, flags); } } /* grab the txcredits for the ports if available */ @@ -630,9 +631,9 @@ static void edge_interrupt_callback(struct urb *urb) port = edge_serial->serial->port[portNumber]; edge_port = usb_get_serial_port_data(port); if (edge_port->open) { - spin_lock(&edge_port->ep_lock); + spin_lock_irqsave(&edge_port->ep_lock, flags); edge_port->txCredits += txCredits; - spin_unlock(&edge_port->ep_lock); + spin_unlock_irqrestore(&edge_port->ep_lock, flags); dev_dbg(dev, "%s - txcredits for port%d = %d\n", __func__, portNumber, edge_port->txCredits); @@ -673,6 +674,7 @@ static void edge_bulk_in_callback(struct urb *urb) int retval; __u16 raw_data_length; int status = urb->status; + unsigned long flags; if (status) { dev_dbg(&urb->dev->dev, "%s - nonzero read bulk status received: %d\n", @@ -692,7 +694,7 @@ static void edge_bulk_in_callback(struct urb *urb) usb_serial_debug_data(dev, __func__, raw_data_length, data); - spin_lock(&edge_serial->es_lock); + spin_lock_irqsave(&edge_serial->es_lock, flags); /* decrement our rxBytes available by the number that we just got */ edge_serial->rxBytesAvail -= raw_data_length; @@ -716,7 +718,7 @@ static void edge_bulk_in_callback(struct urb *urb) edge_serial->read_in_progress = false; } - spin_unlock(&edge_serial->es_lock); + spin_unlock_irqrestore(&edge_serial->es_lock, flags); }