All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v1 00/49] USB: prepare for enabling irq in complete()
@ 2013-08-17 16:24 Ming Lei
  2013-08-17 16:24 ` [PATCH v1 23/49] hid: usbhid: " Ming Lei
                   ` (17 more replies)
  0 siblings, 18 replies; 39+ messages in thread
From: Ming Lei @ 2013-08-17 16:24 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: linux-usb, Oliver Neukum, Alan Stern, linux-input,
	linux-bluetooth, netdev, linux-wireless, linux-media, alsa-devel

Hi,

As we are going to run URB->complete() in tasklet context[1][2], and
hard interrupt may be enabled when running URB completion handler[3],
so we might need to disable interrupt when acquiring one lock in
the completion handler for the below reasons:

- URB->complete() holds a subsystem wide lock which may be acquired
in another hard irq context, and the subsystem wide lock is acquired
by spin_lock()/read_lock()/write_lock() in complete()

- URB->complete() holds a private lock with spin_lock()/read_lock()/write_lock()
but driver may export APIs to make other drivers acquire the same private
lock in its interrupt handler.

For the sake of safety and making the change simple, this patch set
converts all spin_lock()/read_lock()/write_lock() in completion handler
path into their irqsave version mechanically.

But if you are sure the above two cases do not happen in your driver,
please let me know and I can drop the unnecessary change.

Also if you find some conversions are missed, also please let me know so
that I can add it in the next round.


[1], USB: URB documentation: claim complete() will be run with IRQs enabled
https://git.kernel.org/cgit/linux/kernel/git/gregkh/usb.git/commit/?h=usb-next&id=85721d45261c4be684730c7509a59daa6cda30d8

[2], USB: HCD: support giveback of URB in tasklet context
https://git.kernel.org/cgit/linux/kernel/git/gregkh/usb.git/commit/?h=usb-next&id=94dfd7edfd5c9b605caf7b562de7a813d216e011

[3], http://marc.info/?l=linux-usb&m=137286330626363&w=2

V1:
	- rename patchset title
	- add missed changes on 'usb_skeleon and usb sg lib'
	- remove several sound usb drivers which have been done via sound tree
	- some patch style fix
	- replace snd_pcm_stream_lock with snd_pcm_stream_lock_irqsave for related
	a/v drivers

Cc: linux-input@vger.kernel.org
Cc: linux-bluetooth@vger.kernel.org
Cc: netdev@vger.kernel.org
Cc: linux-wireless@vger.kernel.org
Cc: linux-media@vger.kernel.org
Cc: alsa-devel@alsa-project.org

 drivers/bluetooth/bfusb.c                     |   12 ++++----
 drivers/bluetooth/btusb.c                     |    5 ++--
 drivers/hid/usbhid/hid-core.c                 |    5 ++--
 drivers/input/misc/cm109.c                    |   10 ++++---
 drivers/isdn/hardware/mISDN/hfcsusb.c         |   36 ++++++++++++-----------
 drivers/media/dvb-core/dvb_demux.c            |   17 +++++++----
 drivers/media/usb/cx231xx/cx231xx-audio.c     |   10 ++++---
 drivers/media/usb/cx231xx/cx231xx-core.c      |   10 ++++---
 drivers/media/usb/cx231xx/cx231xx-vbi.c       |    5 ++--
 drivers/media/usb/em28xx/em28xx-audio.c       |    5 ++--
 drivers/media/usb/em28xx/em28xx-core.c        |    5 ++--
 drivers/media/usb/sn9c102/sn9c102_core.c      |    7 +++--
 drivers/media/usb/tlg2300/pd-alsa.c           |    5 ++--
 drivers/media/usb/tlg2300/pd-video.c          |    5 ++--
 drivers/media/usb/tm6000/tm6000-video.c       |    5 ++--
 drivers/net/usb/cdc-phonet.c                  |    5 ++--
 drivers/net/usb/hso.c                         |   38 ++++++++++++++-----------
 drivers/net/usb/kaweth.c                      |    7 +++--
 drivers/net/usb/rtl8150.c                     |    5 ++--
 drivers/net/wireless/ath/ath9k/hif_usb.c      |   29 ++++++++++---------
 drivers/net/wireless/ath/ath9k/htc_drv_txrx.c |    9 +++---
 drivers/net/wireless/ath/ath9k/wmi.c          |   11 +++----
 drivers/net/wireless/ath/carl9170/rx.c        |    5 ++--
 drivers/net/wireless/libertas/if_usb.c        |    5 ++--
 drivers/net/wireless/libertas_tf/if_usb.c     |    6 ++--
 drivers/net/wireless/zd1211rw/zd_usb.c        |   21 ++++++++------
 drivers/staging/bcm/InterfaceRx.c             |    5 ++--
 drivers/staging/btmtk_usb/btmtk_usb.c         |    5 ++--
 drivers/staging/ced1401/usb1401.c             |   35 ++++++++++++-----------
 drivers/staging/vt6656/usbpipe.c              |    9 +++---
 drivers/usb/class/cdc-wdm.c                   |   16 +++++++----
 drivers/usb/class/usblp.c                     |   10 ++++---
 drivers/usb/core/devio.c                      |    5 ++--
 drivers/usb/core/message.c                    |    5 ++--
 drivers/usb/misc/adutux.c                     |   10 ++++---
 drivers/usb/misc/iowarrior.c                  |    5 ++--
 drivers/usb/misc/ldusb.c                      |    7 +++--
 drivers/usb/misc/legousbtower.c               |    6 ++--
 drivers/usb/misc/usbtest.c                    |   10 ++++---
 drivers/usb/misc/uss720.c                     |    7 ++++-
 drivers/usb/serial/cyberjack.c                |   15 ++++++----
 drivers/usb/serial/digi_acceleport.c          |   23 ++++++++-------
 drivers/usb/serial/io_edgeport.c              |   14 +++++----
 drivers/usb/serial/io_ti.c                    |    5 ++--
 drivers/usb/serial/mos7720.c                  |    5 ++--
 drivers/usb/serial/mos7840.c                  |    5 ++--
 drivers/usb/serial/quatech2.c                 |    5 ++--
 drivers/usb/serial/sierra.c                   |    9 +++---
 drivers/usb/serial/symbolserial.c             |    5 ++--
 drivers/usb/serial/ti_usb_3410_5052.c         |    9 +++---
 drivers/usb/serial/usb_wwan.c                 |    5 ++--
 drivers/usb/usb-skeleton.c                    |   11 ++++---
 sound/usb/caiaq/audio.c                       |    5 ++--
 sound/usb/midi.c                              |    5 ++--
 54 files changed, 318 insertions(+), 221 deletions(-)


Thanks,
--
Ming Lei


^ permalink raw reply	[flat|nested] 39+ messages in thread

* [PATCH v1 23/49] hid: usbhid: prepare for enabling irq in complete()
  2013-08-17 16:24 [PATCH v1 00/49] USB: prepare for enabling irq in complete() Ming Lei
@ 2013-08-17 16:24 ` Ming Lei
  2013-08-22 12:19   ` Ming Lei
  2013-08-26 11:44   ` Jiri Kosina
  2013-08-17 16:24 ` [PATCH v1 26/49] input: cm109: " Ming Lei
                   ` (16 subsequent siblings)
  17 siblings, 2 replies; 39+ messages in thread
From: Ming Lei @ 2013-08-17 16:24 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: linux-usb, Oliver Neukum, Alan Stern, Ming Lei, Jiri Kosina, linux-input

Complete() will be run with interrupt enabled, so change to
spin_lock_irqsave().

Cc: Jiri Kosina <jkosina@suse.cz>
Cc: linux-input@vger.kernel.org
Signed-off-by: Ming Lei <ming.lei@canonical.com>
---
 drivers/hid/usbhid/hid-core.c |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/hid/usbhid/hid-core.c b/drivers/hid/usbhid/hid-core.c
index bd38cdf..2445fd6 100644
--- a/drivers/hid/usbhid/hid-core.c
+++ b/drivers/hid/usbhid/hid-core.c
@@ -489,8 +489,9 @@ static void hid_ctrl(struct urb *urb)
 	struct hid_device *hid = urb->context;
 	struct usbhid_device *usbhid = hid->driver_data;
 	int unplug = 0, status = urb->status;
+	unsigned long flags;
 
-	spin_lock(&usbhid->lock);
+	spin_lock_irqsave(&usbhid->lock, flags);
 
 	switch (status) {
 	case 0:			/* success */
@@ -525,7 +526,7 @@ static void hid_ctrl(struct urb *urb)
 	}
 
 	clear_bit(HID_CTRL_RUNNING, &usbhid->iofl);
-	spin_unlock(&usbhid->lock);
+	spin_unlock_irqrestore(&usbhid->lock, flags);
 	usb_autopm_put_interface_async(usbhid->intf);
 	wake_up(&usbhid->wait);
 }
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 39+ messages in thread

* [PATCH v1 26/49] input: cm109: prepare for enabling irq in complete()
  2013-08-17 16:24 [PATCH v1 00/49] USB: prepare for enabling irq in complete() Ming Lei
  2013-08-17 16:24 ` [PATCH v1 23/49] hid: usbhid: " Ming Lei
@ 2013-08-17 16:24 ` Ming Lei
  2013-08-18  3:37   ` Dmitry Torokhov
  2013-08-17 16:24 ` [PATCH v1 27/49] ISDN: hfcsusb: " Ming Lei
                   ` (15 subsequent siblings)
  17 siblings, 1 reply; 39+ messages in thread
From: Ming Lei @ 2013-08-17 16:24 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: linux-usb, Oliver Neukum, Alan Stern, Ming Lei, Dmitry Torokhov,
	linux-input

Complete() will be run with interrupt enabled, so change to
spin_lock_irqsave().

Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Cc: linux-input@vger.kernel.org
Signed-off-by: Ming Lei <ming.lei@canonical.com>
---
 drivers/input/misc/cm109.c |   10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/drivers/input/misc/cm109.c b/drivers/input/misc/cm109.c
index 082684e..cac4e37 100644
--- a/drivers/input/misc/cm109.c
+++ b/drivers/input/misc/cm109.c
@@ -340,6 +340,7 @@ static void cm109_urb_irq_callback(struct urb *urb)
 	struct cm109_dev *dev = urb->context;
 	const int status = urb->status;
 	int error;
+	unsigned long flags;
 
 	dev_dbg(&dev->intf->dev, "### URB IRQ: [0x%02x 0x%02x 0x%02x 0x%02x] keybit=0x%02x\n",
 	     dev->irq_data->byte[0],
@@ -379,7 +380,7 @@ static void cm109_urb_irq_callback(struct urb *urb)
 
  out:
 
-	spin_lock(&dev->ctl_submit_lock);
+	spin_lock_irqsave(&dev->ctl_submit_lock, flags);
 
 	dev->irq_urb_pending = 0;
 
@@ -403,7 +404,7 @@ static void cm109_urb_irq_callback(struct urb *urb)
 				__func__, error);
 	}
 
-	spin_unlock(&dev->ctl_submit_lock);
+	spin_unlock_irqrestore(&dev->ctl_submit_lock, flags);
 }
 
 static void cm109_urb_ctl_callback(struct urb *urb)
@@ -411,6 +412,7 @@ static void cm109_urb_ctl_callback(struct urb *urb)
 	struct cm109_dev *dev = urb->context;
 	const int status = urb->status;
 	int error;
+	unsigned long flags;
 
 	dev_dbg(&dev->intf->dev, "### URB CTL: [0x%02x 0x%02x 0x%02x 0x%02x]\n",
 	     dev->ctl_data->byte[0],
@@ -421,7 +423,7 @@ static void cm109_urb_ctl_callback(struct urb *urb)
 	if (status)
 		dev_err(&dev->intf->dev, "%s: urb status %d\n", __func__, status);
 
-	spin_lock(&dev->ctl_submit_lock);
+	spin_lock_irqsave(&dev->ctl_submit_lock, flags);
 
 	dev->ctl_urb_pending = 0;
 
@@ -442,7 +444,7 @@ static void cm109_urb_ctl_callback(struct urb *urb)
 		}
 	}
 
-	spin_unlock(&dev->ctl_submit_lock);
+	spin_unlock_irqrestore(&dev->ctl_submit_lock, flags);
 }
 
 static void cm109_toggle_buzzer_async(struct cm109_dev *dev)
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 39+ messages in thread

* [PATCH v1 27/49] ISDN: hfcsusb: prepare for enabling irq in complete()
  2013-08-17 16:24 [PATCH v1 00/49] USB: prepare for enabling irq in complete() Ming Lei
  2013-08-17 16:24 ` [PATCH v1 23/49] hid: usbhid: " Ming Lei
  2013-08-17 16:24 ` [PATCH v1 26/49] input: cm109: " Ming Lei
@ 2013-08-17 16:24 ` Ming Lei
  2013-08-17 16:24 ` [PATCH v1 28/49] USBNET: cdc-phonet: " Ming Lei
                   ` (14 subsequent siblings)
  17 siblings, 0 replies; 39+ messages in thread
From: Ming Lei @ 2013-08-17 16:24 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: linux-usb, Oliver Neukum, Alan Stern, Ming Lei, Karsten Keil,
	David S. Miller, netdev

Complete() will be run with interrupt enabled, so change to
spin_lock_irqsave().

Cc: Karsten Keil <isdn@linux-pingi.de>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: netdev@vger.kernel.org
Signed-off-by: Ming Lei <ming.lei@canonical.com>
---
 drivers/isdn/hardware/mISDN/hfcsusb.c |   36 ++++++++++++++++++---------------
 1 file changed, 20 insertions(+), 16 deletions(-)

diff --git a/drivers/isdn/hardware/mISDN/hfcsusb.c b/drivers/isdn/hardware/mISDN/hfcsusb.c
index 114f3bc..082f9e0 100644
--- a/drivers/isdn/hardware/mISDN/hfcsusb.c
+++ b/drivers/isdn/hardware/mISDN/hfcsusb.c
@@ -819,6 +819,7 @@ hfcsusb_rx_frame(struct usb_fifo *fifo, __u8 *data, unsigned int len,
 	int		fifon = fifo->fifonum;
 	int		i;
 	int		hdlc = 0;
+	unsigned long	flags;
 
 	if (debug & DBG_HFC_CALL_TRACE)
 		printk(KERN_DEBUG "%s: %s: fifo(%i) len(%i) "
@@ -835,7 +836,7 @@ hfcsusb_rx_frame(struct usb_fifo *fifo, __u8 *data, unsigned int len,
 		return;
 	}
 
-	spin_lock(&hw->lock);
+	spin_lock_irqsave(&hw->lock, flags);
 	if (fifo->dch) {
 		rx_skb = fifo->dch->rx_skb;
 		maxlen = fifo->dch->maxlen;
@@ -844,7 +845,7 @@ hfcsusb_rx_frame(struct usb_fifo *fifo, __u8 *data, unsigned int len,
 	if (fifo->bch) {
 		if (test_bit(FLG_RX_OFF, &fifo->bch->Flags)) {
 			fifo->bch->dropcnt += len;
-			spin_unlock(&hw->lock);
+			spin_unlock_irqrestore(&hw->lock, flags);
 			return;
 		}
 		maxlen = bchannel_get_rxbuf(fifo->bch, len);
@@ -854,7 +855,7 @@ hfcsusb_rx_frame(struct usb_fifo *fifo, __u8 *data, unsigned int len,
 				skb_trim(rx_skb, 0);
 			pr_warning("%s.B%d: No bufferspace for %d bytes\n",
 				   hw->name, fifo->bch->nr, len);
-			spin_unlock(&hw->lock);
+			spin_unlock_irqrestore(&hw->lock, flags);
 			return;
 		}
 		maxlen = fifo->bch->maxlen;
@@ -878,7 +879,7 @@ hfcsusb_rx_frame(struct usb_fifo *fifo, __u8 *data, unsigned int len,
 			} else {
 				printk(KERN_DEBUG "%s: %s: No mem for rx_skb\n",
 				       hw->name, __func__);
-				spin_unlock(&hw->lock);
+				spin_unlock_irqrestore(&hw->lock, flags);
 				return;
 			}
 		}
@@ -888,7 +889,7 @@ hfcsusb_rx_frame(struct usb_fifo *fifo, __u8 *data, unsigned int len,
 			       "for fifo(%d) HFCUSB_D_RX\n",
 			       hw->name, __func__, fifon);
 			skb_trim(rx_skb, 0);
-			spin_unlock(&hw->lock);
+			spin_unlock_irqrestore(&hw->lock, flags);
 			return;
 		}
 	}
@@ -942,7 +943,7 @@ hfcsusb_rx_frame(struct usb_fifo *fifo, __u8 *data, unsigned int len,
 		/* deliver transparent data to layer2 */
 		recv_Bchannel(fifo->bch, MISDN_ID_ANY, false);
 	}
-	spin_unlock(&hw->lock);
+	spin_unlock_irqrestore(&hw->lock, flags);
 }
 
 static void
@@ -979,18 +980,19 @@ rx_iso_complete(struct urb *urb)
 	__u8 *buf;
 	static __u8 eof[8];
 	__u8 s0_state;
+	unsigned long flags;
 
 	fifon = fifo->fifonum;
 	status = urb->status;
 
-	spin_lock(&hw->lock);
+	spin_lock_irqsave(&hw->lock, flags);
 	if (fifo->stop_gracefull) {
 		fifo->stop_gracefull = 0;
 		fifo->active = 0;
-		spin_unlock(&hw->lock);
+		spin_unlock_irqrestore(&hw->lock, flags);
 		return;
 	}
-	spin_unlock(&hw->lock);
+	spin_unlock_irqrestore(&hw->lock, flags);
 
 	/*
 	 * ISO transfer only partially completed,
@@ -1096,15 +1098,16 @@ rx_int_complete(struct urb *urb)
 	struct usb_fifo *fifo = (struct usb_fifo *) urb->context;
 	struct hfcsusb *hw = fifo->hw;
 	static __u8 eof[8];
+	unsigned long flags;
 
-	spin_lock(&hw->lock);
+	spin_lock_irqsave(&hw->lock, flags);
 	if (fifo->stop_gracefull) {
 		fifo->stop_gracefull = 0;
 		fifo->active = 0;
-		spin_unlock(&hw->lock);
+		spin_unlock_irqrestore(&hw->lock, flags);
 		return;
 	}
-	spin_unlock(&hw->lock);
+	spin_unlock_irqrestore(&hw->lock, flags);
 
 	fifon = fifo->fifonum;
 	if ((!fifo->active) || (urb->status)) {
@@ -1172,12 +1175,13 @@ tx_iso_complete(struct urb *urb)
 	int *tx_idx;
 	int frame_complete, fifon, status, fillempty = 0;
 	__u8 threshbit, *p;
+	unsigned long flags;
 
-	spin_lock(&hw->lock);
+	spin_lock_irqsave(&hw->lock, flags);
 	if (fifo->stop_gracefull) {
 		fifo->stop_gracefull = 0;
 		fifo->active = 0;
-		spin_unlock(&hw->lock);
+		spin_unlock_irqrestore(&hw->lock, flags);
 		return;
 	}
 
@@ -1195,7 +1199,7 @@ tx_iso_complete(struct urb *urb)
 	} else {
 		printk(KERN_DEBUG "%s: %s: neither BCH nor DCH\n",
 		       hw->name, __func__);
-		spin_unlock(&hw->lock);
+		spin_unlock_irqrestore(&hw->lock, flags);
 		return;
 	}
 
@@ -1375,7 +1379,7 @@ tx_iso_complete(struct urb *urb)
 			       hw->name, __func__,
 			       symbolic(urb_errlist, status), status, fifon);
 	}
-	spin_unlock(&hw->lock);
+	spin_unlock_irqrestore(&hw->lock, flags);
 }
 
 /*
-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] 39+ messages in thread

* [PATCH v1 28/49] USBNET: cdc-phonet: prepare for enabling irq in complete()
  2013-08-17 16:24 [PATCH v1 00/49] USB: prepare for enabling irq in complete() Ming Lei
                   ` (2 preceding siblings ...)
  2013-08-17 16:24 ` [PATCH v1 27/49] ISDN: hfcsusb: " Ming Lei
@ 2013-08-17 16:24 ` Ming Lei
  2013-08-17 16:24   ` Ming Lei
                   ` (13 subsequent siblings)
  17 siblings, 0 replies; 39+ messages in thread
From: Ming Lei @ 2013-08-17 16:24 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: linux-usb, Oliver Neukum, Alan Stern, Ming Lei, netdev

Complete() will be run with interrupt enabled, so change to
spin_lock_irqsave().

Cc: netdev@vger.kernel.org
Signed-off-by: Ming Lei <ming.lei@canonical.com>
---
 drivers/net/usb/cdc-phonet.c |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/net/usb/cdc-phonet.c b/drivers/net/usb/cdc-phonet.c
index 7d78669..413ec32 100644
--- a/drivers/net/usb/cdc-phonet.c
+++ b/drivers/net/usb/cdc-phonet.c
@@ -99,6 +99,7 @@ static void tx_complete(struct urb *req)
 	struct net_device *dev = skb->dev;
 	struct usbpn_dev *pnd = netdev_priv(dev);
 	int status = req->status;
+	unsigned long flags;
 
 	switch (status) {
 	case 0:
@@ -115,10 +116,10 @@ static void tx_complete(struct urb *req)
 	}
 	dev->stats.tx_packets++;
 
-	spin_lock(&pnd->tx_lock);
+	spin_lock_irqsave(&pnd->tx_lock, flags);
 	pnd->tx_queue--;
 	netif_wake_queue(dev);
-	spin_unlock(&pnd->tx_lock);
+	spin_unlock_irqrestore(&pnd->tx_lock, flags);
 
 	dev_kfree_skb_any(skb);
 	usb_free_urb(req);
-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] 39+ messages in thread

* [PATCH v1 29/49] USBNET: hso: prepare for enabling irq in complete()
       [not found] ` <1376756714-25479-1-git-send-email-ming.lei-Z7WLFzj8eWMS+FvcfC7Uqw@public.gmane.org>
@ 2013-08-17 16:24   ` Ming Lei
  2013-08-17 16:24   ` [PATCH v1 30/49] USBNET: kaweth: " Ming Lei
                     ` (3 subsequent siblings)
  4 siblings, 0 replies; 39+ messages in thread
From: Ming Lei @ 2013-08-17 16:24 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: linux-usb-u79uwXL29TY76Z2rM5mHXA, Oliver Neukum, Alan Stern,
	Ming Lei, netdev-u79uwXL29TY76Z2rM5mHXA

Complete() will be run with interrupt enabled, so change to
spin_lock_irqsave().

Cc: netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Signed-off-by: Ming Lei <ming.lei-Z7WLFzj8eWMS+FvcfC7Uqw@public.gmane.org>
---
 drivers/net/usb/hso.c |   38 ++++++++++++++++++++++----------------
 1 file changed, 22 insertions(+), 16 deletions(-)

diff --git a/drivers/net/usb/hso.c b/drivers/net/usb/hso.c
index cba1d46..c865441 100644
--- a/drivers/net/usb/hso.c
+++ b/drivers/net/usb/hso.c
@@ -1008,6 +1008,7 @@ static void read_bulk_callback(struct urb *urb)
 	struct net_device *net;
 	int result;
 	int status = urb->status;
+	unsigned long flags;
 
 	/* is al ok?  (Filip: Who's Al ?) */
 	if (status) {
@@ -1036,11 +1037,11 @@ static void read_bulk_callback(struct urb *urb)
 	if (urb->actual_length) {
 		/* Handle the IP stream, add header and push it onto network
 		 * stack if the packet is complete. */
-		spin_lock(&odev->net_lock);
+		spin_lock_irqsave(&odev->net_lock, flags);
 		packetizeRx(odev, urb->transfer_buffer, urb->actual_length,
 			    (urb->transfer_buffer_length >
 			     urb->actual_length) ? 1 : 0);
-		spin_unlock(&odev->net_lock);
+		spin_unlock_irqrestore(&odev->net_lock, flags);
 	}
 
 	/* We are done with this URB, resubmit it. Prep the USB to wait for
@@ -1201,6 +1202,7 @@ static void hso_std_serial_read_bulk_callback(struct urb *urb)
 {
 	struct hso_serial *serial = urb->context;
 	int status = urb->status;
+	unsigned long flags;
 
 	/* sanity check */
 	if (!serial) {
@@ -1223,17 +1225,17 @@ static void hso_std_serial_read_bulk_callback(struct urb *urb)
 		if (serial->parent->port_spec & HSO_INFO_CRC_BUG)
 			fix_crc_bug(urb, serial->in_endp->wMaxPacketSize);
 		/* Valid data, handle RX data */
-		spin_lock(&serial->serial_lock);
+		spin_lock_irqsave(&serial->serial_lock, flags);
 		serial->rx_urb_filled[hso_urb_to_index(serial, urb)] = 1;
 		put_rxbuf_data_and_resubmit_bulk_urb(serial);
-		spin_unlock(&serial->serial_lock);
+		spin_unlock_irqrestore(&serial->serial_lock, flags);
 	} else if (status == -ENOENT || status == -ECONNRESET) {
 		/* Unlinked - check for throttled port. */
 		D2("Port %d, successfully unlinked urb", serial->minor);
-		spin_lock(&serial->serial_lock);
+		spin_lock_irqsave(&serial->serial_lock, flags);
 		serial->rx_urb_filled[hso_urb_to_index(serial, urb)] = 0;
 		hso_resubmit_rx_bulk_urb(serial, urb);
-		spin_unlock(&serial->serial_lock);
+		spin_unlock_irqrestore(&serial->serial_lock, flags);
 	} else {
 		D2("Port %d, status = %d for read urb", serial->minor, status);
 		return;
@@ -1510,12 +1512,13 @@ static void tiocmget_intr_callback(struct urb *urb)
 		DUMP(serial_state_notification,
 		     sizeof(struct hso_serial_state_notification));
 	} else {
+		unsigned long flags;
 
 		UART_state_bitmap = le16_to_cpu(serial_state_notification->
 						UART_state_bitmap);
 		prev_UART_state_bitmap = tiocmget->prev_UART_state_bitmap;
 		icount = &tiocmget->icount;
-		spin_lock(&serial->serial_lock);
+		spin_lock_irqsave(&serial->serial_lock, flags);
 		if ((UART_state_bitmap & B_OVERRUN) !=
 		   (prev_UART_state_bitmap & B_OVERRUN))
 			icount->parity++;
@@ -1538,7 +1541,7 @@ static void tiocmget_intr_callback(struct urb *urb)
 		   (prev_UART_state_bitmap & B_RX_CARRIER))
 			icount->dcd++;
 		tiocmget->prev_UART_state_bitmap = UART_state_bitmap;
-		spin_unlock(&serial->serial_lock);
+		spin_unlock_irqrestore(&serial->serial_lock, flags);
 		tiocmget->intr_completed = 1;
 		wake_up_interruptible(&tiocmget->waitq);
 	}
@@ -1883,8 +1886,9 @@ static void intr_callback(struct urb *urb)
 			serial = get_serial_by_shared_int_and_type(shared_int,
 								   (1 << i));
 			if (serial != NULL) {
+				unsigned long flags;
 				D1("Pending read interrupt on port %d\n", i);
-				spin_lock(&serial->serial_lock);
+				spin_lock_irqsave(&serial->serial_lock, flags);
 				if (serial->rx_state == RX_IDLE &&
 					serial->port.count > 0) {
 					/* Setup and send a ctrl req read on
@@ -1898,7 +1902,7 @@ static void intr_callback(struct urb *urb)
 					D1("Already a read pending on "
 					   "port %d or port not open\n", i);
 				}
-				spin_unlock(&serial->serial_lock);
+				spin_unlock_irqrestore(&serial->serial_lock, flags);
 			}
 		}
 	}
@@ -1925,6 +1929,7 @@ static void hso_std_serial_write_bulk_callback(struct urb *urb)
 {
 	struct hso_serial *serial = urb->context;
 	int status = urb->status;
+	unsigned long flags;
 
 	/* sanity check */
 	if (!serial) {
@@ -1932,9 +1937,9 @@ static void hso_std_serial_write_bulk_callback(struct urb *urb)
 		return;
 	}
 
-	spin_lock(&serial->serial_lock);
+	spin_lock_irqsave(&serial->serial_lock, flags);
 	serial->tx_urb_used = 0;
-	spin_unlock(&serial->serial_lock);
+	spin_unlock_irqrestore(&serial->serial_lock, flags);
 	if (status) {
 		handle_usb_error(status, __func__, serial->parent);
 		return;
@@ -1976,14 +1981,15 @@ static void ctrl_callback(struct urb *urb)
 	struct hso_serial *serial = urb->context;
 	struct usb_ctrlrequest *req;
 	int status = urb->status;
+	unsigned long flags;
 
 	/* sanity check */
 	if (!serial)
 		return;
 
-	spin_lock(&serial->serial_lock);
+	spin_lock_irqsave(&serial->serial_lock, flags);
 	serial->tx_urb_used = 0;
-	spin_unlock(&serial->serial_lock);
+	spin_unlock_irqrestore(&serial->serial_lock, flags);
 	if (status) {
 		handle_usb_error(status, __func__, serial->parent);
 		return;
@@ -1999,9 +2005,9 @@ static void ctrl_callback(struct urb *urb)
 	    (USB_DIR_IN | USB_TYPE_OPTION_VENDOR | USB_RECIP_INTERFACE)) {
 		/* response to a read command */
 		serial->rx_urb_filled[0] = 1;
-		spin_lock(&serial->serial_lock);
+		spin_lock_irqsave(&serial->serial_lock, flags);
 		put_rxbuf_data_and_resubmit_ctrl_urb(serial);
-		spin_unlock(&serial->serial_lock);
+		spin_unlock_irqrestore(&serial->serial_lock, flags);
 	} else {
 		hso_put_activity(serial->parent);
 		tty_port_tty_wakeup(&serial->port);
-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 39+ messages in thread

* [PATCH v1 30/49] USBNET: kaweth: prepare for enabling irq in complete()
       [not found] ` <1376756714-25479-1-git-send-email-ming.lei-Z7WLFzj8eWMS+FvcfC7Uqw@public.gmane.org>
  2013-08-17 16:24   ` [PATCH v1 29/49] USBNET: hso: " Ming Lei
@ 2013-08-17 16:24   ` Ming Lei
  2013-08-17 16:24   ` [PATCH v1 31/49] USBNET: rtl8150: " Ming Lei
                     ` (2 subsequent siblings)
  4 siblings, 0 replies; 39+ messages in thread
From: Ming Lei @ 2013-08-17 16:24 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: linux-usb-u79uwXL29TY76Z2rM5mHXA, Oliver Neukum, Alan Stern,
	Ming Lei, netdev-u79uwXL29TY76Z2rM5mHXA

Complete() will be run with interrupt enabled, so change to
spin_lock_irqsave().

Cc: netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Signed-off-by: Ming Lei <ming.lei-Z7WLFzj8eWMS+FvcfC7Uqw@public.gmane.org>
---
 drivers/net/usb/kaweth.c |    7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/net/usb/kaweth.c b/drivers/net/usb/kaweth.c
index afb117c..4addbbf 100644
--- a/drivers/net/usb/kaweth.c
+++ b/drivers/net/usb/kaweth.c
@@ -598,6 +598,7 @@ static void kaweth_usb_receive(struct urb *urb)
 	struct kaweth_device *kaweth = urb->context;
 	struct net_device *net = kaweth->net;
 	int status = urb->status;
+	unsigned long flags;
 
 	int count = urb->actual_length;
 	int count2 = urb->transfer_buffer_length;
@@ -630,12 +631,12 @@ static void kaweth_usb_receive(struct urb *urb)
 		kaweth->stats.rx_errors++;
 		dev_dbg(dev, "Status was -EOVERFLOW.\n");
 	}
-	spin_lock(&kaweth->device_lock);
+	spin_lock_irqsave(&kaweth->device_lock, flags);
 	if (IS_BLOCKED(kaweth->status)) {
-		spin_unlock(&kaweth->device_lock);
+		spin_unlock_irqrestore(&kaweth->device_lock, flags);
 		return;
 	}
-	spin_unlock(&kaweth->device_lock);
+	spin_unlock_irqrestore(&kaweth->device_lock, flags);
 
 	if(status && status != -EREMOTEIO && count != 1) {
 		dev_err(&kaweth->intf->dev,
-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 39+ messages in thread

* [PATCH v1 31/49] USBNET: rtl8150: prepare for enabling irq in complete()
       [not found] ` <1376756714-25479-1-git-send-email-ming.lei-Z7WLFzj8eWMS+FvcfC7Uqw@public.gmane.org>
  2013-08-17 16:24   ` [PATCH v1 29/49] USBNET: hso: " Ming Lei
  2013-08-17 16:24   ` [PATCH v1 30/49] USBNET: kaweth: " Ming Lei
@ 2013-08-17 16:24   ` Ming Lei
  2013-08-17 16:25   ` [PATCH v1 44/49] sound: usb: midi: " Ming Lei
  2013-08-17 16:25   ` [PATCH v1 45/49] sound: usb: caiaq: " Ming Lei
  4 siblings, 0 replies; 39+ messages in thread
From: Ming Lei @ 2013-08-17 16:24 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: linux-usb-u79uwXL29TY76Z2rM5mHXA, Oliver Neukum, Alan Stern,
	Ming Lei, netdev-u79uwXL29TY76Z2rM5mHXA

Complete() will be run with interrupt enabled, so change to
spin_lock_irqsave().

Cc: netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Signed-off-by: Ming Lei <ming.lei-Z7WLFzj8eWMS+FvcfC7Uqw@public.gmane.org>
---
 drivers/net/usb/rtl8150.c |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/net/usb/rtl8150.c b/drivers/net/usb/rtl8150.c
index 6cbdac6..199e0fb 100644
--- a/drivers/net/usb/rtl8150.c
+++ b/drivers/net/usb/rtl8150.c
@@ -372,6 +372,7 @@ static void read_bulk_callback(struct urb *urb)
 	u16 rx_stat;
 	int status = urb->status;
 	int result;
+	unsigned long flags;
 
 	dev = urb->context;
 	if (!dev)
@@ -413,9 +414,9 @@ static void read_bulk_callback(struct urb *urb)
 	netdev->stats.rx_packets++;
 	netdev->stats.rx_bytes += pkt_len;
 
-	spin_lock(&dev->rx_pool_lock);
+	spin_lock_irqsave(&dev->rx_pool_lock, flags);
 	skb = pull_skb(dev);
-	spin_unlock(&dev->rx_pool_lock);
+	spin_unlock_irqrestore(&dev->rx_pool_lock, flags);
 	if (!skb)
 		goto resched;
 
-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 39+ messages in thread

* [PATCH v1 32/49] wireless: ath9k: prepare for enabling irq in complete()
       [not found] ` <1376756714-25479-1-git-send-email-ming.lei-Z7WLFzj8eWMS+FvcfC7Uqw@public.gmane.org>
@ 2013-08-17 16:24   ` Ming Lei
  2013-08-17 16:24   ` [PATCH v1 30/49] USBNET: kaweth: " Ming Lei
                     ` (3 subsequent siblings)
  4 siblings, 0 replies; 39+ messages in thread
From: Ming Lei @ 2013-08-17 16:24 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: linux-usb, Oliver Neukum, Alan Stern, Ming Lei,
	Luis R. Rodriguez, John W. Linville, linux-wireless, netdev

Complete() will be run with interrupt enabled, so change to
spin_lock_irqsave().

Cc: "Luis R. Rodriguez" <mcgrof@qca.qualcomm.com>
Cc: "John W. Linville" <linville@tuxdriver.com>
Cc: linux-wireless@vger.kernel.org
Cc: netdev@vger.kernel.org
Signed-off-by: Ming Lei <ming.lei@canonical.com>
---
 drivers/net/wireless/ath/ath9k/hif_usb.c      |   29 ++++++++++++++-----------
 drivers/net/wireless/ath/ath9k/htc_drv_txrx.c |    9 ++++----
 drivers/net/wireless/ath/ath9k/wmi.c          |   11 +++++-----
 3 files changed, 27 insertions(+), 22 deletions(-)

diff --git a/drivers/net/wireless/ath/ath9k/hif_usb.c b/drivers/net/wireless/ath/ath9k/hif_usb.c
index 6d5d716..5efc1f0 100644
--- a/drivers/net/wireless/ath/ath9k/hif_usb.c
+++ b/drivers/net/wireless/ath/ath9k/hif_usb.c
@@ -136,6 +136,7 @@ static void hif_usb_mgmt_cb(struct urb *urb)
 	struct cmd_buf *cmd = (struct cmd_buf *)urb->context;
 	struct hif_device_usb *hif_dev;
 	bool txok = true;
+	unsigned long flags;
 
 	if (!cmd || !cmd->skb || !cmd->hif_dev)
 		return;
@@ -155,14 +156,14 @@ static void hif_usb_mgmt_cb(struct urb *urb)
 		 * If the URBs are being flushed, no need to complete
 		 * this packet.
 		 */
-		spin_lock(&hif_dev->tx.tx_lock);
+		spin_lock_irqsave(&hif_dev->tx.tx_lock, flags);
 		if (hif_dev->tx.flags & HIF_USB_TX_FLUSH) {
-			spin_unlock(&hif_dev->tx.tx_lock);
+			spin_unlock_irqrestore(&hif_dev->tx.tx_lock, flags);
 			dev_kfree_skb_any(cmd->skb);
 			kfree(cmd);
 			return;
 		}
-		spin_unlock(&hif_dev->tx.tx_lock);
+		spin_unlock_irqrestore(&hif_dev->tx.tx_lock, flags);
 
 		break;
 	default:
@@ -253,6 +254,7 @@ static void hif_usb_tx_cb(struct urb *urb)
 	struct tx_buf *tx_buf = (struct tx_buf *) urb->context;
 	struct hif_device_usb *hif_dev;
 	bool txok = true;
+	unsigned long flags;
 
 	if (!tx_buf || !tx_buf->hif_dev)
 		return;
@@ -272,13 +274,13 @@ static void hif_usb_tx_cb(struct urb *urb)
 		 * If the URBs are being flushed, no need to add this
 		 * URB to the free list.
 		 */
-		spin_lock(&hif_dev->tx.tx_lock);
+		spin_lock_irqsave(&hif_dev->tx.tx_lock, flags);
 		if (hif_dev->tx.flags & HIF_USB_TX_FLUSH) {
-			spin_unlock(&hif_dev->tx.tx_lock);
+			spin_unlock_irqrestore(&hif_dev->tx.tx_lock, flags);
 			ath9k_skb_queue_purge(hif_dev, &tx_buf->skb_queue);
 			return;
 		}
-		spin_unlock(&hif_dev->tx.tx_lock);
+		spin_unlock_irqrestore(&hif_dev->tx.tx_lock, flags);
 
 		break;
 	default:
@@ -293,13 +295,13 @@ static void hif_usb_tx_cb(struct urb *urb)
 	__skb_queue_head_init(&tx_buf->skb_queue);
 
 	/* Add this TX buffer to the free list */
-	spin_lock(&hif_dev->tx.tx_lock);
+	spin_lock_irqsave(&hif_dev->tx.tx_lock, flags);
 	list_move_tail(&tx_buf->list, &hif_dev->tx.tx_buf);
 	hif_dev->tx.tx_buf_cnt++;
 	if (!(hif_dev->tx.flags & HIF_USB_TX_STOP))
 		__hif_usb_tx(hif_dev); /* Check for pending SKBs */
 	TX_STAT_INC(buf_completed);
-	spin_unlock(&hif_dev->tx.tx_lock);
+	spin_unlock_irqrestore(&hif_dev->tx.tx_lock, flags);
 }
 
 /* TX lock has to be taken */
@@ -530,8 +532,9 @@ static void ath9k_hif_usb_rx_stream(struct hif_device_usb *hif_dev,
 	int rx_remain_len, rx_pkt_len;
 	u16 pool_index = 0;
 	u8 *ptr;
+	unsigned long flags;
 
-	spin_lock(&hif_dev->rx_lock);
+	spin_lock_irqsave(&hif_dev->rx_lock, flags);
 
 	rx_remain_len = hif_dev->rx_remain_len;
 	rx_pkt_len = hif_dev->rx_transfer_len;
@@ -559,7 +562,7 @@ static void ath9k_hif_usb_rx_stream(struct hif_device_usb *hif_dev,
 		}
 	}
 
-	spin_unlock(&hif_dev->rx_lock);
+	spin_unlock_irqrestore(&hif_dev->rx_lock, flags);
 
 	while (index < len) {
 		u16 pkt_len;
@@ -585,7 +588,7 @@ static void ath9k_hif_usb_rx_stream(struct hif_device_usb *hif_dev,
 		index = index + 4 + pkt_len + pad_len;
 
 		if (index > MAX_RX_BUF_SIZE) {
-			spin_lock(&hif_dev->rx_lock);
+			spin_lock_irqsave(&hif_dev->rx_lock, flags);
 			hif_dev->rx_remain_len = index - MAX_RX_BUF_SIZE;
 			hif_dev->rx_transfer_len =
 				MAX_RX_BUF_SIZE - chk_idx - 4;
@@ -595,7 +598,7 @@ static void ath9k_hif_usb_rx_stream(struct hif_device_usb *hif_dev,
 			if (!nskb) {
 				dev_err(&hif_dev->udev->dev,
 					"ath9k_htc: RX memory allocation error\n");
-				spin_unlock(&hif_dev->rx_lock);
+				spin_unlock_irqrestore(&hif_dev->rx_lock, flags);
 				goto err;
 			}
 			skb_reserve(nskb, 32);
@@ -606,7 +609,7 @@ static void ath9k_hif_usb_rx_stream(struct hif_device_usb *hif_dev,
 
 			/* Record the buffer pointer */
 			hif_dev->remain_skb = nskb;
-			spin_unlock(&hif_dev->rx_lock);
+			spin_unlock_irqrestore(&hif_dev->rx_lock, flags);
 		} else {
 			nskb = __dev_alloc_skb(pkt_len + 32, GFP_ATOMIC);
 			if (!nskb) {
diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_txrx.c b/drivers/net/wireless/ath/ath9k/htc_drv_txrx.c
index e602c95..a6f34f8 100644
--- a/drivers/net/wireless/ath/ath9k/htc_drv_txrx.c
+++ b/drivers/net/wireless/ath/ath9k/htc_drv_txrx.c
@@ -1156,25 +1156,26 @@ void ath9k_htc_rxep(void *drv_priv, struct sk_buff *skb,
 	struct ath_hw *ah = priv->ah;
 	struct ath_common *common = ath9k_hw_common(ah);
 	struct ath9k_htc_rxbuf *rxbuf = NULL, *tmp_buf = NULL;
+	unsigned long flags;
 
-	spin_lock(&priv->rx.rxbuflock);
+	spin_lock_irqsave(&priv->rx.rxbuflock, flags);
 	list_for_each_entry(tmp_buf, &priv->rx.rxbuf, list) {
 		if (!tmp_buf->in_process) {
 			rxbuf = tmp_buf;
 			break;
 		}
 	}
-	spin_unlock(&priv->rx.rxbuflock);
+	spin_unlock_irqrestore(&priv->rx.rxbuflock, flags);
 
 	if (rxbuf == NULL) {
 		ath_dbg(common, ANY, "No free RX buffer\n");
 		goto err;
 	}
 
-	spin_lock(&priv->rx.rxbuflock);
+	spin_lock_irqsave(&priv->rx.rxbuflock, flags);
 	rxbuf->skb = skb;
 	rxbuf->in_process = true;
-	spin_unlock(&priv->rx.rxbuflock);
+	spin_unlock_irqrestore(&priv->rx.rxbuflock, flags);
 
 	tasklet_schedule(&priv->rx_tasklet);
 	return;
diff --git a/drivers/net/wireless/ath/ath9k/wmi.c b/drivers/net/wireless/ath/ath9k/wmi.c
index 65c8894..101b771 100644
--- a/drivers/net/wireless/ath/ath9k/wmi.c
+++ b/drivers/net/wireless/ath/ath9k/wmi.c
@@ -207,6 +207,7 @@ static void ath9k_wmi_ctrl_rx(void *priv, struct sk_buff *skb,
 	struct wmi *wmi = (struct wmi *) priv;
 	struct wmi_cmd_hdr *hdr;
 	u16 cmd_id;
+	unsigned long flags;
 
 	if (unlikely(wmi->stopped))
 		goto free_skb;
@@ -215,20 +216,20 @@ static void ath9k_wmi_ctrl_rx(void *priv, struct sk_buff *skb,
 	cmd_id = be16_to_cpu(hdr->command_id);
 
 	if (cmd_id & 0x1000) {
-		spin_lock(&wmi->wmi_lock);
+		spin_lock_irqsave(&wmi->wmi_lock, flags);
 		__skb_queue_tail(&wmi->wmi_event_queue, skb);
-		spin_unlock(&wmi->wmi_lock);
+		spin_unlock_irqrestore(&wmi->wmi_lock, flags);
 		tasklet_schedule(&wmi->wmi_event_tasklet);
 		return;
 	}
 
 	/* Check if there has been a timeout. */
-	spin_lock(&wmi->wmi_lock);
+	spin_lock_irqsave(&wmi->wmi_lock, flags);
 	if (cmd_id != wmi->last_cmd_id) {
-		spin_unlock(&wmi->wmi_lock);
+		spin_unlock_irqrestore(&wmi->wmi_lock, flags);
 		goto free_skb;
 	}
-	spin_unlock(&wmi->wmi_lock);
+	spin_unlock_irqrestore(&wmi->wmi_lock, flags);
 
 	/* WMI command response */
 	ath9k_wmi_rsp_callback(wmi, skb);
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 39+ messages in thread

* [PATCH v1 32/49] wireless: ath9k: prepare for enabling irq in complete()
@ 2013-08-17 16:24   ` Ming Lei
  0 siblings, 0 replies; 39+ messages in thread
From: Ming Lei @ 2013-08-17 16:24 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: linux-usb-u79uwXL29TY76Z2rM5mHXA, Oliver Neukum, Alan Stern,
	Ming Lei, Luis R. Rodriguez, John W. Linville,
	linux-wireless-u79uwXL29TY76Z2rM5mHXA,
	netdev-u79uwXL29TY76Z2rM5mHXA

Complete() will be run with interrupt enabled, so change to
spin_lock_irqsave().

Cc: "Luis R. Rodriguez" <mcgrof-A+ZNKFmMK5xy9aJCnZT0Uw@public.gmane.org>
Cc: "John W. Linville" <linville-2XuSBdqkA4R54TAoqtyWWQ@public.gmane.org>
Cc: linux-wireless-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Cc: netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Signed-off-by: Ming Lei <ming.lei-Z7WLFzj8eWMS+FvcfC7Uqw@public.gmane.org>
---
 drivers/net/wireless/ath/ath9k/hif_usb.c      |   29 ++++++++++++++-----------
 drivers/net/wireless/ath/ath9k/htc_drv_txrx.c |    9 ++++----
 drivers/net/wireless/ath/ath9k/wmi.c          |   11 +++++-----
 3 files changed, 27 insertions(+), 22 deletions(-)

diff --git a/drivers/net/wireless/ath/ath9k/hif_usb.c b/drivers/net/wireless/ath/ath9k/hif_usb.c
index 6d5d716..5efc1f0 100644
--- a/drivers/net/wireless/ath/ath9k/hif_usb.c
+++ b/drivers/net/wireless/ath/ath9k/hif_usb.c
@@ -136,6 +136,7 @@ static void hif_usb_mgmt_cb(struct urb *urb)
 	struct cmd_buf *cmd = (struct cmd_buf *)urb->context;
 	struct hif_device_usb *hif_dev;
 	bool txok = true;
+	unsigned long flags;
 
 	if (!cmd || !cmd->skb || !cmd->hif_dev)
 		return;
@@ -155,14 +156,14 @@ static void hif_usb_mgmt_cb(struct urb *urb)
 		 * If the URBs are being flushed, no need to complete
 		 * this packet.
 		 */
-		spin_lock(&hif_dev->tx.tx_lock);
+		spin_lock_irqsave(&hif_dev->tx.tx_lock, flags);
 		if (hif_dev->tx.flags & HIF_USB_TX_FLUSH) {
-			spin_unlock(&hif_dev->tx.tx_lock);
+			spin_unlock_irqrestore(&hif_dev->tx.tx_lock, flags);
 			dev_kfree_skb_any(cmd->skb);
 			kfree(cmd);
 			return;
 		}
-		spin_unlock(&hif_dev->tx.tx_lock);
+		spin_unlock_irqrestore(&hif_dev->tx.tx_lock, flags);
 
 		break;
 	default:
@@ -253,6 +254,7 @@ static void hif_usb_tx_cb(struct urb *urb)
 	struct tx_buf *tx_buf = (struct tx_buf *) urb->context;
 	struct hif_device_usb *hif_dev;
 	bool txok = true;
+	unsigned long flags;
 
 	if (!tx_buf || !tx_buf->hif_dev)
 		return;
@@ -272,13 +274,13 @@ static void hif_usb_tx_cb(struct urb *urb)
 		 * If the URBs are being flushed, no need to add this
 		 * URB to the free list.
 		 */
-		spin_lock(&hif_dev->tx.tx_lock);
+		spin_lock_irqsave(&hif_dev->tx.tx_lock, flags);
 		if (hif_dev->tx.flags & HIF_USB_TX_FLUSH) {
-			spin_unlock(&hif_dev->tx.tx_lock);
+			spin_unlock_irqrestore(&hif_dev->tx.tx_lock, flags);
 			ath9k_skb_queue_purge(hif_dev, &tx_buf->skb_queue);
 			return;
 		}
-		spin_unlock(&hif_dev->tx.tx_lock);
+		spin_unlock_irqrestore(&hif_dev->tx.tx_lock, flags);
 
 		break;
 	default:
@@ -293,13 +295,13 @@ static void hif_usb_tx_cb(struct urb *urb)
 	__skb_queue_head_init(&tx_buf->skb_queue);
 
 	/* Add this TX buffer to the free list */
-	spin_lock(&hif_dev->tx.tx_lock);
+	spin_lock_irqsave(&hif_dev->tx.tx_lock, flags);
 	list_move_tail(&tx_buf->list, &hif_dev->tx.tx_buf);
 	hif_dev->tx.tx_buf_cnt++;
 	if (!(hif_dev->tx.flags & HIF_USB_TX_STOP))
 		__hif_usb_tx(hif_dev); /* Check for pending SKBs */
 	TX_STAT_INC(buf_completed);
-	spin_unlock(&hif_dev->tx.tx_lock);
+	spin_unlock_irqrestore(&hif_dev->tx.tx_lock, flags);
 }
 
 /* TX lock has to be taken */
@@ -530,8 +532,9 @@ static void ath9k_hif_usb_rx_stream(struct hif_device_usb *hif_dev,
 	int rx_remain_len, rx_pkt_len;
 	u16 pool_index = 0;
 	u8 *ptr;
+	unsigned long flags;
 
-	spin_lock(&hif_dev->rx_lock);
+	spin_lock_irqsave(&hif_dev->rx_lock, flags);
 
 	rx_remain_len = hif_dev->rx_remain_len;
 	rx_pkt_len = hif_dev->rx_transfer_len;
@@ -559,7 +562,7 @@ static void ath9k_hif_usb_rx_stream(struct hif_device_usb *hif_dev,
 		}
 	}
 
-	spin_unlock(&hif_dev->rx_lock);
+	spin_unlock_irqrestore(&hif_dev->rx_lock, flags);
 
 	while (index < len) {
 		u16 pkt_len;
@@ -585,7 +588,7 @@ static void ath9k_hif_usb_rx_stream(struct hif_device_usb *hif_dev,
 		index = index + 4 + pkt_len + pad_len;
 
 		if (index > MAX_RX_BUF_SIZE) {
-			spin_lock(&hif_dev->rx_lock);
+			spin_lock_irqsave(&hif_dev->rx_lock, flags);
 			hif_dev->rx_remain_len = index - MAX_RX_BUF_SIZE;
 			hif_dev->rx_transfer_len =
 				MAX_RX_BUF_SIZE - chk_idx - 4;
@@ -595,7 +598,7 @@ static void ath9k_hif_usb_rx_stream(struct hif_device_usb *hif_dev,
 			if (!nskb) {
 				dev_err(&hif_dev->udev->dev,
 					"ath9k_htc: RX memory allocation error\n");
-				spin_unlock(&hif_dev->rx_lock);
+				spin_unlock_irqrestore(&hif_dev->rx_lock, flags);
 				goto err;
 			}
 			skb_reserve(nskb, 32);
@@ -606,7 +609,7 @@ static void ath9k_hif_usb_rx_stream(struct hif_device_usb *hif_dev,
 
 			/* Record the buffer pointer */
 			hif_dev->remain_skb = nskb;
-			spin_unlock(&hif_dev->rx_lock);
+			spin_unlock_irqrestore(&hif_dev->rx_lock, flags);
 		} else {
 			nskb = __dev_alloc_skb(pkt_len + 32, GFP_ATOMIC);
 			if (!nskb) {
diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_txrx.c b/drivers/net/wireless/ath/ath9k/htc_drv_txrx.c
index e602c95..a6f34f8 100644
--- a/drivers/net/wireless/ath/ath9k/htc_drv_txrx.c
+++ b/drivers/net/wireless/ath/ath9k/htc_drv_txrx.c
@@ -1156,25 +1156,26 @@ void ath9k_htc_rxep(void *drv_priv, struct sk_buff *skb,
 	struct ath_hw *ah = priv->ah;
 	struct ath_common *common = ath9k_hw_common(ah);
 	struct ath9k_htc_rxbuf *rxbuf = NULL, *tmp_buf = NULL;
+	unsigned long flags;
 
-	spin_lock(&priv->rx.rxbuflock);
+	spin_lock_irqsave(&priv->rx.rxbuflock, flags);
 	list_for_each_entry(tmp_buf, &priv->rx.rxbuf, list) {
 		if (!tmp_buf->in_process) {
 			rxbuf = tmp_buf;
 			break;
 		}
 	}
-	spin_unlock(&priv->rx.rxbuflock);
+	spin_unlock_irqrestore(&priv->rx.rxbuflock, flags);
 
 	if (rxbuf == NULL) {
 		ath_dbg(common, ANY, "No free RX buffer\n");
 		goto err;
 	}
 
-	spin_lock(&priv->rx.rxbuflock);
+	spin_lock_irqsave(&priv->rx.rxbuflock, flags);
 	rxbuf->skb = skb;
 	rxbuf->in_process = true;
-	spin_unlock(&priv->rx.rxbuflock);
+	spin_unlock_irqrestore(&priv->rx.rxbuflock, flags);
 
 	tasklet_schedule(&priv->rx_tasklet);
 	return;
diff --git a/drivers/net/wireless/ath/ath9k/wmi.c b/drivers/net/wireless/ath/ath9k/wmi.c
index 65c8894..101b771 100644
--- a/drivers/net/wireless/ath/ath9k/wmi.c
+++ b/drivers/net/wireless/ath/ath9k/wmi.c
@@ -207,6 +207,7 @@ static void ath9k_wmi_ctrl_rx(void *priv, struct sk_buff *skb,
 	struct wmi *wmi = (struct wmi *) priv;
 	struct wmi_cmd_hdr *hdr;
 	u16 cmd_id;
+	unsigned long flags;
 
 	if (unlikely(wmi->stopped))
 		goto free_skb;
@@ -215,20 +216,20 @@ static void ath9k_wmi_ctrl_rx(void *priv, struct sk_buff *skb,
 	cmd_id = be16_to_cpu(hdr->command_id);
 
 	if (cmd_id & 0x1000) {
-		spin_lock(&wmi->wmi_lock);
+		spin_lock_irqsave(&wmi->wmi_lock, flags);
 		__skb_queue_tail(&wmi->wmi_event_queue, skb);
-		spin_unlock(&wmi->wmi_lock);
+		spin_unlock_irqrestore(&wmi->wmi_lock, flags);
 		tasklet_schedule(&wmi->wmi_event_tasklet);
 		return;
 	}
 
 	/* Check if there has been a timeout. */
-	spin_lock(&wmi->wmi_lock);
+	spin_lock_irqsave(&wmi->wmi_lock, flags);
 	if (cmd_id != wmi->last_cmd_id) {
-		spin_unlock(&wmi->wmi_lock);
+		spin_unlock_irqrestore(&wmi->wmi_lock, flags);
 		goto free_skb;
 	}
-	spin_unlock(&wmi->wmi_lock);
+	spin_unlock_irqrestore(&wmi->wmi_lock, flags);
 
 	/* WMI command response */
 	ath9k_wmi_rsp_callback(wmi, skb);
-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 39+ messages in thread

* [PATCH v1 33/49] wireless: zd1211rw: prepare for enabling irq in complete()
  2013-08-17 16:24 [PATCH v1 00/49] USB: prepare for enabling irq in complete() Ming Lei
                   ` (4 preceding siblings ...)
  2013-08-17 16:24   ` Ming Lei
@ 2013-08-17 16:24 ` Ming Lei
  2013-08-17 16:24 ` [PATCH v1 34/49] wireless: ath: carl9170: " Ming Lei
                   ` (11 subsequent siblings)
  17 siblings, 0 replies; 39+ messages in thread
From: Ming Lei @ 2013-08-17 16:24 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: linux-usb, Oliver Neukum, Alan Stern, Ming Lei, Daniel Drake,
	Ulrich Kunitz, John W. Linville, linux-wireless, netdev

Complete() will be run with interrupt enabled, so change to
spin_lock_irqsave().

Cc: Daniel Drake <dsd@gentoo.org>
Cc: Ulrich Kunitz <kune@deine-taler.de>
Cc: "John W. Linville" <linville@tuxdriver.com>
Cc: linux-wireless@vger.kernel.org
Cc: netdev@vger.kernel.org
Signed-off-by: Ming Lei <ming.lei@canonical.com>
---
 drivers/net/wireless/zd1211rw/zd_usb.c |   21 ++++++++++++---------
 1 file changed, 12 insertions(+), 9 deletions(-)

diff --git a/drivers/net/wireless/zd1211rw/zd_usb.c b/drivers/net/wireless/zd1211rw/zd_usb.c
index 7ef0b4a..8169ee0 100644
--- a/drivers/net/wireless/zd1211rw/zd_usb.c
+++ b/drivers/net/wireless/zd1211rw/zd_usb.c
@@ -372,14 +372,15 @@ static inline void handle_regs_int_override(struct urb *urb)
 {
 	struct zd_usb *usb = urb->context;
 	struct zd_usb_interrupt *intr = &usb->intr;
+	unsigned long flags;
 
-	spin_lock(&intr->lock);
+	spin_lock_irqsave(&intr->lock, flags);
 	if (atomic_read(&intr->read_regs_enabled)) {
 		atomic_set(&intr->read_regs_enabled, 0);
 		intr->read_regs_int_overridden = 1;
 		complete(&intr->read_regs.completion);
 	}
-	spin_unlock(&intr->lock);
+	spin_unlock_irqrestore(&intr->lock, flags);
 }
 
 static inline void handle_regs_int(struct urb *urb)
@@ -388,9 +389,10 @@ static inline void handle_regs_int(struct urb *urb)
 	struct zd_usb_interrupt *intr = &usb->intr;
 	int len;
 	u16 int_num;
+	unsigned long flags;
 
 	ZD_ASSERT(in_interrupt());
-	spin_lock(&intr->lock);
+	spin_lock_irqsave(&intr->lock, flags);
 
 	int_num = le16_to_cpu(*(__le16 *)(urb->transfer_buffer+2));
 	if (int_num == CR_INTERRUPT) {
@@ -426,7 +428,7 @@ static inline void handle_regs_int(struct urb *urb)
 	}
 
 out:
-	spin_unlock(&intr->lock);
+	spin_unlock_irqrestore(&intr->lock, flags);
 
 	/* CR_INTERRUPT might override read_reg too. */
 	if (int_num == CR_INTERRUPT && atomic_read(&intr->read_regs_enabled))
@@ -666,6 +668,7 @@ static void rx_urb_complete(struct urb *urb)
 	struct zd_usb_rx *rx;
 	const u8 *buffer;
 	unsigned int length;
+	unsigned long flags;
 
 	switch (urb->status) {
 	case 0:
@@ -694,14 +697,14 @@ static void rx_urb_complete(struct urb *urb)
 		/* If there is an old first fragment, we don't care. */
 		dev_dbg_f(urb_dev(urb), "*** first fragment ***\n");
 		ZD_ASSERT(length <= ARRAY_SIZE(rx->fragment));
-		spin_lock(&rx->lock);
+		spin_lock_irqsave(&rx->lock, flags);
 		memcpy(rx->fragment, buffer, length);
 		rx->fragment_length = length;
-		spin_unlock(&rx->lock);
+		spin_unlock_irqrestore(&rx->lock, flags);
 		goto resubmit;
 	}
 
-	spin_lock(&rx->lock);
+	spin_lock_irqsave(&rx->lock, flags);
 	if (rx->fragment_length > 0) {
 		/* We are on a second fragment, we believe */
 		ZD_ASSERT(length + rx->fragment_length <=
@@ -711,9 +714,9 @@ static void rx_urb_complete(struct urb *urb)
 		handle_rx_packet(usb, rx->fragment,
 			         rx->fragment_length + length);
 		rx->fragment_length = 0;
-		spin_unlock(&rx->lock);
+		spin_unlock_irqrestore(&rx->lock, flags);
 	} else {
-		spin_unlock(&rx->lock);
+		spin_unlock_irqrestore(&rx->lock, flags);
 		handle_rx_packet(usb, buffer, length);
 	}
 
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 39+ messages in thread

* [PATCH v1 34/49] wireless: ath: carl9170: prepare for enabling irq in complete()
  2013-08-17 16:24 [PATCH v1 00/49] USB: prepare for enabling irq in complete() Ming Lei
                   ` (5 preceding siblings ...)
  2013-08-17 16:24 ` [PATCH v1 33/49] wireless: zd1211rw: " Ming Lei
@ 2013-08-17 16:24 ` Ming Lei
  2013-08-17 16:25   ` Ming Lei
                   ` (10 subsequent siblings)
  17 siblings, 0 replies; 39+ messages in thread
From: Ming Lei @ 2013-08-17 16:24 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: linux-usb, Oliver Neukum, Alan Stern, Ming Lei,
	Christian Lamparter, John W. Linville, linux-wireless, netdev

Complete() will be run with interrupt enabled, so change to
spin_lock_irqsave().

Cc: Christian Lamparter <chunkeey@googlemail.com>
Cc: "John W. Linville" <linville@tuxdriver.com>
Cc: linux-wireless@vger.kernel.org
Cc: netdev@vger.kernel.org
Signed-off-by: Ming Lei <ming.lei@canonical.com>
---
 drivers/net/wireless/ath/carl9170/rx.c |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/ath/carl9170/rx.c b/drivers/net/wireless/ath/carl9170/rx.c
index 4684dd9..61f62a6 100644
--- a/drivers/net/wireless/ath/carl9170/rx.c
+++ b/drivers/net/wireless/ath/carl9170/rx.c
@@ -129,6 +129,7 @@ static int carl9170_check_sequence(struct ar9170 *ar, unsigned int seq)
 
 static void carl9170_cmd_callback(struct ar9170 *ar, u32 len, void *buffer)
 {
+	unsigned long flags;
 	/*
 	 * Some commands may have a variable response length
 	 * and we cannot predict the correct length in advance.
@@ -148,7 +149,7 @@ static void carl9170_cmd_callback(struct ar9170 *ar, u32 len, void *buffer)
 		carl9170_restart(ar, CARL9170_RR_INVALID_RSP);
 	}
 
-	spin_lock(&ar->cmd_lock);
+	spin_lock_irqsave(&ar->cmd_lock, flags);
 	if (ar->readbuf) {
 		if (len >= 4)
 			memcpy(ar->readbuf, buffer + 4, len - 4);
@@ -156,7 +157,7 @@ static void carl9170_cmd_callback(struct ar9170 *ar, u32 len, void *buffer)
 		ar->readbuf = NULL;
 	}
 	complete(&ar->cmd_wait);
-	spin_unlock(&ar->cmd_lock);
+	spin_unlock_irqrestore(&ar->cmd_lock, flags);
 }
 
 void carl9170_handle_command_response(struct ar9170 *ar, void *buf, u32 len)
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 39+ messages in thread

* [PATCH v1 35/49] wireless: libertas: prepare for enabling irq in complete()
       [not found] ` <1376756714-25479-1-git-send-email-ming.lei-Z7WLFzj8eWMS+FvcfC7Uqw@public.gmane.org>
@ 2013-08-17 16:25   ` Ming Lei
  2013-08-17 16:24   ` [PATCH v1 30/49] USBNET: kaweth: " Ming Lei
                     ` (3 subsequent siblings)
  4 siblings, 0 replies; 39+ messages in thread
From: Ming Lei @ 2013-08-17 16:25 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: linux-usb, Oliver Neukum, Alan Stern, Ming Lei, John W. Linville,
	libertas-dev, linux-wireless, netdev

Complete() will be run with interrupt enabled, so change to
spin_lock_irqsave().

Cc: "John W. Linville" <linville@tuxdriver.com>
Cc: libertas-dev@lists.infradead.org
Cc: linux-wireless@vger.kernel.org
Cc: netdev@vger.kernel.org
Signed-off-by: Ming Lei <ming.lei@canonical.com>
---
 drivers/net/wireless/libertas/if_usb.c |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/libertas/if_usb.c b/drivers/net/wireless/libertas/if_usb.c
index 2798077..f6a8396 100644
--- a/drivers/net/wireless/libertas/if_usb.c
+++ b/drivers/net/wireless/libertas/if_usb.c
@@ -626,6 +626,7 @@ static inline void process_cmdrequest(int recvlength, uint8_t *recvbuff,
 				      struct lbs_private *priv)
 {
 	u8 i;
+	unsigned long flags;
 
 	if (recvlength > LBS_CMD_BUFFER_SIZE) {
 		lbs_deb_usbd(&cardp->udev->dev,
@@ -636,7 +637,7 @@ static inline void process_cmdrequest(int recvlength, uint8_t *recvbuff,
 
 	BUG_ON(!in_interrupt());
 
-	spin_lock(&priv->driver_lock);
+	spin_lock_irqsave(&priv->driver_lock, flags);
 
 	i = (priv->resp_idx == 0) ? 1 : 0;
 	BUG_ON(priv->resp_len[i]);
@@ -646,7 +647,7 @@ static inline void process_cmdrequest(int recvlength, uint8_t *recvbuff,
 	kfree_skb(skb);
 	lbs_notify_command_response(priv, i);
 
-	spin_unlock(&priv->driver_lock);
+	spin_unlock_irqrestore(&priv->driver_lock, flags);
 
 	lbs_deb_usbd(&cardp->udev->dev,
 		    "Wake up main thread to handle cmd response\n");
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 39+ messages in thread

* [PATCH v1 35/49] wireless: libertas: prepare for enabling irq in complete()
@ 2013-08-17 16:25   ` Ming Lei
  0 siblings, 0 replies; 39+ messages in thread
From: Ming Lei @ 2013-08-17 16:25 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: linux-usb-u79uwXL29TY76Z2rM5mHXA, Oliver Neukum, Alan Stern,
	Ming Lei, John W. Linville,
	libertas-dev-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-wireless-u79uwXL29TY76Z2rM5mHXA,
	netdev-u79uwXL29TY76Z2rM5mHXA

Complete() will be run with interrupt enabled, so change to
spin_lock_irqsave().

Cc: "John W. Linville" <linville-2XuSBdqkA4R54TAoqtyWWQ@public.gmane.org>
Cc: libertas-dev-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org
Cc: linux-wireless-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Cc: netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Signed-off-by: Ming Lei <ming.lei-Z7WLFzj8eWMS+FvcfC7Uqw@public.gmane.org>
---
 drivers/net/wireless/libertas/if_usb.c |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/libertas/if_usb.c b/drivers/net/wireless/libertas/if_usb.c
index 2798077..f6a8396 100644
--- a/drivers/net/wireless/libertas/if_usb.c
+++ b/drivers/net/wireless/libertas/if_usb.c
@@ -626,6 +626,7 @@ static inline void process_cmdrequest(int recvlength, uint8_t *recvbuff,
 				      struct lbs_private *priv)
 {
 	u8 i;
+	unsigned long flags;
 
 	if (recvlength > LBS_CMD_BUFFER_SIZE) {
 		lbs_deb_usbd(&cardp->udev->dev,
@@ -636,7 +637,7 @@ static inline void process_cmdrequest(int recvlength, uint8_t *recvbuff,
 
 	BUG_ON(!in_interrupt());
 
-	spin_lock(&priv->driver_lock);
+	spin_lock_irqsave(&priv->driver_lock, flags);
 
 	i = (priv->resp_idx == 0) ? 1 : 0;
 	BUG_ON(priv->resp_len[i]);
@@ -646,7 +647,7 @@ static inline void process_cmdrequest(int recvlength, uint8_t *recvbuff,
 	kfree_skb(skb);
 	lbs_notify_command_response(priv, i);
 
-	spin_unlock(&priv->driver_lock);
+	spin_unlock_irqrestore(&priv->driver_lock, flags);
 
 	lbs_deb_usbd(&cardp->udev->dev,
 		    "Wake up main thread to handle cmd response\n");
-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 39+ messages in thread

* [PATCH v1 36/49] wireless: libertas_tf: prepare for enabling irq in complete()
  2013-08-17 16:24 [PATCH v1 00/49] USB: prepare for enabling irq in complete() Ming Lei
                   ` (7 preceding siblings ...)
  2013-08-17 16:25   ` Ming Lei
@ 2013-08-17 16:25 ` Ming Lei
  2013-08-17 16:25 ` [PATCH v1 37/49] media: usb: cx231xx: " Ming Lei
                   ` (8 subsequent siblings)
  17 siblings, 0 replies; 39+ messages in thread
From: Ming Lei @ 2013-08-17 16:25 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: linux-usb, Oliver Neukum, Alan Stern, Ming Lei, John W. Linville,
	libertas-dev, linux-wireless, netdev

Complete() will be run with interrupt enabled, so change to
spin_lock_irqsave().

Cc: "John W. Linville" <linville@tuxdriver.com>
Cc: libertas-dev@lists.infradead.org
Cc: linux-wireless@vger.kernel.org
Cc: netdev@vger.kernel.org
Signed-off-by: Ming Lei <ming.lei@canonical.com>
---
 drivers/net/wireless/libertas_tf/if_usb.c |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/libertas_tf/if_usb.c b/drivers/net/wireless/libertas_tf/if_usb.c
index d576dd6..0e9e972 100644
--- a/drivers/net/wireless/libertas_tf/if_usb.c
+++ b/drivers/net/wireless/libertas_tf/if_usb.c
@@ -610,6 +610,8 @@ static inline void process_cmdrequest(int recvlength, uint8_t *recvbuff,
 				      struct if_usb_card *cardp,
 				      struct lbtf_private *priv)
 {
+	unsigned long flags;
+
 	if (recvlength > LBS_CMD_BUFFER_SIZE) {
 		lbtf_deb_usbd(&cardp->udev->dev,
 			     "The receive buffer is too large\n");
@@ -619,12 +621,12 @@ static inline void process_cmdrequest(int recvlength, uint8_t *recvbuff,
 
 	BUG_ON(!in_interrupt());
 
-	spin_lock(&priv->driver_lock);
+	spin_lock_irqsave(&priv->driver_lock, flags);
 	memcpy(priv->cmd_resp_buff, recvbuff + MESSAGE_HEADER_LEN,
 	       recvlength - MESSAGE_HEADER_LEN);
 	kfree_skb(skb);
 	lbtf_cmd_response_rx(priv);
-	spin_unlock(&priv->driver_lock);
+	spin_unlock_irqrestore(&priv->driver_lock, flags);
 }
 
 /**
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 39+ messages in thread

* [PATCH v1 37/49] media: usb: cx231xx: prepare for enabling irq in complete()
  2013-08-17 16:24 [PATCH v1 00/49] USB: prepare for enabling irq in complete() Ming Lei
                   ` (8 preceding siblings ...)
  2013-08-17 16:25 ` [PATCH v1 36/49] wireless: libertas_tf: " Ming Lei
@ 2013-08-17 16:25 ` Ming Lei
  2013-08-22 11:33   ` Hans Verkuil
  2013-08-17 16:25 ` [PATCH v1 38/49] media: usb: em28xx: " Ming Lei
                   ` (7 subsequent siblings)
  17 siblings, 1 reply; 39+ messages in thread
From: Ming Lei @ 2013-08-17 16:25 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: linux-usb, Oliver Neukum, Alan Stern, Ming Lei,
	Mauro Carvalho Chehab, Hans Verkuil, linux-media

Complete() will be run with interrupt enabled, so change to
spin_lock_irqsave().

Cc: Mauro Carvalho Chehab <mchehab@redhat.com>
Cc: Hans Verkuil <hans.verkuil@cisco.com>
Cc: linux-media@vger.kernel.org
Signed-off-by: Ming Lei <ming.lei@canonical.com>
---
 drivers/media/usb/cx231xx/cx231xx-audio.c |   10 ++++++----
 drivers/media/usb/cx231xx/cx231xx-core.c  |   10 ++++++----
 drivers/media/usb/cx231xx/cx231xx-vbi.c   |    5 +++--
 3 files changed, 15 insertions(+), 10 deletions(-)

diff --git a/drivers/media/usb/cx231xx/cx231xx-audio.c b/drivers/media/usb/cx231xx/cx231xx-audio.c
index 81a1d97..f6fa0af 100644
--- a/drivers/media/usb/cx231xx/cx231xx-audio.c
+++ b/drivers/media/usb/cx231xx/cx231xx-audio.c
@@ -136,6 +136,7 @@ static void cx231xx_audio_isocirq(struct urb *urb)
 		stride = runtime->frame_bits >> 3;
 
 		for (i = 0; i < urb->number_of_packets; i++) {
+			unsigned long flags;
 			int length = urb->iso_frame_desc[i].actual_length /
 				     stride;
 			cp = (unsigned char *)urb->transfer_buffer +
@@ -158,7 +159,7 @@ static void cx231xx_audio_isocirq(struct urb *urb)
 				       length * stride);
 			}
 
-			snd_pcm_stream_lock(substream);
+			snd_pcm_stream_lock_irqsave(substream, flags);
 
 			dev->adev.hwptr_done_capture += length;
 			if (dev->adev.hwptr_done_capture >=
@@ -173,7 +174,7 @@ static void cx231xx_audio_isocirq(struct urb *urb)
 						runtime->period_size;
 				period_elapsed = 1;
 			}
-			snd_pcm_stream_unlock(substream);
+			snd_pcm_stream_unlock_irqrestore(substream, flags);
 		}
 		if (period_elapsed)
 			snd_pcm_period_elapsed(substream);
@@ -224,6 +225,7 @@ static void cx231xx_audio_bulkirq(struct urb *urb)
 		stride = runtime->frame_bits >> 3;
 
 		if (1) {
+			unsigned long flags;
 			int length = urb->actual_length /
 				     stride;
 			cp = (unsigned char *)urb->transfer_buffer;
@@ -242,7 +244,7 @@ static void cx231xx_audio_bulkirq(struct urb *urb)
 				       length * stride);
 			}
 
-			snd_pcm_stream_lock(substream);
+			snd_pcm_stream_lock_irqsave(substream, flags);
 
 			dev->adev.hwptr_done_capture += length;
 			if (dev->adev.hwptr_done_capture >=
@@ -257,7 +259,7 @@ static void cx231xx_audio_bulkirq(struct urb *urb)
 						runtime->period_size;
 				period_elapsed = 1;
 			}
-			snd_pcm_stream_unlock(substream);
+			snd_pcm_stream_unlock_irqrestore(substream,flags);
 		}
 		if (period_elapsed)
 			snd_pcm_period_elapsed(substream);
diff --git a/drivers/media/usb/cx231xx/cx231xx-core.c b/drivers/media/usb/cx231xx/cx231xx-core.c
index 4ba3ce0..593b397 100644
--- a/drivers/media/usb/cx231xx/cx231xx-core.c
+++ b/drivers/media/usb/cx231xx/cx231xx-core.c
@@ -798,6 +798,7 @@ static void cx231xx_isoc_irq_callback(struct urb *urb)
 	    container_of(dma_q, struct cx231xx_video_mode, vidq);
 	struct cx231xx *dev = container_of(vmode, struct cx231xx, video_mode);
 	int i;
+	unsigned long flags;
 
 	switch (urb->status) {
 	case 0:		/* success */
@@ -813,9 +814,9 @@ static void cx231xx_isoc_irq_callback(struct urb *urb)
 	}
 
 	/* Copy data from URB */
-	spin_lock(&dev->video_mode.slock);
+	spin_lock_irqsave(&dev->video_mode.slock, flags);
 	dev->video_mode.isoc_ctl.isoc_copy(dev, urb);
-	spin_unlock(&dev->video_mode.slock);
+	spin_unlock_irqrestore(&dev->video_mode.slock, flags);
 
 	/* Reset urb buffers */
 	for (i = 0; i < urb->number_of_packets; i++) {
@@ -842,6 +843,7 @@ static void cx231xx_bulk_irq_callback(struct urb *urb)
 	struct cx231xx_video_mode *vmode =
 	    container_of(dma_q, struct cx231xx_video_mode, vidq);
 	struct cx231xx *dev = container_of(vmode, struct cx231xx, video_mode);
+	unsigned long flags;
 
 	switch (urb->status) {
 	case 0:		/* success */
@@ -857,9 +859,9 @@ static void cx231xx_bulk_irq_callback(struct urb *urb)
 	}
 
 	/* Copy data from URB */
-	spin_lock(&dev->video_mode.slock);
+	spin_lock_irqsave(&dev->video_mode.slock, flags);
 	dev->video_mode.bulk_ctl.bulk_copy(dev, urb);
-	spin_unlock(&dev->video_mode.slock);
+	spin_unlock_irqrestore(&dev->video_mode.slock, flags);
 
 	/* Reset urb buffers */
 	urb->status = usb_submit_urb(urb, GFP_ATOMIC);
diff --git a/drivers/media/usb/cx231xx/cx231xx-vbi.c b/drivers/media/usb/cx231xx/cx231xx-vbi.c
index c027942..38e78f8 100644
--- a/drivers/media/usb/cx231xx/cx231xx-vbi.c
+++ b/drivers/media/usb/cx231xx/cx231xx-vbi.c
@@ -306,6 +306,7 @@ static void cx231xx_irq_vbi_callback(struct urb *urb)
 	struct cx231xx_video_mode *vmode =
 	    container_of(dma_q, struct cx231xx_video_mode, vidq);
 	struct cx231xx *dev = container_of(vmode, struct cx231xx, vbi_mode);
+	unsigned long flags;
 
 	switch (urb->status) {
 	case 0:		/* success */
@@ -322,9 +323,9 @@ static void cx231xx_irq_vbi_callback(struct urb *urb)
 	}
 
 	/* Copy data from URB */
-	spin_lock(&dev->vbi_mode.slock);
+	spin_lock_irqsave(&dev->vbi_mode.slock, flags);
 	dev->vbi_mode.bulk_ctl.bulk_copy(dev, urb);
-	spin_unlock(&dev->vbi_mode.slock);
+	spin_unlock_irqrestore(&dev->vbi_mode.slock, flags);
 
 	/* Reset status */
 	urb->status = 0;
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 39+ messages in thread

* [PATCH v1 38/49] media: usb: em28xx: prepare for enabling irq in complete()
  2013-08-17 16:24 [PATCH v1 00/49] USB: prepare for enabling irq in complete() Ming Lei
                   ` (9 preceding siblings ...)
  2013-08-17 16:25 ` [PATCH v1 37/49] media: usb: cx231xx: " Ming Lei
@ 2013-08-17 16:25 ` Ming Lei
  2013-08-22 12:24   ` Hans Verkuil
  2013-08-17 16:25 ` [PATCH v1 39/49] media: usb: sn9x102: " Ming Lei
                   ` (6 subsequent siblings)
  17 siblings, 1 reply; 39+ messages in thread
From: Ming Lei @ 2013-08-17 16:25 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: linux-usb, Oliver Neukum, Alan Stern, Ming Lei,
	Mauro Carvalho Chehab, linux-media

Complete() will be run with interrupt enabled, so change to
spin_lock_irqsave().

Cc: Mauro Carvalho Chehab <mchehab@redhat.com>
Cc: linux-media@vger.kernel.org
Reviewed-by: Devin Heitmueller <dheitmueller@kernellabs.com>
Tested-by: Devin Heitmueller <dheitmueller@kernellabs.com>
Signed-off-by: Ming Lei <ming.lei@canonical.com>
---
 drivers/media/usb/em28xx/em28xx-core.c |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/media/usb/em28xx/em28xx-core.c b/drivers/media/usb/em28xx/em28xx-core.c
index fc157af..0d698f9 100644
--- a/drivers/media/usb/em28xx/em28xx-core.c
+++ b/drivers/media/usb/em28xx/em28xx-core.c
@@ -941,6 +941,7 @@ static void em28xx_irq_callback(struct urb *urb)
 {
 	struct em28xx *dev = urb->context;
 	int i;
+	unsigned long flags;
 
 	switch (urb->status) {
 	case 0:             /* success */
@@ -956,9 +957,9 @@ static void em28xx_irq_callback(struct urb *urb)
 	}
 
 	/* Copy data from URB */
-	spin_lock(&dev->slock);
+	spin_lock_irqsave(&dev->slock, flags);
 	dev->usb_ctl.urb_data_copy(dev, urb);
-	spin_unlock(&dev->slock);
+	spin_unlock_irqrestore(&dev->slock, flags);
 
 	/* Reset urb buffers */
 	for (i = 0; i < urb->number_of_packets; i++) {
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 39+ messages in thread

* [PATCH v1 39/49] media: usb: sn9x102: prepare for enabling irq in complete()
  2013-08-17 16:24 [PATCH v1 00/49] USB: prepare for enabling irq in complete() Ming Lei
                   ` (10 preceding siblings ...)
  2013-08-17 16:25 ` [PATCH v1 38/49] media: usb: em28xx: " Ming Lei
@ 2013-08-17 16:25 ` Ming Lei
  2013-08-22 12:24   ` Hans Verkuil
  2013-08-17 16:25 ` [PATCH v1 40/49] media: usb: tlg2300: " Ming Lei
                   ` (5 subsequent siblings)
  17 siblings, 1 reply; 39+ messages in thread
From: Ming Lei @ 2013-08-17 16:25 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: linux-usb, Oliver Neukum, Alan Stern, Ming Lei,
	Mauro Carvalho Chehab, linux-media

Complete() will be run with interrupt enabled, so change to
spin_lock_irqsave().

Cc: Mauro Carvalho Chehab <mchehab@redhat.com>
Cc: linux-media@vger.kernel.org
Signed-off-by: Ming Lei <ming.lei@canonical.com>
---
 drivers/media/usb/sn9c102/sn9c102_core.c |    7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/media/usb/sn9c102/sn9c102_core.c b/drivers/media/usb/sn9c102/sn9c102_core.c
index 2cb44de..33dc595 100644
--- a/drivers/media/usb/sn9c102/sn9c102_core.c
+++ b/drivers/media/usb/sn9c102/sn9c102_core.c
@@ -784,12 +784,14 @@ end_of_frame:
 				      cam->sensor.pix_format.pixelformat ==
 				      V4L2_PIX_FMT_JPEG) && eof)) {
 					u32 b;
+					unsigned long flags;
 
 					b = (*f)->buf.bytesused;
 					(*f)->state = F_DONE;
 					(*f)->buf.sequence= ++cam->frame_count;
 
-					spin_lock(&cam->queue_lock);
+					spin_lock_irqsave(&cam->queue_lock,
+							  flags);
 					list_move_tail(&(*f)->frame,
 						       &cam->outqueue);
 					if (!list_empty(&cam->inqueue))
@@ -799,7 +801,8 @@ end_of_frame:
 							frame );
 					else
 						(*f) = NULL;
-					spin_unlock(&cam->queue_lock);
+					spin_unlock_irqrestore(&cam->queue_lock,
+							       flags);
 
 					memcpy(cam->sysfs.frame_header,
 					       cam->sof.header, soflen);
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 39+ messages in thread

* [PATCH v1 40/49] media: usb: tlg2300: prepare for enabling irq in complete()
  2013-08-17 16:24 [PATCH v1 00/49] USB: prepare for enabling irq in complete() Ming Lei
                   ` (11 preceding siblings ...)
  2013-08-17 16:25 ` [PATCH v1 39/49] media: usb: sn9x102: " Ming Lei
@ 2013-08-17 16:25 ` Ming Lei
  2013-08-22 12:24   ` Hans Verkuil
  2013-08-17 16:25 ` [PATCH v1 41/49] media: usb: tm6000: " Ming Lei
                   ` (4 subsequent siblings)
  17 siblings, 1 reply; 39+ messages in thread
From: Ming Lei @ 2013-08-17 16:25 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: linux-usb, Oliver Neukum, Alan Stern, Ming Lei,
	Mauro Carvalho Chehab, linux-media

Complete() will be run with interrupt enabled, so change to
spin_lock_irqsave().

Cc: Mauro Carvalho Chehab <mchehab@redhat.com>
Cc: linux-media@vger.kernel.org
Signed-off-by: Ming Lei <ming.lei@canonical.com>
---
 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;
 }
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 39+ messages in thread

* [PATCH v1 41/49] media: usb: tm6000: prepare for enabling irq in complete()
  2013-08-17 16:24 [PATCH v1 00/49] USB: prepare for enabling irq in complete() Ming Lei
                   ` (12 preceding siblings ...)
  2013-08-17 16:25 ` [PATCH v1 40/49] media: usb: tlg2300: " Ming Lei
@ 2013-08-17 16:25 ` Ming Lei
  2013-08-22 12:24   ` Hans Verkuil
  2013-08-17 16:25 ` [PATCH v1 42/49] media: dvb-core: " Ming Lei
                   ` (3 subsequent siblings)
  17 siblings, 1 reply; 39+ messages in thread
From: Ming Lei @ 2013-08-17 16:25 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: linux-usb, Oliver Neukum, Alan Stern, Ming Lei,
	Mauro Carvalho Chehab, linux-media

Complete() will be run with interrupt enabled, so change to
spin_lock_irqsave().

Cc: Mauro Carvalho Chehab <mchehab@redhat.com>
Cc: linux-media@vger.kernel.org
Signed-off-by: Ming Lei <ming.lei@canonical.com>
---
 drivers/media/usb/tm6000/tm6000-video.c |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/media/usb/tm6000/tm6000-video.c b/drivers/media/usb/tm6000/tm6000-video.c
index cc1aa14..8bb440f 100644
--- a/drivers/media/usb/tm6000/tm6000-video.c
+++ b/drivers/media/usb/tm6000/tm6000-video.c
@@ -434,6 +434,7 @@ static void tm6000_irq_callback(struct urb *urb)
 	struct tm6000_dmaqueue  *dma_q = urb->context;
 	struct tm6000_core *dev = container_of(dma_q, struct tm6000_core, vidq);
 	int i;
+	unsigned long flags;
 
 	switch (urb->status) {
 	case 0:
@@ -450,9 +451,9 @@ static void tm6000_irq_callback(struct urb *urb)
 		break;
 	}
 
-	spin_lock(&dev->slock);
+	spin_lock_irqsave(&dev->slock, flags);
 	tm6000_isoc_copy(urb);
-	spin_unlock(&dev->slock);
+	spin_unlock_irqrestore(&dev->slock, flags);
 
 	/* Reset urb buffers */
 	for (i = 0; i < urb->number_of_packets; i++) {
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 39+ messages in thread

* [PATCH v1 42/49] media: dvb-core: prepare for enabling irq in complete()
  2013-08-17 16:24 [PATCH v1 00/49] USB: prepare for enabling irq in complete() Ming Lei
                   ` (13 preceding siblings ...)
  2013-08-17 16:25 ` [PATCH v1 41/49] media: usb: tm6000: " Ming Lei
@ 2013-08-17 16:25 ` Ming Lei
  2013-08-22 12:32   ` Hans Verkuil
  2013-08-17 16:25 ` [PATCH v1 43/49] media: usb: em28xx: " Ming Lei
                   ` (2 subsequent siblings)
  17 siblings, 1 reply; 39+ messages in thread
From: Ming Lei @ 2013-08-17 16:25 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: linux-usb, Oliver Neukum, Alan Stern, Ming Lei,
	Mauro Carvalho Chehab, linux-media

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 <mchehab@redhat.com>
Cc: linux-media@vger.kernel.org
Signed-off-by: Ming Lei <ming.lei@canonical.com>
---
 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);
 
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 39+ messages in thread

* [PATCH v1 43/49] media: usb: em28xx: prepare for enabling irq in complete()
  2013-08-17 16:24 [PATCH v1 00/49] USB: prepare for enabling irq in complete() Ming Lei
                   ` (14 preceding siblings ...)
  2013-08-17 16:25 ` [PATCH v1 42/49] media: dvb-core: " Ming Lei
@ 2013-08-17 16:25 ` Ming Lei
  2013-08-22 12:24   ` Hans Verkuil
       [not found] ` <1376756714-25479-1-git-send-email-ming.lei-Z7WLFzj8eWMS+FvcfC7Uqw@public.gmane.org>
       [not found] ` <1376756714-25479-25-git-send-email-ming.lei@canonical.com>
  17 siblings, 1 reply; 39+ messages in thread
From: Ming Lei @ 2013-08-17 16:25 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: linux-usb, Oliver Neukum, Alan Stern, Ming Lei,
	Mauro Carvalho Chehab, linux-media

Complete() will be run with interrupt enabled, so add local_irq_save()
before acquiring the lock without irqsave().

Cc: Mauro Carvalho Chehab <mchehab@redhat.com>
Cc: linux-media@vger.kernel.org
Signed-off-by: Ming Lei <ming.lei@canonical.com>
---
 drivers/media/usb/em28xx/em28xx-audio.c |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/media/usb/em28xx/em28xx-audio.c b/drivers/media/usb/em28xx/em28xx-audio.c
index 2fdb66e..7fd1b2a 100644
--- a/drivers/media/usb/em28xx/em28xx-audio.c
+++ b/drivers/media/usb/em28xx/em28xx-audio.c
@@ -113,6 +113,7 @@ static void em28xx_audio_isocirq(struct urb *urb)
 		stride = runtime->frame_bits >> 3;
 
 		for (i = 0; i < urb->number_of_packets; i++) {
+			unsigned long flags;
 			int length =
 			    urb->iso_frame_desc[i].actual_length / stride;
 			cp = (unsigned char *)urb->transfer_buffer +
@@ -134,7 +135,7 @@ static void em28xx_audio_isocirq(struct urb *urb)
 				       length * stride);
 			}
 
-			snd_pcm_stream_lock(substream);
+			snd_pcm_stream_lock_irqsave(substream, flags);
 
 			dev->adev.hwptr_done_capture += length;
 			if (dev->adev.hwptr_done_capture >=
@@ -150,7 +151,7 @@ static void em28xx_audio_isocirq(struct urb *urb)
 				period_elapsed = 1;
 			}
 
-			snd_pcm_stream_unlock(substream);
+			snd_pcm_stream_unlock_irqrestore(substream, flags);
 		}
 		if (period_elapsed)
 			snd_pcm_period_elapsed(substream);
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 39+ messages in thread

* [PATCH v1 44/49] sound: usb: midi: prepare for enabling irq in complete()
       [not found] ` <1376756714-25479-1-git-send-email-ming.lei-Z7WLFzj8eWMS+FvcfC7Uqw@public.gmane.org>
                     ` (2 preceding siblings ...)
  2013-08-17 16:24   ` [PATCH v1 31/49] USBNET: rtl8150: " Ming Lei
@ 2013-08-17 16:25   ` Ming Lei
       [not found]     ` <1376756714-25479-45-git-send-email-ming.lei-Z7WLFzj8eWMS+FvcfC7Uqw@public.gmane.org>
  2013-08-17 16:25   ` [PATCH v1 45/49] sound: usb: caiaq: " Ming Lei
  4 siblings, 1 reply; 39+ messages in thread
From: Ming Lei @ 2013-08-17 16:25 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: linux-usb-u79uwXL29TY76Z2rM5mHXA, Oliver Neukum, Alan Stern,
	Ming Lei, Jaroslav Kysela, Takashi Iwai, Clemens Ladisch,
	alsa-devel-K7yf7f+aM1XWsZ/bQMPhNw

Complete() will be run with interrupt enabled, so change to
spin_lock_irqsave().

Cc: Jaroslav Kysela <perex-/Fr2/VpizcU@public.gmane.org>
Cc: Takashi Iwai <tiwai-l3A5Bk7waGM@public.gmane.org>
Cc: Clemens Ladisch <clemens-P6GI/4k7KOmELgA04lAiVw@public.gmane.org>
Cc: alsa-devel-K7yf7f+aM1XWsZ/bQMPhNw@public.gmane.org
Signed-off-by: Ming Lei <ming.lei-Z7WLFzj8eWMS+FvcfC7Uqw@public.gmane.org>
---
 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

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 39+ messages in thread

* [PATCH v1 45/49] sound: usb: caiaq: prepare for enabling irq in complete()
       [not found] ` <1376756714-25479-1-git-send-email-ming.lei-Z7WLFzj8eWMS+FvcfC7Uqw@public.gmane.org>
                     ` (3 preceding siblings ...)
  2013-08-17 16:25   ` [PATCH v1 44/49] sound: usb: midi: " Ming Lei
@ 2013-08-17 16:25   ` Ming Lei
       [not found]     ` <1376756714-25479-46-git-send-email-ming.lei-Z7WLFzj8eWMS+FvcfC7Uqw@public.gmane.org>
  4 siblings, 1 reply; 39+ messages in thread
From: Ming Lei @ 2013-08-17 16:25 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: linux-usb-u79uwXL29TY76Z2rM5mHXA, Oliver Neukum, Alan Stern,
	Ming Lei, Jaroslav Kysela, Takashi Iwai,
	alsa-devel-K7yf7f+aM1XWsZ/bQMPhNw

Complete() will be run with interrupt enabled, so change to
spin_lock_irqsave().

Cc: Jaroslav Kysela <perex-/Fr2/VpizcU@public.gmane.org>
Cc: Takashi Iwai <tiwai-l3A5Bk7waGM@public.gmane.org>
Cc: alsa-devel-K7yf7f+aM1XWsZ/bQMPhNw@public.gmane.org
Acked-by: Daniel Mack <zonque-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Signed-off-by: Ming Lei <ming.lei-Z7WLFzj8eWMS+FvcfC7Uqw@public.gmane.org>
---
 sound/usb/caiaq/audio.c |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/sound/usb/caiaq/audio.c b/sound/usb/caiaq/audio.c
index 7103b09..e5675ab 100644
--- a/sound/usb/caiaq/audio.c
+++ b/sound/usb/caiaq/audio.c
@@ -672,10 +672,11 @@ static void read_completed(struct urb *urb)
 		offset += len;
 
 		if (len > 0) {
-			spin_lock(&cdev->spinlock);
+			unsigned long flags;
+			spin_lock_irqsave(&cdev->spinlock, flags);
 			fill_out_urb(cdev, out, &out->iso_frame_desc[outframe]);
 			read_in_urb(cdev, urb, &urb->iso_frame_desc[frame]);
-			spin_unlock(&cdev->spinlock);
+			spin_unlock_irqrestore(&cdev->spinlock, flags);
 			check_for_elapsed_periods(cdev, cdev->sub_playback);
 			check_for_elapsed_periods(cdev, cdev->sub_capture);
 			send_it = 1;
-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 39+ messages in thread

* Re: [PATCH v1 26/49] input: cm109: prepare for enabling irq in complete()
  2013-08-17 16:24 ` [PATCH v1 26/49] input: cm109: " Ming Lei
@ 2013-08-18  3:37   ` Dmitry Torokhov
  2013-08-18 14:10     ` Ming Lei
  0 siblings, 1 reply; 39+ messages in thread
From: Dmitry Torokhov @ 2013-08-18  3:37 UTC (permalink / raw)
  To: Ming Lei
  Cc: Greg Kroah-Hartman, linux-usb, Oliver Neukum, Alan Stern, linux-input

Hi Ming,

On Sun, Aug 18, 2013 at 12:24:51AM +0800, Ming Lei wrote:
> Complete() will be run with interrupt enabled, so change to
> spin_lock_irqsave().

I think cm109 needs some love in it's URB handling, but this patch does
not change anything, so:

Acked-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>

Or do you want me to pick it up for my tree?

Thanks.

-- 
Dmitry

^ permalink raw reply	[flat|nested] 39+ messages in thread

* Re: [PATCH v1 26/49] input: cm109: prepare for enabling irq in complete()
  2013-08-18  3:37   ` Dmitry Torokhov
@ 2013-08-18 14:10     ` Ming Lei
  2013-08-18 18:05       ` Greg Kroah-Hartman
  0 siblings, 1 reply; 39+ messages in thread
From: Ming Lei @ 2013-08-18 14:10 UTC (permalink / raw)
  To: Dmitry Torokhov
  Cc: Greg Kroah-Hartman, linux-usb, Oliver Neukum, Alan Stern, linux-input

Hi Dmitry,

On Sun, Aug 18, 2013 at 11:37 AM, Dmitry Torokhov
<dmitry.torokhov@gmail.com> wrote:
> Hi Ming,
>
> On Sun, Aug 18, 2013 at 12:24:51AM +0800, Ming Lei wrote:
>> Complete() will be run with interrupt enabled, so change to
>> spin_lock_irqsave().
>
> I think cm109 needs some love in it's URB handling, but this patch does
> not change anything, so:
>
> Acked-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>

Thank you.

>
> Or do you want me to pick it up for my tree?

IMO, it might be easier to merge these patches via one tree, so

Greg, would you like to manage all these patches via your tree?

If not, I have to push these patches on each subsystem, then you
need to pick it up for your input tree...


Thanks,
--
Ming Lei

^ permalink raw reply	[flat|nested] 39+ messages in thread

* Re: [PATCH v1 26/49] input: cm109: prepare for enabling irq in complete()
  2013-08-18 14:10     ` Ming Lei
@ 2013-08-18 18:05       ` Greg Kroah-Hartman
  0 siblings, 0 replies; 39+ messages in thread
From: Greg Kroah-Hartman @ 2013-08-18 18:05 UTC (permalink / raw)
  To: Ming Lei
  Cc: Dmitry Torokhov, linux-usb, Oliver Neukum, Alan Stern, linux-input

On Sun, Aug 18, 2013 at 10:10:15PM +0800, Ming Lei wrote:
> Hi Dmitry,
> 
> On Sun, Aug 18, 2013 at 11:37 AM, Dmitry Torokhov
> <dmitry.torokhov@gmail.com> wrote:
> > Hi Ming,
> >
> > On Sun, Aug 18, 2013 at 12:24:51AM +0800, Ming Lei wrote:
> >> Complete() will be run with interrupt enabled, so change to
> >> spin_lock_irqsave().
> >
> > I think cm109 needs some love in it's URB handling, but this patch does
> > not change anything, so:
> >
> > Acked-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
> 
> Thank you.
> 
> >
> > Or do you want me to pick it up for my tree?
> 
> IMO, it might be easier to merge these patches via one tree, so
> 
> Greg, would you like to manage all these patches via your tree?

Yes, I can take them all.

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 39+ messages in thread

* Re: [PATCH v1 44/49] sound: usb: midi: prepare for enabling irq in complete()
       [not found]     ` <1376756714-25479-45-git-send-email-ming.lei-Z7WLFzj8eWMS+FvcfC7Uqw@public.gmane.org>
@ 2013-08-19 13:47       ` Takashi Iwai
  0 siblings, 0 replies; 39+ messages in thread
From: Takashi Iwai @ 2013-08-19 13:47 UTC (permalink / raw)
  To: Ming Lei
  Cc: Greg Kroah-Hartman, linux-usb-u79uwXL29TY76Z2rM5mHXA,
	Oliver Neukum, Alan Stern, Jaroslav Kysela, Clemens Ladisch,
	alsa-devel-K7yf7f+aM1XWsZ/bQMPhNw

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-/Fr2/VpizcU@public.gmane.org>
> Cc: Takashi Iwai <tiwai-l3A5Bk7waGM@public.gmane.org>

Acked-by: Takashi Iwai <tiwai-l3A5Bk7waGM@public.gmane.org>


thanks,

Takashi


> Cc: Clemens Ladisch <clemens-P6GI/4k7KOmELgA04lAiVw@public.gmane.org>
> Cc: alsa-devel-K7yf7f+aM1XWsZ/bQMPhNw@public.gmane.org
> Signed-off-by: Ming Lei <ming.lei-Z7WLFzj8eWMS+FvcfC7Uqw@public.gmane.org>
> ---
>  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
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 39+ messages in thread

* Re: [PATCH v1 45/49] sound: usb: caiaq: prepare for enabling irq in complete()
       [not found]     ` <1376756714-25479-46-git-send-email-ming.lei-Z7WLFzj8eWMS+FvcfC7Uqw@public.gmane.org>
@ 2013-08-19 13:48       ` Takashi Iwai
  0 siblings, 0 replies; 39+ messages in thread
From: Takashi Iwai @ 2013-08-19 13:48 UTC (permalink / raw)
  To: Ming Lei
  Cc: Greg Kroah-Hartman, linux-usb-u79uwXL29TY76Z2rM5mHXA,
	Oliver Neukum, Alan Stern, Jaroslav Kysela,
	alsa-devel-K7yf7f+aM1XWsZ/bQMPhNw

At Sun, 18 Aug 2013 00:25:10 +0800,
Ming Lei wrote:
> 
> Complete() will be run with interrupt enabled, so change to
> spin_lock_irqsave().
> 
> Cc: Jaroslav Kysela <perex-/Fr2/VpizcU@public.gmane.org>
> Cc: Takashi Iwai <tiwai-l3A5Bk7waGM@public.gmane.org>

Acked-by: Takashi Iwai <tiwai@suse.e>


thanks,

Takashi


> Cc: alsa-devel-K7yf7f+aM1XWsZ/bQMPhNw@public.gmane.org
> Acked-by: Daniel Mack <zonque-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
> Signed-off-by: Ming Lei <ming.lei-Z7WLFzj8eWMS+FvcfC7Uqw@public.gmane.org>
> ---
>  sound/usb/caiaq/audio.c |    5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/sound/usb/caiaq/audio.c b/sound/usb/caiaq/audio.c
> index 7103b09..e5675ab 100644
> --- a/sound/usb/caiaq/audio.c
> +++ b/sound/usb/caiaq/audio.c
> @@ -672,10 +672,11 @@ static void read_completed(struct urb *urb)
>  		offset += len;
>  
>  		if (len > 0) {
> -			spin_lock(&cdev->spinlock);
> +			unsigned long flags;
> +			spin_lock_irqsave(&cdev->spinlock, flags);
>  			fill_out_urb(cdev, out, &out->iso_frame_desc[outframe]);
>  			read_in_urb(cdev, urb, &urb->iso_frame_desc[frame]);
> -			spin_unlock(&cdev->spinlock);
> +			spin_unlock_irqrestore(&cdev->spinlock, flags);
>  			check_for_elapsed_periods(cdev, cdev->sub_playback);
>  			check_for_elapsed_periods(cdev, cdev->sub_capture);
>  			send_it = 1;
> -- 
> 1.7.9.5
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 39+ messages in thread

* Re: [PATCH v1 37/49] media: usb: cx231xx: prepare for enabling irq in complete()
  2013-08-17 16:25 ` [PATCH v1 37/49] media: usb: cx231xx: " Ming Lei
@ 2013-08-22 11:33   ` Hans Verkuil
  0 siblings, 0 replies; 39+ messages in thread
From: Hans Verkuil @ 2013-08-22 11:33 UTC (permalink / raw)
  To: Ming Lei
  Cc: Greg Kroah-Hartman, linux-usb, Oliver Neukum, Alan Stern,
	Mauro Carvalho Chehab, Hans Verkuil, linux-media

On Sat 17 August 2013 18:25:02 Ming Lei wrote:
> Complete() will be run with interrupt enabled, so change to
> spin_lock_irqsave().
> 
> Cc: Mauro Carvalho Chehab <mchehab@redhat.com>
> Cc: Hans Verkuil <hans.verkuil@cisco.com>
> Cc: linux-media@vger.kernel.org
> Signed-off-by: Ming Lei <ming.lei@canonical.com>

Acked-by: Hans Verkuil <hans.verkuil@cisco.com>

Regards,

	Hans

> ---
>  drivers/media/usb/cx231xx/cx231xx-audio.c |   10 ++++++----
>  drivers/media/usb/cx231xx/cx231xx-core.c  |   10 ++++++----
>  drivers/media/usb/cx231xx/cx231xx-vbi.c   |    5 +++--
>  3 files changed, 15 insertions(+), 10 deletions(-)
> 
> diff --git a/drivers/media/usb/cx231xx/cx231xx-audio.c b/drivers/media/usb/cx231xx/cx231xx-audio.c
> index 81a1d97..f6fa0af 100644
> --- a/drivers/media/usb/cx231xx/cx231xx-audio.c
> +++ b/drivers/media/usb/cx231xx/cx231xx-audio.c
> @@ -136,6 +136,7 @@ static void cx231xx_audio_isocirq(struct urb *urb)
>  		stride = runtime->frame_bits >> 3;
>  
>  		for (i = 0; i < urb->number_of_packets; i++) {
> +			unsigned long flags;
>  			int length = urb->iso_frame_desc[i].actual_length /
>  				     stride;
>  			cp = (unsigned char *)urb->transfer_buffer +
> @@ -158,7 +159,7 @@ static void cx231xx_audio_isocirq(struct urb *urb)
>  				       length * stride);
>  			}
>  
> -			snd_pcm_stream_lock(substream);
> +			snd_pcm_stream_lock_irqsave(substream, flags);
>  
>  			dev->adev.hwptr_done_capture += length;
>  			if (dev->adev.hwptr_done_capture >=
> @@ -173,7 +174,7 @@ static void cx231xx_audio_isocirq(struct urb *urb)
>  						runtime->period_size;
>  				period_elapsed = 1;
>  			}
> -			snd_pcm_stream_unlock(substream);
> +			snd_pcm_stream_unlock_irqrestore(substream, flags);
>  		}
>  		if (period_elapsed)
>  			snd_pcm_period_elapsed(substream);
> @@ -224,6 +225,7 @@ static void cx231xx_audio_bulkirq(struct urb *urb)
>  		stride = runtime->frame_bits >> 3;
>  
>  		if (1) {
> +			unsigned long flags;
>  			int length = urb->actual_length /
>  				     stride;
>  			cp = (unsigned char *)urb->transfer_buffer;
> @@ -242,7 +244,7 @@ static void cx231xx_audio_bulkirq(struct urb *urb)
>  				       length * stride);
>  			}
>  
> -			snd_pcm_stream_lock(substream);
> +			snd_pcm_stream_lock_irqsave(substream, flags);
>  
>  			dev->adev.hwptr_done_capture += length;
>  			if (dev->adev.hwptr_done_capture >=
> @@ -257,7 +259,7 @@ static void cx231xx_audio_bulkirq(struct urb *urb)
>  						runtime->period_size;
>  				period_elapsed = 1;
>  			}
> -			snd_pcm_stream_unlock(substream);
> +			snd_pcm_stream_unlock_irqrestore(substream,flags);
>  		}
>  		if (period_elapsed)
>  			snd_pcm_period_elapsed(substream);
> diff --git a/drivers/media/usb/cx231xx/cx231xx-core.c b/drivers/media/usb/cx231xx/cx231xx-core.c
> index 4ba3ce0..593b397 100644
> --- a/drivers/media/usb/cx231xx/cx231xx-core.c
> +++ b/drivers/media/usb/cx231xx/cx231xx-core.c
> @@ -798,6 +798,7 @@ static void cx231xx_isoc_irq_callback(struct urb *urb)
>  	    container_of(dma_q, struct cx231xx_video_mode, vidq);
>  	struct cx231xx *dev = container_of(vmode, struct cx231xx, video_mode);
>  	int i;
> +	unsigned long flags;
>  
>  	switch (urb->status) {
>  	case 0:		/* success */
> @@ -813,9 +814,9 @@ static void cx231xx_isoc_irq_callback(struct urb *urb)
>  	}
>  
>  	/* Copy data from URB */
> -	spin_lock(&dev->video_mode.slock);
> +	spin_lock_irqsave(&dev->video_mode.slock, flags);
>  	dev->video_mode.isoc_ctl.isoc_copy(dev, urb);
> -	spin_unlock(&dev->video_mode.slock);
> +	spin_unlock_irqrestore(&dev->video_mode.slock, flags);
>  
>  	/* Reset urb buffers */
>  	for (i = 0; i < urb->number_of_packets; i++) {
> @@ -842,6 +843,7 @@ static void cx231xx_bulk_irq_callback(struct urb *urb)
>  	struct cx231xx_video_mode *vmode =
>  	    container_of(dma_q, struct cx231xx_video_mode, vidq);
>  	struct cx231xx *dev = container_of(vmode, struct cx231xx, video_mode);
> +	unsigned long flags;
>  
>  	switch (urb->status) {
>  	case 0:		/* success */
> @@ -857,9 +859,9 @@ static void cx231xx_bulk_irq_callback(struct urb *urb)
>  	}
>  
>  	/* Copy data from URB */
> -	spin_lock(&dev->video_mode.slock);
> +	spin_lock_irqsave(&dev->video_mode.slock, flags);
>  	dev->video_mode.bulk_ctl.bulk_copy(dev, urb);
> -	spin_unlock(&dev->video_mode.slock);
> +	spin_unlock_irqrestore(&dev->video_mode.slock, flags);
>  
>  	/* Reset urb buffers */
>  	urb->status = usb_submit_urb(urb, GFP_ATOMIC);
> diff --git a/drivers/media/usb/cx231xx/cx231xx-vbi.c b/drivers/media/usb/cx231xx/cx231xx-vbi.c
> index c027942..38e78f8 100644
> --- a/drivers/media/usb/cx231xx/cx231xx-vbi.c
> +++ b/drivers/media/usb/cx231xx/cx231xx-vbi.c
> @@ -306,6 +306,7 @@ static void cx231xx_irq_vbi_callback(struct urb *urb)
>  	struct cx231xx_video_mode *vmode =
>  	    container_of(dma_q, struct cx231xx_video_mode, vidq);
>  	struct cx231xx *dev = container_of(vmode, struct cx231xx, vbi_mode);
> +	unsigned long flags;
>  
>  	switch (urb->status) {
>  	case 0:		/* success */
> @@ -322,9 +323,9 @@ static void cx231xx_irq_vbi_callback(struct urb *urb)
>  	}
>  
>  	/* Copy data from URB */
> -	spin_lock(&dev->vbi_mode.slock);
> +	spin_lock_irqsave(&dev->vbi_mode.slock, flags);
>  	dev->vbi_mode.bulk_ctl.bulk_copy(dev, urb);
> -	spin_unlock(&dev->vbi_mode.slock);
> +	spin_unlock_irqrestore(&dev->vbi_mode.slock, flags);
>  
>  	/* Reset status */
>  	urb->status = 0;
> 

^ permalink raw reply	[flat|nested] 39+ messages in thread

* Re: [PATCH v1 23/49] hid: usbhid: prepare for enabling irq in complete()
  2013-08-17 16:24 ` [PATCH v1 23/49] hid: usbhid: " Ming Lei
@ 2013-08-22 12:19   ` Ming Lei
  2013-08-26 11:44   ` Jiri Kosina
  1 sibling, 0 replies; 39+ messages in thread
From: Ming Lei @ 2013-08-22 12:19 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: linux-usb, Oliver Neukum, Alan Stern, Ming Lei, Jiri Kosina, linux-input

On Sun, Aug 18, 2013 at 12:24 AM, Ming Lei <ming.lei@canonical.com> wrote:
> Complete() will be run with interrupt enabled, so change to
> spin_lock_irqsave().
>
> Cc: Jiri Kosina <jkosina@suse.cz>
> Cc: linux-input@vger.kernel.org
> Signed-off-by: Ming Lei <ming.lei@canonical.com>

Jiri, could you review and give an Ack?


Thanks,
--
Ming Lei

^ permalink raw reply	[flat|nested] 39+ messages in thread

* Re: [PATCH v1 24/49] BT: btusb: prepare for enabling irq in complete()
       [not found] ` <1376756714-25479-25-git-send-email-ming.lei@canonical.com>
@ 2013-08-22 12:23   ` Ming Lei
  0 siblings, 0 replies; 39+ messages in thread
From: Ming Lei @ 2013-08-22 12:23 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: linux-usb, Oliver Neukum, Alan Stern, Ming Lei, Marcel Holtmann,
	Gustavo Padovan, Johan Hedberg, linux-bluetooth

On Sun, Aug 18, 2013 at 12:24 AM, Ming Lei <ming.lei@canonical.com> wrote:
> Complete() will be run with interrupt enabled, so change to
> spin_lock_irqsave().
>
> Cc: Marcel Holtmann <marcel@holtmann.org>
> Cc: Gustavo Padovan <gustavo@padovan.org>
> Cc: Johan Hedberg <johan.hedberg@gmail.com>
> Cc: linux-bluetooth@vger.kernel.org
> Signed-off-by: Ming Lei <ming.lei@canonical.com>

Marcel, Gustavo and Johan, could you review and give an Ack if
this one and 25/49 are OK so they can be merged via Greg's USB
tree?


Thanks,
--
Ming Lei

^ permalink raw reply	[flat|nested] 39+ messages in thread

* Re: [PATCH v1 38/49] media: usb: em28xx: prepare for enabling irq in complete()
  2013-08-17 16:25 ` [PATCH v1 38/49] media: usb: em28xx: " Ming Lei
@ 2013-08-22 12:24   ` Hans Verkuil
  0 siblings, 0 replies; 39+ messages in thread
From: Hans Verkuil @ 2013-08-22 12:24 UTC (permalink / raw)
  To: Ming Lei
  Cc: Greg Kroah-Hartman, linux-usb, Oliver Neukum, Alan Stern,
	Mauro Carvalho Chehab, linux-media

On Sat 17 August 2013 18:25:03 Ming Lei wrote:
> Complete() will be run with interrupt enabled, so change to
> spin_lock_irqsave().
> 
> Cc: Mauro Carvalho Chehab <mchehab@redhat.com>
> Cc: linux-media@vger.kernel.org
> Reviewed-by: Devin Heitmueller <dheitmueller@kernellabs.com>
> Tested-by: Devin Heitmueller <dheitmueller@kernellabs.com>
> Signed-off-by: Ming Lei <ming.lei@canonical.com>

Acked-by: Hans Verkuil <hans.verkuil@cisco.com>

Regards,

	Hans

> ---
>  drivers/media/usb/em28xx/em28xx-core.c |    5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/media/usb/em28xx/em28xx-core.c b/drivers/media/usb/em28xx/em28xx-core.c
> index fc157af..0d698f9 100644
> --- a/drivers/media/usb/em28xx/em28xx-core.c
> +++ b/drivers/media/usb/em28xx/em28xx-core.c
> @@ -941,6 +941,7 @@ static void em28xx_irq_callback(struct urb *urb)
>  {
>  	struct em28xx *dev = urb->context;
>  	int i;
> +	unsigned long flags;
>  
>  	switch (urb->status) {
>  	case 0:             /* success */
> @@ -956,9 +957,9 @@ static void em28xx_irq_callback(struct urb *urb)
>  	}
>  
>  	/* Copy data from URB */
> -	spin_lock(&dev->slock);
> +	spin_lock_irqsave(&dev->slock, flags);
>  	dev->usb_ctl.urb_data_copy(dev, urb);
> -	spin_unlock(&dev->slock);
> +	spin_unlock_irqrestore(&dev->slock, flags);
>  
>  	/* Reset urb buffers */
>  	for (i = 0; i < urb->number_of_packets; i++) {
> 

^ permalink raw reply	[flat|nested] 39+ messages in thread

* Re: [PATCH v1 39/49] media: usb: sn9x102: prepare for enabling irq in complete()
  2013-08-17 16:25 ` [PATCH v1 39/49] media: usb: sn9x102: " Ming Lei
@ 2013-08-22 12:24   ` Hans Verkuil
  0 siblings, 0 replies; 39+ messages in thread
From: Hans Verkuil @ 2013-08-22 12:24 UTC (permalink / raw)
  To: Ming Lei
  Cc: Greg Kroah-Hartman, linux-usb, Oliver Neukum, Alan Stern,
	Mauro Carvalho Chehab, linux-media

On Sat 17 August 2013 18:25:04 Ming Lei wrote:
> Complete() will be run with interrupt enabled, so change to
> spin_lock_irqsave().
> 
> Cc: Mauro Carvalho Chehab <mchehab@redhat.com>
> Cc: linux-media@vger.kernel.org
> Signed-off-by: Ming Lei <ming.lei@canonical.com>

Acked-by: Hans Verkuil <hans.verkuil@cisco.com>

Regards,

	Hans

> ---
>  drivers/media/usb/sn9c102/sn9c102_core.c |    7 +++++--
>  1 file changed, 5 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/media/usb/sn9c102/sn9c102_core.c b/drivers/media/usb/sn9c102/sn9c102_core.c
> index 2cb44de..33dc595 100644
> --- a/drivers/media/usb/sn9c102/sn9c102_core.c
> +++ b/drivers/media/usb/sn9c102/sn9c102_core.c
> @@ -784,12 +784,14 @@ end_of_frame:
>  				      cam->sensor.pix_format.pixelformat ==
>  				      V4L2_PIX_FMT_JPEG) && eof)) {
>  					u32 b;
> +					unsigned long flags;
>  
>  					b = (*f)->buf.bytesused;
>  					(*f)->state = F_DONE;
>  					(*f)->buf.sequence= ++cam->frame_count;
>  
> -					spin_lock(&cam->queue_lock);
> +					spin_lock_irqsave(&cam->queue_lock,
> +							  flags);
>  					list_move_tail(&(*f)->frame,
>  						       &cam->outqueue);
>  					if (!list_empty(&cam->inqueue))
> @@ -799,7 +801,8 @@ end_of_frame:
>  							frame );
>  					else
>  						(*f) = NULL;
> -					spin_unlock(&cam->queue_lock);
> +					spin_unlock_irqrestore(&cam->queue_lock,
> +							       flags);
>  
>  					memcpy(cam->sysfs.frame_header,
>  					       cam->sof.header, soflen);
> 

^ permalink raw reply	[flat|nested] 39+ messages in thread

* Re: [PATCH v1 40/49] media: usb: tlg2300: prepare for enabling irq in complete()
  2013-08-17 16:25 ` [PATCH v1 40/49] media: usb: tlg2300: " Ming Lei
@ 2013-08-22 12:24   ` Hans Verkuil
  0 siblings, 0 replies; 39+ messages in thread
From: Hans Verkuil @ 2013-08-22 12:24 UTC (permalink / raw)
  To: Ming Lei
  Cc: Greg Kroah-Hartman, linux-usb, Oliver Neukum, Alan Stern,
	Mauro Carvalho Chehab, linux-media

On Sat 17 August 2013 18:25:05 Ming Lei wrote:
> Complete() will be run with interrupt enabled, so change to
> spin_lock_irqsave().
> 
> Cc: Mauro Carvalho Chehab <mchehab@redhat.com>
> Cc: linux-media@vger.kernel.org
> Signed-off-by: Ming Lei <ming.lei@canonical.com>

Acked-by: Hans Verkuil <hans.verkuil@cisco.com>

Regards,

	Hans

> ---
>  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;
>  }
> 

^ permalink raw reply	[flat|nested] 39+ messages in thread

* Re: [PATCH v1 41/49] media: usb: tm6000: prepare for enabling irq in complete()
  2013-08-17 16:25 ` [PATCH v1 41/49] media: usb: tm6000: " Ming Lei
@ 2013-08-22 12:24   ` Hans Verkuil
  0 siblings, 0 replies; 39+ messages in thread
From: Hans Verkuil @ 2013-08-22 12:24 UTC (permalink / raw)
  To: Ming Lei
  Cc: Greg Kroah-Hartman, linux-usb, Oliver Neukum, Alan Stern,
	Mauro Carvalho Chehab, linux-media

On Sat 17 August 2013 18:25:06 Ming Lei wrote:
> Complete() will be run with interrupt enabled, so change to
> spin_lock_irqsave().
> 
> Cc: Mauro Carvalho Chehab <mchehab@redhat.com>
> Cc: linux-media@vger.kernel.org
> Signed-off-by: Ming Lei <ming.lei@canonical.com>

Acked-by: Hans Verkuil <hans.verkuil@cisco.com>

Regards,

	Hans

> ---
>  drivers/media/usb/tm6000/tm6000-video.c |    5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/media/usb/tm6000/tm6000-video.c b/drivers/media/usb/tm6000/tm6000-video.c
> index cc1aa14..8bb440f 100644
> --- a/drivers/media/usb/tm6000/tm6000-video.c
> +++ b/drivers/media/usb/tm6000/tm6000-video.c
> @@ -434,6 +434,7 @@ static void tm6000_irq_callback(struct urb *urb)
>  	struct tm6000_dmaqueue  *dma_q = urb->context;
>  	struct tm6000_core *dev = container_of(dma_q, struct tm6000_core, vidq);
>  	int i;
> +	unsigned long flags;
>  
>  	switch (urb->status) {
>  	case 0:
> @@ -450,9 +451,9 @@ static void tm6000_irq_callback(struct urb *urb)
>  		break;
>  	}
>  
> -	spin_lock(&dev->slock);
> +	spin_lock_irqsave(&dev->slock, flags);
>  	tm6000_isoc_copy(urb);
> -	spin_unlock(&dev->slock);
> +	spin_unlock_irqrestore(&dev->slock, flags);
>  
>  	/* Reset urb buffers */
>  	for (i = 0; i < urb->number_of_packets; i++) {
> 

^ permalink raw reply	[flat|nested] 39+ messages in thread

* Re: [PATCH v1 43/49] media: usb: em28xx: prepare for enabling irq in complete()
  2013-08-17 16:25 ` [PATCH v1 43/49] media: usb: em28xx: " Ming Lei
@ 2013-08-22 12:24   ` Hans Verkuil
  0 siblings, 0 replies; 39+ messages in thread
From: Hans Verkuil @ 2013-08-22 12:24 UTC (permalink / raw)
  To: Ming Lei
  Cc: Greg Kroah-Hartman, linux-usb, Oliver Neukum, Alan Stern,
	Mauro Carvalho Chehab, linux-media

On Sat 17 August 2013 18:25:08 Ming Lei wrote:
> Complete() will be run with interrupt enabled, so add local_irq_save()
> before acquiring the lock without irqsave().
> 
> Cc: Mauro Carvalho Chehab <mchehab@redhat.com>
> Cc: linux-media@vger.kernel.org
> Signed-off-by: Ming Lei <ming.lei@canonical.com>

Acked-by: Hans Verkuil <hans.verkuil@cisco.com>

Regards,

	Hans

> ---
>  drivers/media/usb/em28xx/em28xx-audio.c |    5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/media/usb/em28xx/em28xx-audio.c b/drivers/media/usb/em28xx/em28xx-audio.c
> index 2fdb66e..7fd1b2a 100644
> --- a/drivers/media/usb/em28xx/em28xx-audio.c
> +++ b/drivers/media/usb/em28xx/em28xx-audio.c
> @@ -113,6 +113,7 @@ static void em28xx_audio_isocirq(struct urb *urb)
>  		stride = runtime->frame_bits >> 3;
>  
>  		for (i = 0; i < urb->number_of_packets; i++) {
> +			unsigned long flags;
>  			int length =
>  			    urb->iso_frame_desc[i].actual_length / stride;
>  			cp = (unsigned char *)urb->transfer_buffer +
> @@ -134,7 +135,7 @@ static void em28xx_audio_isocirq(struct urb *urb)
>  				       length * stride);
>  			}
>  
> -			snd_pcm_stream_lock(substream);
> +			snd_pcm_stream_lock_irqsave(substream, flags);
>  
>  			dev->adev.hwptr_done_capture += length;
>  			if (dev->adev.hwptr_done_capture >=
> @@ -150,7 +151,7 @@ static void em28xx_audio_isocirq(struct urb *urb)
>  				period_elapsed = 1;
>  			}
>  
> -			snd_pcm_stream_unlock(substream);
> +			snd_pcm_stream_unlock_irqrestore(substream, flags);
>  		}
>  		if (period_elapsed)
>  			snd_pcm_period_elapsed(substream);
> 

^ permalink raw reply	[flat|nested] 39+ messages in thread

* Re: [PATCH v1 42/49] media: dvb-core: prepare for enabling irq in complete()
  2013-08-17 16:25 ` [PATCH v1 42/49] media: dvb-core: " Ming Lei
@ 2013-08-22 12:32   ` Hans Verkuil
  0 siblings, 0 replies; 39+ messages in thread
From: Hans Verkuil @ 2013-08-22 12:32 UTC (permalink / raw)
  To: Ming Lei
  Cc: Greg Kroah-Hartman, linux-usb, Oliver Neukum, Alan Stern,
	Mauro Carvalho Chehab, linux-media

On Sat 17 August 2013 18:25:07 Ming Lei wrote:
> 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 <mchehab@redhat.com>
> Cc: linux-media@vger.kernel.org
> Signed-off-by: Ming Lei <ming.lei@canonical.com>

Acked-by: Hans Verkuil <hans.verkuil@cisco.com>

Note: Mauro needs to Ack this as well. It looks good to me, but I don't
maintain dvb code.

Regards,

	Hans

> ---
>  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);
>  
> 

^ permalink raw reply	[flat|nested] 39+ messages in thread

* Re: [PATCH v1 23/49] hid: usbhid: prepare for enabling irq in complete()
  2013-08-17 16:24 ` [PATCH v1 23/49] hid: usbhid: " Ming Lei
  2013-08-22 12:19   ` Ming Lei
@ 2013-08-26 11:44   ` Jiri Kosina
  1 sibling, 0 replies; 39+ messages in thread
From: Jiri Kosina @ 2013-08-26 11:44 UTC (permalink / raw)
  To: Ming Lei
  Cc: Greg Kroah-Hartman, linux-usb, Oliver Neukum, Alan Stern,
	Jiri Kosina, linux-input

On Sun, 18 Aug 2013, Ming Lei wrote:

> Complete() will be run with interrupt enabled, so change to
> spin_lock_irqsave().
> 
> Cc: Jiri Kosina <jkosina@suse.cz>
> Cc: linux-input@vger.kernel.org
> Signed-off-by: Ming Lei <ming.lei@canonical.com>

Acked-by: Jiri Kosina <jkosina@suse.cz>

> ---
>  drivers/hid/usbhid/hid-core.c |    5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/hid/usbhid/hid-core.c b/drivers/hid/usbhid/hid-core.c
> index bd38cdf..2445fd6 100644
> --- a/drivers/hid/usbhid/hid-core.c
> +++ b/drivers/hid/usbhid/hid-core.c
> @@ -489,8 +489,9 @@ static void hid_ctrl(struct urb *urb)
>  	struct hid_device *hid = urb->context;
>  	struct usbhid_device *usbhid = hid->driver_data;
>  	int unplug = 0, status = urb->status;
> +	unsigned long flags;
>  
> -	spin_lock(&usbhid->lock);
> +	spin_lock_irqsave(&usbhid->lock, flags);
>  
>  	switch (status) {
>  	case 0:			/* success */
> @@ -525,7 +526,7 @@ static void hid_ctrl(struct urb *urb)
>  	}
>  
>  	clear_bit(HID_CTRL_RUNNING, &usbhid->iofl);
> -	spin_unlock(&usbhid->lock);
> +	spin_unlock_irqrestore(&usbhid->lock, flags);
>  	usb_autopm_put_interface_async(usbhid->intf);
>  	wake_up(&usbhid->wait);
>  }
> 

-- 
Jiri Kosina
SUSE Labs


^ permalink raw reply	[flat|nested] 39+ messages in thread

end of thread, other threads:[~2013-08-26 11:44 UTC | newest]

Thread overview: 39+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-08-17 16:24 [PATCH v1 00/49] USB: prepare for enabling irq in complete() Ming Lei
2013-08-17 16:24 ` [PATCH v1 23/49] hid: usbhid: " Ming Lei
2013-08-22 12:19   ` Ming Lei
2013-08-26 11:44   ` Jiri Kosina
2013-08-17 16:24 ` [PATCH v1 26/49] input: cm109: " Ming Lei
2013-08-18  3:37   ` Dmitry Torokhov
2013-08-18 14:10     ` Ming Lei
2013-08-18 18:05       ` Greg Kroah-Hartman
2013-08-17 16:24 ` [PATCH v1 27/49] ISDN: hfcsusb: " Ming Lei
2013-08-17 16:24 ` [PATCH v1 28/49] USBNET: cdc-phonet: " Ming Lei
2013-08-17 16:24 ` [PATCH v1 32/49] wireless: ath9k: " Ming Lei
2013-08-17 16:24   ` Ming Lei
2013-08-17 16:24 ` [PATCH v1 33/49] wireless: zd1211rw: " Ming Lei
2013-08-17 16:24 ` [PATCH v1 34/49] wireless: ath: carl9170: " Ming Lei
2013-08-17 16:25 ` [PATCH v1 35/49] wireless: libertas: " Ming Lei
2013-08-17 16:25   ` Ming Lei
2013-08-17 16:25 ` [PATCH v1 36/49] wireless: libertas_tf: " Ming Lei
2013-08-17 16:25 ` [PATCH v1 37/49] media: usb: cx231xx: " Ming Lei
2013-08-22 11:33   ` Hans Verkuil
2013-08-17 16:25 ` [PATCH v1 38/49] media: usb: em28xx: " Ming Lei
2013-08-22 12:24   ` Hans Verkuil
2013-08-17 16:25 ` [PATCH v1 39/49] media: usb: sn9x102: " Ming Lei
2013-08-22 12:24   ` Hans Verkuil
2013-08-17 16:25 ` [PATCH v1 40/49] media: usb: tlg2300: " Ming Lei
2013-08-22 12:24   ` Hans Verkuil
2013-08-17 16:25 ` [PATCH v1 41/49] media: usb: tm6000: " Ming Lei
2013-08-22 12:24   ` Hans Verkuil
2013-08-17 16:25 ` [PATCH v1 42/49] media: dvb-core: " Ming Lei
2013-08-22 12:32   ` Hans Verkuil
2013-08-17 16:25 ` [PATCH v1 43/49] media: usb: em28xx: " Ming Lei
2013-08-22 12:24   ` Hans Verkuil
     [not found] ` <1376756714-25479-1-git-send-email-ming.lei-Z7WLFzj8eWMS+FvcfC7Uqw@public.gmane.org>
2013-08-17 16:24   ` [PATCH v1 29/49] USBNET: hso: " Ming Lei
2013-08-17 16:24   ` [PATCH v1 30/49] USBNET: kaweth: " Ming Lei
2013-08-17 16:24   ` [PATCH v1 31/49] USBNET: rtl8150: " Ming Lei
2013-08-17 16:25   ` [PATCH v1 44/49] sound: usb: midi: " Ming Lei
     [not found]     ` <1376756714-25479-45-git-send-email-ming.lei-Z7WLFzj8eWMS+FvcfC7Uqw@public.gmane.org>
2013-08-19 13:47       ` Takashi Iwai
2013-08-17 16:25   ` [PATCH v1 45/49] sound: usb: caiaq: " Ming Lei
     [not found]     ` <1376756714-25479-46-git-send-email-ming.lei-Z7WLFzj8eWMS+FvcfC7Uqw@public.gmane.org>
2013-08-19 13:48       ` Takashi Iwai
     [not found] ` <1376756714-25479-25-git-send-email-ming.lei@canonical.com>
2013-08-22 12:23   ` [PATCH v1 24/49] BT: btusb: " Ming Lei

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.