Linux wireless drivers development
 help / color / mirror / Atom feed
* [PATCH 46/50] Sound: usb: ua101: spin_lock in complete() cleanup
From: Ming Lei @ 2013-07-11  9:06 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,
	Ming Lei, Clemens Ladisch, Jaroslav Kysela, Takashi Iwai
In-Reply-To: <1373533573-12272-1-git-send-email-ming.lei@canonical.com>

Complete() will be run with interrupt enabled, so disable local
interrupt before holding a global lock which is held without irqsave.

Cc: Clemens Ladisch <clemens@ladisch.de>
Cc: Jaroslav Kysela <perex@perex.cz>
Cc: Takashi Iwai <tiwai@suse.de>
Cc: alsa-devel@alsa-project.org
Signed-off-by: Ming Lei <ming.lei@canonical.com>
---
 sound/usb/misc/ua101.c |   14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/sound/usb/misc/ua101.c b/sound/usb/misc/ua101.c
index 8b5d2c5..52a60c6 100644
--- a/sound/usb/misc/ua101.c
+++ b/sound/usb/misc/ua101.c
@@ -613,14 +613,24 @@ static int start_usb_playback(struct ua101 *ua)
 
 static void abort_alsa_capture(struct ua101 *ua)
 {
-	if (test_bit(ALSA_CAPTURE_RUNNING, &ua->states))
+	if (test_bit(ALSA_CAPTURE_RUNNING, &ua->states)) {
+		unsigned long flags;
+
+		local_irq_save(flags);
 		snd_pcm_stop(ua->capture.substream, SNDRV_PCM_STATE_XRUN);
+		local_irq_restore(flags);
+	}
 }
 
 static void abort_alsa_playback(struct ua101 *ua)
 {
-	if (test_bit(ALSA_PLAYBACK_RUNNING, &ua->states))
+	if (test_bit(ALSA_PLAYBACK_RUNNING, &ua->states)) {
+		unsigned long flags;
+
+		local_irq_save(flags);
 		snd_pcm_stop(ua->playback.substream, SNDRV_PCM_STATE_XRUN);
+		local_irq_restore(flags);
+	}
 }
 
 static int set_stream_hw(struct ua101 *ua, struct snd_pcm_substream *substream,
-- 
1.7.9.5


^ permalink raw reply related

* [PATCH 47/50] staging: btmtk_usb: spin_lock in complete() cleanup
From: Ming Lei @ 2013-07-11  9:06 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,
	Ming Lei, devel
In-Reply-To: <1373533573-12272-1-git-send-email-ming.lei@canonical.com>

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

Cc: devel@driverdev.osuosl.org
Signed-off-by: Ming Lei <ming.lei@canonical.com>
---
 drivers/staging/btmtk_usb/btmtk_usb.c |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/btmtk_usb/btmtk_usb.c b/drivers/staging/btmtk_usb/btmtk_usb.c
index 0e783e8..ea10d4f 100644
--- a/drivers/staging/btmtk_usb/btmtk_usb.c
+++ b/drivers/staging/btmtk_usb/btmtk_usb.c
@@ -1218,6 +1218,7 @@ static void btmtk_usb_tx_complete(struct urb *urb)
 	struct sk_buff *skb = urb->context;
 	struct hci_dev *hdev = (struct hci_dev *)skb->dev;
 	struct btmtk_usb_data *data = hci_get_drvdata(hdev);
+	unsigned long flags;
 
 	BT_DBG("%s: %s urb %p status %d count %d\n", __func__, hdev->name,
 					urb, urb->status, urb->actual_length);
@@ -1231,9 +1232,9 @@ static void btmtk_usb_tx_complete(struct urb *urb)
 		hdev->stat.err_tx++;
 
 done:
-	spin_lock(&data->txlock);
+	spin_lock_irqsave(&data->txlock, flags);
 	data->tx_in_flight--;
-	spin_unlock(&data->txlock);
+	spin_unlock_irqrestore(&data->txlock, flags);
 
 	kfree(urb->setup_packet);
 
-- 
1.7.9.5


^ permalink raw reply related

* [PATCH 48/50] staging: bcm: spin_lock in complete() cleanup
From: Ming Lei @ 2013-07-11  9:06 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,
	Ming Lei, devel
In-Reply-To: <1373533573-12272-1-git-send-email-ming.lei@canonical.com>

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

Cc: devel@driverdev.osuosl.org
Signed-off-by: Ming Lei <ming.lei@canonical.com>
---
 drivers/staging/bcm/InterfaceRx.c |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/bcm/InterfaceRx.c b/drivers/staging/bcm/InterfaceRx.c
index 26f5bc7..00af901 100644
--- a/drivers/staging/bcm/InterfaceRx.c
+++ b/drivers/staging/bcm/InterfaceRx.c
@@ -47,6 +47,7 @@ static void read_bulk_callback(struct urb *urb)
 	struct bcm_interface_adapter *psIntfAdapter = pRcb->psIntfAdapter;
 	struct bcm_mini_adapter *Adapter = psIntfAdapter->psAdapter;
 	struct bcm_leader *pLeader = urb->transfer_buffer;
+	unsigned long flags;
 
 	if (unlikely(netif_msg_rx_status(Adapter)))
 		pr_info(PFX "%s: rx urb status %d length %d\n",
@@ -129,9 +130,9 @@ static void read_bulk_callback(struct urb *urb)
 			(sizeof(struct bcm_leader)), pLeader->PLength);
 		skb->len = pLeader->PLength + sizeof(USHORT);
 
-		spin_lock(&Adapter->control_queue_lock);
+		spin_lock_irqsave(&Adapter->control_queue_lock, flags);
 		ENQUEUEPACKET(Adapter->RxControlHead,Adapter->RxControlTail,skb);
-		spin_unlock(&Adapter->control_queue_lock);
+		spin_unlock_irqretore(&Adapter->control_queue_lock, flags);
 
 		atomic_inc(&Adapter->cntrlpktCnt);
 		wake_up(&Adapter->process_rx_cntrlpkt);
-- 
1.7.9.5


^ permalink raw reply related

* [PATCH 49/50] staging: ced1401: spin_lock in complete() cleanup
From: Ming Lei @ 2013-07-11  9:06 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,
	Ming Lei, devel
In-Reply-To: <1373533573-12272-1-git-send-email-ming.lei@canonical.com>

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

Cc: devel@driverdev.osuosl.org
Signed-off-by: Ming Lei <ming.lei@canonical.com>
---
 drivers/staging/ced1401/usb1401.c |   35 +++++++++++++++++++----------------
 1 file changed, 19 insertions(+), 16 deletions(-)

diff --git a/drivers/staging/ced1401/usb1401.c b/drivers/staging/ced1401/usb1401.c
index 97c55f9..70d2f43 100644
--- a/drivers/staging/ced1401/usb1401.c
+++ b/drivers/staging/ced1401/usb1401.c
@@ -265,6 +265,7 @@ static void ced_writechar_callback(struct urb *pUrb)
 {
 	DEVICE_EXTENSION *pdx = pUrb->context;
 	int nGot = pUrb->actual_length;	/*  what we transferred */
+	unsigned long flags;
 
 	if (pUrb->status) {	/*  sync/async unlink faults aren't errors */
 		if (!
@@ -275,24 +276,24 @@ static void ced_writechar_callback(struct urb *pUrb)
 				__func__, pUrb->status);
 		}
 
-		spin_lock(&pdx->err_lock);
+		spin_lock_irqsave(&pdx->err_lock, flags);
 		pdx->errors = pUrb->status;
-		spin_unlock(&pdx->err_lock);
+		spin_unlock_irqrestore(&pdx->err_lock, flags);
 		nGot = 0;	/*   and tidy up again if so */
 
-		spin_lock(&pdx->charOutLock);	/*  already at irq level */
+		spin_lock_irqsave(&pdx->charOutLock, flags);	/*  already at irq level */
 		pdx->dwOutBuffGet = 0;	/*  Reset the output buffer */
 		pdx->dwOutBuffPut = 0;
 		pdx->dwNumOutput = 0;	/*  Clear the char count */
 		pdx->bPipeError[0] = 1;	/*  Flag an error for later */
 		pdx->bSendCharsPending = false;	/*  Allow other threads again */
-		spin_unlock(&pdx->charOutLock);	/*  already at irq level */
+		spin_unlock_irqrestore(&pdx->charOutLock, flags);	/*  already at irq level */
 		dev_dbg(&pdx->interface->dev,
 			"%s - char out done, 0 chars sent", __func__);
 	} else {
 		dev_dbg(&pdx->interface->dev,
 			"%s - char out done, %d chars sent", __func__, nGot);
-		spin_lock(&pdx->charOutLock);	/*  already at irq level */
+		spin_lock_irqsave(&pdx->charOutLock, flags);	/*  already at irq level */
 		pdx->dwNumOutput -= nGot;	/*  Now adjust the char send buffer */
 		pdx->dwOutBuffGet += nGot;	/*  to match what we did */
 		if (pdx->dwOutBuffGet >= OUTBUF_SZ)	/*  Can't do this any earlier as data could be overwritten */
@@ -305,7 +306,7 @@ static void ced_writechar_callback(struct urb *pUrb)
 			unsigned int dwCount = pdx->dwNumOutput;	/*  maximum to send */
 			if ((pdx->dwOutBuffGet + dwCount) > OUTBUF_SZ)	/*  does it cross buffer end? */
 				dwCount = OUTBUF_SZ - pdx->dwOutBuffGet;
-			spin_unlock(&pdx->charOutLock);	/*  we are done with stuff that changes */
+			spin_unlock_irqrestore(&pdx->charOutLock, flags);	/*  we are done with stuff that changes */
 			memcpy(pdx->pCoherCharOut, pDat, dwCount);	/*  copy output data to the buffer */
 			usb_fill_bulk_urb(pdx->pUrbCharOut, pdx->udev,
 					  usb_sndbulkpipe(pdx->udev,
@@ -318,7 +319,7 @@ static void ced_writechar_callback(struct urb *pUrb)
 			iReturn = usb_submit_urb(pdx->pUrbCharOut, GFP_ATOMIC);
 			dev_dbg(&pdx->interface->dev, "%s n=%d>%s<", __func__,
 				dwCount, pDat);
-			spin_lock(&pdx->charOutLock);	/*  grab lock for errors */
+			spin_lock_irqsave(&pdx->charOutLock, flags);	/*  grab lock for errors */
 			if (iReturn) {
 				pdx->bPipeError[nPipe] = 1;	/*  Flag an error to be handled later */
 				pdx->bSendCharsPending = false;	/*  Allow other threads again */
@@ -329,7 +330,7 @@ static void ced_writechar_callback(struct urb *pUrb)
 			}
 		} else
 			pdx->bSendCharsPending = false;	/*  Allow other threads again */
-		spin_unlock(&pdx->charOutLock);	/*  already at irq level */
+		spin_unlock_irqrestore(&pdx->charOutLock, flags);	/*  already at irq level */
 	}
 }
 
@@ -505,8 +506,9 @@ static void staged_callback(struct urb *pUrb)
 	unsigned int nGot = pUrb->actual_length;	/*  what we transferred */
 	bool bCancel = false;
 	bool bRestartCharInput;	/*  used at the end */
+	unsigned long flags;
 
-	spin_lock(&pdx->stagedLock);	/*  stop ReadWriteMem() action while this routine is running */
+	spin_lock_irqsave(&pdx->stagedLock, flags);	/*  stop ReadWriteMem() action while this routine is running */
 	pdx->bStagedUrbPending = false;	/*  clear the flag for staged IRP pending */
 
 	if (pUrb->status) {	/*  sync/async unlink faults aren't errors */
@@ -679,7 +681,7 @@ static void staged_callback(struct urb *pUrb)
 	bRestartCharInput = !bCancel && (pdx->dwDMAFlag == MODE_CHAR)
 	    && !pdx->bXFerWaiting;
 
-	spin_unlock(&pdx->stagedLock);	/*  Finally release the lock again */
+	spin_unlock_irqrestore(&pdx->stagedLock, flags);	/*  Finally release the lock again */
 
 	/*  This is not correct as dwDMAFlag is protected by the staged lock, but it is treated */
 	/*  in Allowi as if it were protected by the char lock. In any case, most systems will */
@@ -1093,6 +1095,7 @@ static void ced_readchar_callback(struct urb *pUrb)
 {
 	DEVICE_EXTENSION *pdx = pUrb->context;
 	int nGot = pUrb->actual_length;	/*  what we transferred */
+	unsigned long flags;
 
 	if (pUrb->status) {	/*  Do we have a problem to handle? */
 		int nPipe = pdx->nPipes == 4 ? 1 : 0;	/*  The pipe number to use for error */
@@ -1108,19 +1111,19 @@ static void ced_readchar_callback(struct urb *pUrb)
 				"%s - 0 chars pUrb->status=%d (shutdown?)",
 				__func__, pUrb->status);
 
-		spin_lock(&pdx->err_lock);
+		spin_lock_irqsave(&pdx->err_lock, flags);
 		pdx->errors = pUrb->status;
-		spin_unlock(&pdx->err_lock);
+		spin_unlock_irqrestore(&pdx->err_lock, flags);
 		nGot = 0;	/*   and tidy up again if so */
 
-		spin_lock(&pdx->charInLock);	/*  already at irq level */
+		spin_lock_irqsave(&pdx->charInLock, flags);	/*  already at irq level */
 		pdx->bPipeError[nPipe] = 1;	/*  Flag an error for later */
 	} else {
 		if ((nGot > 1) && ((pdx->pCoherCharIn[0] & 0x7f) == 0x1b)) {	/*  Esc sequence? */
 			Handle1401Esc(pdx, &pdx->pCoherCharIn[1], nGot - 1);	/*  handle it */
-			spin_lock(&pdx->charInLock);	/*  already at irq level */
+			spin_lock_irqsave(&pdx->charInLock, flags);	/*  already at irq level */
 		} else {
-			spin_lock(&pdx->charInLock);	/*  already at irq level */
+			spin_lock_irqsave(&pdx->charInLock, flags);	/*  already at irq level */
 			if (nGot > 0) {
 				unsigned int i;
 				if (nGot < INBUF_SZ) {
@@ -1147,7 +1150,7 @@ static void ced_readchar_callback(struct urb *pUrb)
 	}
 
 	pdx->bReadCharsPending = false;	/*  No longer have a pending read */
-	spin_unlock(&pdx->charInLock);	/*  already at irq level */
+	spin_unlock_irqrestore(&pdx->charInLock, flags);	/*  already at irq level */
 
 	Allowi(pdx);	/*  see if we can do the next one */
 }
-- 
1.7.9.5


^ permalink raw reply related

* [PATCH 50/50] staging: vt6656: spin_lock in complete() cleanup
From: Ming Lei @ 2013-07-11  9:06 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,
	Ming Lei, devel
In-Reply-To: <1373533573-12272-1-git-send-email-ming.lei@canonical.com>

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

Cc: devel@driverdev.osuosl.org
Signed-off-by: Ming Lei <ming.lei@canonical.com>
---
 drivers/staging/vt6656/usbpipe.c |    9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/vt6656/usbpipe.c b/drivers/staging/vt6656/usbpipe.c
index 098be60..0282f2e 100644
--- a/drivers/staging/vt6656/usbpipe.c
+++ b/drivers/staging/vt6656/usbpipe.c
@@ -485,6 +485,7 @@ static void s_nsBulkInUsbIoCompleteRead(struct urb *urb)
 	int bIndicateReceive = false;
 	int bReAllocSkb = false;
 	int status;
+	unsigned long flags;
 
     DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"---->s_nsBulkInUsbIoCompleteRead\n");
     status = urb->status;
@@ -515,18 +516,18 @@ static void s_nsBulkInUsbIoCompleteRead(struct urb *urb)
     STAvUpdateUSBCounter(&pDevice->scStatistic.USB_BulkInStat, status);
 
     if (bIndicateReceive) {
-        spin_lock(&pDevice->lock);
+        spin_lock_irqsave(&pDevice->lock, flags);
         if (RXbBulkInProcessData(pDevice, pRCB, bytesRead) == true)
             bReAllocSkb = true;
-        spin_unlock(&pDevice->lock);
+        spin_unlock_irqrestore(&pDevice->lock, flags);
     }
     pRCB->Ref--;
     if (pRCB->Ref == 0)
     {
         DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"RxvFreeNormal %d \n",pDevice->NumRecvFreeList);
-        spin_lock(&pDevice->lock);
+        spin_lock_irqsave(&pDevice->lock, flags);
         RXvFreeRCB(pRCB, bReAllocSkb);
-        spin_unlock(&pDevice->lock);
+        spin_unlock_irqrestore(&pDevice->lock, flags);
     }
 
     return;
-- 
1.7.9.5


^ permalink raw reply related

* [PATCH] nl80211: fix the setting of RSSI threshold value for mesh
From: Chun-Yeow Yeoh @ 2013-07-11  9:23 UTC (permalink / raw)
  To: linux-wireless; +Cc: johannes, linville, devel, distro11s, Chun-Yeow Yeoh

RSSI threshold value used for mesh peering should be in
negative value. After range checks to mesh parameters is
introduced, this is not allowed. Fix this.

Signed-off-by: Chun-Yeow Yeoh <yeohchunyeow@gmail.com>
---
 net/wireless/nl80211.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index a9444cd..e6164ab 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -4803,9 +4803,9 @@ do {									    \
 	FILL_IN_MESH_PARAM_IF_SET(tb, cfg, dot11MeshForwarding, 0, 1,
 				  mask, NL80211_MESHCONF_FORWARDING,
 				  nla_get_u8);
-	FILL_IN_MESH_PARAM_IF_SET(tb, cfg, rssi_threshold, 1, 255,
-				  mask, NL80211_MESHCONF_RSSI_THRESHOLD,
-				  nla_get_u32);
+	FILL_IN_MESH_PARAM_IF_SET(tb, cfg, rssi_threshold,
+				  0x80000000, 0xFFFFFFFF, mask,
+				  NL80211_MESHCONF_RSSI_THRESHOLD, nla_get_u32);
 	FILL_IN_MESH_PARAM_IF_SET(tb, cfg, ht_opmode, 0, 16,
 				  mask, NL80211_MESHCONF_HT_OPMODE,
 				  nla_get_u16);
-- 
1.7.0.4


^ permalink raw reply related

* Re: [ath9k-devel] [PATCH] ath10k:  Fix crash when using v1 hardware.
From: Kalle Valo @ 2013-07-11  9:36 UTC (permalink / raw)
  To: greearb; +Cc: ath10k, linux-wireless
In-Reply-To: <1372804925-1701-1-git-send-email-greearb@candelatech.com>

greearb@candelatech.com writes:

> From: Ben Greear <greearb@candelatech.com>
>
> I put a v1 NIC from an TP-LINK AC 1750 AP in
> a 64-bit PC, and the OS crashes on bootup.  I'm not
> sure how broken my hardware is (possibly completely non
> functional), but at least with this patch it will no longer
> crash the OS.  Not sure it ever got far enough to try,
> but I also do not have firmware for the NIC.
>
> With this patch I get this info on module load:
>
> ath10k_pci 0000:05:00.0: BAR 0: assigned [mem 0xf4400000-0xf45fffff 64bit]
> ath10k_pci 0000:05:00.0: BAR 0: error updating (0xf4400004 != 0xffffffff)
> ath10k_pci 0000:05:00.0: BAR 0: error updating (high 0x000000 != 0xffffffff)
> ath10k_pci 0000:05:00.0: Refused to change power state, currently in D3
> ath10k: MSI-X interrupt handling (8 intrs)
> ath10k: Unable to wakeup target
> ath10k: target takes too long to wake up (awake count 1)
> ath10k: src_ring ffff88020c0d0a00:  write_index is out of bounds: 4294967295  nentries_mask: 15.
> ath10k: dest_ring ffff88020db2c000:  write_index is out of bounds: 4294967295  nentries_mask: 511.
> ath10k: dest_ring ffff880210d56400:  write_index is out of bounds: 4294967295  nentries_mask: 31.
> ath10k: src_ring ffff880210d57600:  write_index is out of bounds: 4294967295  nentries_mask: 31.
> ath10k: src_ring ffff88020fe70000:  write_index is out of bounds: 4294967295  nentries_mask: 2047.
> ath10k: src_ring ffff880212989b40:  write_index is out of bounds: 4294967295  nentries_mask: 1.
> ath10k: dest_ring ffff880212989960:  write_index is out of bounds: 4294967295  nentries_mask: 1.
> ath10k: Failed to get pcie state addr: -5
> ath10k: early firmware event indicated
> ------------[ cut here ]------------
> WARNING: at /home/greearb/git/linux.wireless-testing/drivers/net/wireless/ath/ath10k/ce.c:771 ath10k_ce_per_engine_service+0x53/0x1b4 [ath10k_pci]()
> ....
> (it hits the warning case about 5-6 times and then seems to quiesce OK).

I haven't seen this myself so it might be a hw problem, but difficult to
say.

> +	/* On v1 hardware at least, setup can fail, causing ce_id_state to
> +	 * be cleaned up, but this method is still called a few times.  Check
> +	 * for NULL here so we don't crash.  Probably a better fix is to stop
> +	 * the ath10k_pci_ce_tasklet sooner.
> +	 */
> +	if (WARN_ONCE(!ce_state, "ce_id_to_state[%i] is NULL\n", ce_id))
> +		return;
> +
> +	ctrl_addr = ce_state->ctrl_addr;
> +

The tests you add look like workarounds. I would prefer to try fix these
by going to the source of the problem. Maybe we should add
ath10k_pci_wake() and ath10k_do_pci_wake()?

Can you enable few debug logs, like ATH10K_DBG_PCI, and post them? That
would give more hint there things are going wrong.

-- 
Kalle Valo

^ permalink raw reply

* Re: [ath9k-devel] [PATCH] ath10k: Fix crash when using v1 hardware.
From: Kalle Valo @ 2013-07-11  9:37 UTC (permalink / raw)
  To: Ben Greear; +Cc: ath10k, linux-wireless
In-Reply-To: <51D35D58.5090507@candelatech.com>

Ben Greear <greearb@candelatech.com> writes:

> Actually, I have no idea what type of hardware this is.  It was
> suggested earlier to me that this AP had a v1 hardware in it, but
> lspci shows this fairly unpromising thing, and the ath10k driver
> appears to call 003c the V2 hardware....
>
> 05:00.0 Network controller: Atheros Communications Inc. Device 003c (rev ff) (prog-if ff)
> 	!!! Unknown header type 7f
> 	Kernel modules: ath10k_pci

That unknown header type looks scary. I'm starting to suspect even more
that you have a hw problem of some sort.

-- 
Kalle Valo

^ permalink raw reply

* Re: [PATCH] nl80211: fix the setting of RSSI threshold value for mesh
From: Johannes Berg @ 2013-07-11  9:56 UTC (permalink / raw)
  To: Chun-Yeow Yeoh; +Cc: linux-wireless, linville, devel, distro11s
In-Reply-To: <1373534615-17270-1-git-send-email-yeohchunyeow@gmail.com>

On Thu, 2013-07-11 at 17:23 +0800, Chun-Yeow Yeoh wrote:
> RSSI threshold value used for mesh peering should be in
> negative value. After range checks to mesh parameters is
> introduced, this is not allowed. Fix this.
> 
> Signed-off-by: Chun-Yeow Yeoh <yeohchunyeow@gmail.com>
> ---
>  net/wireless/nl80211.c |    6 +++---
>  1 files changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
> index a9444cd..e6164ab 100644
> --- a/net/wireless/nl80211.c
> +++ b/net/wireless/nl80211.c
> @@ -4803,9 +4803,9 @@ do {									    \
>  	FILL_IN_MESH_PARAM_IF_SET(tb, cfg, dot11MeshForwarding, 0, 1,
>  				  mask, NL80211_MESHCONF_FORWARDING,
>  				  nla_get_u8);
> -	FILL_IN_MESH_PARAM_IF_SET(tb, cfg, rssi_threshold, 1, 255,
> -				  mask, NL80211_MESHCONF_RSSI_THRESHOLD,
> -				  nla_get_u32);
> +	FILL_IN_MESH_PARAM_IF_SET(tb, cfg, rssi_threshold,
> +				  0x80000000, 0xFFFFFFFF, mask,
> +				  NL80211_MESHCONF_RSSI_THRESHOLD, nla_get_u32);

Maybe use nla_get_s32() instead?

johannes


^ permalink raw reply

* [PATCH v2] nl80211: fix the setting of RSSI threshold value for mesh
From: Chun-Yeow Yeoh @ 2013-07-11 10:24 UTC (permalink / raw)
  To: linux-wireless; +Cc: johannes, linville, devel, distro11s, Chun-Yeow Yeoh

RSSI threshold value used for mesh peering should be in
negative value. After range checks to mesh parameters is
introduced, this is not allowed. Fix this.

Signed-off-by: Chun-Yeow Yeoh <yeohchunyeow@gmail.com>
---
v2:
	use nla_get_s32 instead (Johannes)

 net/wireless/nl80211.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index a9444cd..0fc6e3a 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -4803,9 +4803,9 @@ do {									    \
 	FILL_IN_MESH_PARAM_IF_SET(tb, cfg, dot11MeshForwarding, 0, 1,
 				  mask, NL80211_MESHCONF_FORWARDING,
 				  nla_get_u8);
-	FILL_IN_MESH_PARAM_IF_SET(tb, cfg, rssi_threshold, 1, 255,
+	FILL_IN_MESH_PARAM_IF_SET(tb, cfg, rssi_threshold, -255, 0,
 				  mask, NL80211_MESHCONF_RSSI_THRESHOLD,
-				  nla_get_u32);
+				  nla_get_s32);
 	FILL_IN_MESH_PARAM_IF_SET(tb, cfg, ht_opmode, 0, 16,
 				  mask, NL80211_MESHCONF_HT_OPMODE,
 				  nla_get_u16);
-- 
1.7.0.4


^ permalink raw reply related

* Re: [PATCH v2] nl80211: fix the setting of RSSI threshold value for mesh
From: Johannes Berg @ 2013-07-11 10:59 UTC (permalink / raw)
  To: Chun-Yeow Yeoh; +Cc: linux-wireless, linville, devel, distro11s
In-Reply-To: <1373538243-17628-1-git-send-email-yeohchunyeow@gmail.com>

On Thu, 2013-07-11 at 18:24 +0800, Chun-Yeow Yeoh wrote:
> RSSI threshold value used for mesh peering should be in
> negative value. After range checks to mesh parameters is
> introduced, this is not allowed. Fix this.

Applied.

johannes


^ permalink raw reply

* Re: wl127x: Unable to associate with a WPA2-PSK AP
From: José Miguel Gonçalves @ 2013-07-11 12:08 UTC (permalink / raw)
  To: Luciano Coelho; +Cc: Arik Nemtsov, linux-wireless
In-Reply-To: <1373488063.8385.31.camel@cumari.coelho.fi>

Hi Luca,

On 10-07-2013 21:27, Luciano Coelho wrote:
> I have a text console only system. I could put tcpdump on my system, but I think I
> can not monitor wireless traffic with it, or can I?
> tcpdump will probably not be enough.  But since this stuff is *wireless*
> you can sniff from a different PC.  If you have Linux PC, just plug in
> your TP-Link dongle in it, launch wireshark and you should be able to
> sniff (unencrypted) connections between other devices easily.
>

I've setup my Linuc PC as a sniffer and yes I see a lot of of authentication 
frames on the air when I try to associate with my open AP (Android phone).

I've repeated the process with a TP-Link dongle and I see a clean 802.11 
association sequence.

What I found strange is that I don't see "probe request" frames on the wl12xx 
captured frames, it starts directly with an "authentication" frame, when with the 
TP-Link dongle (ath9k_htc driver) the first frame sent by is a "probe request"!

I can provide the Wirehsark capture files. What is the best way to send them 
through the mailing list?

Best regards,
José Gonçalves

^ permalink raw reply

* Re: [PATCH 05/50] USB: misc: uss720: spin_lock in complete() cleanup
From: Sergei Shtylyov @ 2013-07-11 12:15 UTC (permalink / raw)
  To: Ming Lei
  Cc: Greg Kroah-Hartman, linux-usb, Oliver Neukum, Alan Stern,
	linux-input, linux-bluetooth, netdev, linux-wireless, linux-media,
	alsa-devel
In-Reply-To: <1373533573-12272-6-git-send-email-ming.lei@canonical.com>

Hello.

On 11-07-2013 13:05, Ming Lei wrote:

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

> Signed-off-by: Ming Lei <ming.lei@canonical.com>
> ---
>   drivers/usb/misc/uss720.c |    6 +++++-
>   1 file changed, 5 insertions(+), 1 deletion(-)

> diff --git a/drivers/usb/misc/uss720.c b/drivers/usb/misc/uss720.c
> index e129cf6..f7d15e8 100644
> --- a/drivers/usb/misc/uss720.c
> +++ b/drivers/usb/misc/uss720.c
> @@ -121,6 +121,7 @@ static void async_complete(struct urb *urb)
>   		dev_err(&urb->dev->dev, "async_complete: urb error %d\n",
>   			status);
>   	} else if (rq->dr.bRequest == 3) {
> +		unsigned long flags;

    Empty line wouldn't hurt here, after declaration.

>   		memcpy(priv->reg, rq->reg, sizeof(priv->reg));

WBR, Sergei



^ permalink raw reply

* Re: [PATCH 08/50] USB: legousbtower: spin_lock in complete() cleanup
From: Sergei Shtylyov @ 2013-07-11 12:18 UTC (permalink / raw)
  To: Ming Lei
  Cc: Greg Kroah-Hartman, linux-usb, Oliver Neukum, Alan Stern,
	linux-input, linux-bluetooth, netdev, linux-wireless, linux-media,
	alsa-devel, Juergen Stuber
In-Reply-To: <1373533573-12272-9-git-send-email-ming.lei@canonical.com>

Hello.

On 11-07-2013 13:05, Ming Lei wrote:

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

> Cc: Juergen Stuber <starblue@users.sourceforge.net>
> Signed-off-by: Ming Lei <ming.lei@canonical.com>
> ---
>   drivers/usb/misc/legousbtower.c |    5 +++--
>   1 file changed, 3 insertions(+), 2 deletions(-)

> diff --git a/drivers/usb/misc/legousbtower.c b/drivers/usb/misc/legousbtower.c
> index 8089479..4044989 100644
> --- a/drivers/usb/misc/legousbtower.c
> +++ b/drivers/usb/misc/legousbtower.c
> @@ -771,6 +771,7 @@ static void tower_interrupt_in_callback (struct urb *urb)
>   	struct lego_usb_tower *dev = urb->context;
>   	int status = urb->status;
>   	int retval;
> +	unsigned long flags;
>
>   	dbg(4, "%s: enter, status %d", __func__, status);
>
> @@ -788,7 +789,7 @@ static void tower_interrupt_in_callback (struct urb *urb)
>   	}
>
>   	if (urb->actual_length > 0) {
> -		spin_lock (&dev->read_buffer_lock);
> +		spin_lock_irqsave (&dev->read_buffer_lock, flags);
>   		if (dev->read_buffer_length + urb->actual_length < read_buffer_size) {
>   			memcpy (dev->read_buffer + dev->read_buffer_length,
>   				dev->interrupt_in_buffer,
> @@ -799,7 +800,7 @@ static void tower_interrupt_in_callback (struct urb *urb)
>   		} else {
>   			printk(KERN_WARNING "%s: read_buffer overflow, %d bytes dropped", __func__, urb->actual_length);
>   		}
> -		spin_unlock (&dev->read_buffer_lock);
> +		spin_unlock_irqrestore (&dev->read_buffer_lock, flags);
>   	}

    I don't think this patch passes checkpatch.pl.

WBR, Sergei



^ permalink raw reply

* [PATCH 1/3] iw: dump station rx bit rate information
From: Felix Fietkau @ 2013-07-11 12:20 UTC (permalink / raw)
  To: linux-wireless; +Cc: johannes

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
---
 iw.h      |  2 +-
 link.c    |  2 +-
 station.c | 12 ++++++++++--
 3 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/iw.h b/iw.h
index 8816e88..854d356 100644
--- a/iw.h
+++ b/iw.h
@@ -170,7 +170,7 @@ enum print_ie_type {
 void print_ies(unsigned char *ie, int ielen, bool unknown,
 	       enum print_ie_type ptype);
 
-void parse_tx_bitrate(struct nlattr *bitrate_attr, char *buf, int buflen);
+void parse_bitrate(struct nlattr *bitrate_attr, char *buf, int buflen);
 
 DECLARE_SECTION(set);
 DECLARE_SECTION(get);
diff --git a/link.c b/link.c
index b8acd5c..f7818f5 100644
--- a/link.c
+++ b/link.c
@@ -165,7 +165,7 @@ static int print_link_sta(struct nl_msg *msg, void *arg)
 	if (sinfo[NL80211_STA_INFO_TX_BITRATE]) {
 		char buf[100];
 
-		parse_tx_bitrate(sinfo[NL80211_STA_INFO_TX_BITRATE], buf, sizeof(buf));
+		parse_bitrate(sinfo[NL80211_STA_INFO_TX_BITRATE], buf, sizeof(buf));
 		printf("\ttx bitrate: %s\n", buf);
 	}
 
diff --git a/station.c b/station.c
index dde552f..5a161eb 100644
--- a/station.c
+++ b/station.c
@@ -43,7 +43,7 @@ static void print_power_mode(struct nlattr *a)
 	}
 }
 
-void parse_tx_bitrate(struct nlattr *bitrate_attr, char *buf, int buflen)
+void parse_bitrate(struct nlattr *bitrate_attr, char *buf, int buflen)
 {
 	int rate = 0;
 	char *pos = buf;
@@ -107,6 +107,7 @@ static int print_sta_handler(struct nl_msg *msg, void *arg)
 		[NL80211_STA_INFO_SIGNAL] = { .type = NLA_U8 },
 		[NL80211_STA_INFO_T_OFFSET] = { .type = NLA_U64 },
 		[NL80211_STA_INFO_TX_BITRATE] = { .type = NLA_NESTED },
+		[NL80211_STA_INFO_RX_BITRATE] = { .type = NLA_NESTED },
 		[NL80211_STA_INFO_LLID] = { .type = NLA_U16 },
 		[NL80211_STA_INFO_PLID] = { .type = NLA_U16 },
 		[NL80211_STA_INFO_PLINK_STATE] = { .type = NLA_U8 },
@@ -177,10 +178,17 @@ static int print_sta_handler(struct nl_msg *msg, void *arg)
 	if (sinfo[NL80211_STA_INFO_TX_BITRATE]) {
 		char buf[100];
 
-		parse_tx_bitrate(sinfo[NL80211_STA_INFO_TX_BITRATE], buf, sizeof(buf));
+		parse_bitrate(sinfo[NL80211_STA_INFO_TX_BITRATE], buf, sizeof(buf));
 		printf("\n\ttx bitrate:\t%s", buf);
 	}
 
+	if (sinfo[NL80211_STA_INFO_RX_BITRATE]) {
+		char buf[100];
+
+		parse_bitrate(sinfo[NL80211_STA_INFO_RX_BITRATE], buf, sizeof(buf));
+		printf("\n\trx bitrate:\t%s", buf);
+	}
+
 	if (sinfo[NL80211_STA_INFO_LLID])
 		printf("\n\tmesh llid:\t%d",
 			nla_get_u16(sinfo[NL80211_STA_INFO_LLID]));
-- 
1.8.0.2


^ permalink raw reply related

* [PATCH 3/3] iw: add the active monitor flag
From: Felix Fietkau @ 2013-07-11 12:20 UTC (permalink / raw)
  To: linux-wireless; +Cc: johannes
In-Reply-To: <1373545239-78697-1-git-send-email-nbd@openwrt.org>

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
---
 interface.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/interface.c b/interface.c
index b52c8dd..f769752 100644
--- a/interface.c
+++ b/interface.c
@@ -16,7 +16,8 @@
 			"fcsfail:  show frames with FCS errors\n"\
 			"control:  show control frames\n"\
 			"otherbss: show frames from other BSSes\n"\
-			"cook:     use cooked mode"
+			"cook:     use cooked mode\n"\
+			"active:   use active mode (ACK incoming unicast packets)"
 
 SECTION(interface);
 
@@ -27,6 +28,7 @@ static char *mntr_flags[NL80211_MNTR_FLAG_MAX + 1] = {
 	"control",
 	"otherbss",
 	"cook",
+	"active",
 };
 
 static int parse_mntr_flags(int *_argc, char ***_argv,
-- 
1.8.0.2


^ permalink raw reply related

* [PATCH 2/3] iw: dump station per-chain signal strength information
From: Felix Fietkau @ 2013-07-11 12:20 UTC (permalink / raw)
  To: linux-wireless; +Cc: johannes
In-Reply-To: <1373545239-78697-1-git-send-email-nbd@openwrt.org>

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
---
 station.c | 45 +++++++++++++++++++++++++++++++++++++++++----
 1 file changed, 41 insertions(+), 4 deletions(-)

diff --git a/station.c b/station.c
index 5a161eb..07acdbc 100644
--- a/station.c
+++ b/station.c
@@ -91,6 +91,33 @@ void parse_bitrate(struct nlattr *bitrate_attr, char *buf, int buflen)
 				" VHT-NSS %d", nla_get_u8(rinfo[NL80211_RATE_INFO_VHT_NSS]));
 }
 
+static char *get_chain_signal(struct nlattr *attr_list)
+{
+	struct nlattr *attr;
+	static char buf[64];
+	char *cur = buf;
+	int i = 0, rem;
+	const char *prefix;
+
+	if (!attr_list)
+		return "";
+
+	nla_for_each_nested(attr, attr_list, rem) {
+		if (i++ > 0)
+			prefix = ", ";
+		else
+			prefix = "[";
+
+		cur += snprintf(cur, sizeof(buf) - (cur - buf), "%s%d", prefix,
+				(int8_t) nla_get_u8(attr));
+	}
+
+	if (i)
+		snprintf(cur, sizeof(buf) - (cur - buf), "] ");
+
+	return buf;
+}
+
 static int print_sta_handler(struct nl_msg *msg, void *arg)
 {
 	struct nlattr *tb[NL80211_ATTR_MAX + 1];
@@ -118,7 +145,10 @@ static int print_sta_handler(struct nl_msg *msg, void *arg)
 		[NL80211_STA_INFO_LOCAL_PM] = { .type = NLA_U32},
 		[NL80211_STA_INFO_PEER_PM] = { .type = NLA_U32},
 		[NL80211_STA_INFO_NONPEER_PM] = { .type = NLA_U32},
+		[NL80211_STA_INFO_CHAIN_SIGNAL] = { .type = NLA_NESTED },
+		[NL80211_STA_INFO_CHAIN_SIGNAL_AVG] = { .type = NLA_NESTED },
 	};
+	char *chain;
 
 	nla_parse(tb, NL80211_ATTR_MAX, genlmsg_attrdata(gnlh, 0),
 		  genlmsg_attrlen(gnlh, 0), NULL);
@@ -165,12 +195,19 @@ static int print_sta_handler(struct nl_msg *msg, void *arg)
 	if (sinfo[NL80211_STA_INFO_TX_FAILED])
 		printf("\n\ttx failed:\t%u",
 			nla_get_u32(sinfo[NL80211_STA_INFO_TX_FAILED]));
+
+	chain = get_chain_signal(sinfo[NL80211_STA_INFO_CHAIN_SIGNAL]);
 	if (sinfo[NL80211_STA_INFO_SIGNAL])
-		printf("\n\tsignal:  \t%d dBm",
-			(int8_t)nla_get_u8(sinfo[NL80211_STA_INFO_SIGNAL]));
+		printf("\n\tsignal:  \t%d %sdBm",
+			(int8_t)nla_get_u8(sinfo[NL80211_STA_INFO_SIGNAL]),
+			chain);
+
+	chain = get_chain_signal(sinfo[NL80211_STA_INFO_CHAIN_SIGNAL_AVG]);
 	if (sinfo[NL80211_STA_INFO_SIGNAL_AVG])
-		printf("\n\tsignal avg:\t%d dBm",
-			(int8_t)nla_get_u8(sinfo[NL80211_STA_INFO_SIGNAL_AVG]));
+		printf("\n\tsignal avg:\t%d %sdBm",
+			(int8_t)nla_get_u8(sinfo[NL80211_STA_INFO_SIGNAL_AVG]),
+			chain);
+
 	if (sinfo[NL80211_STA_INFO_T_OFFSET])
 		printf("\n\tToffset:\t%lld us",
 			(unsigned long long)nla_get_u64(sinfo[NL80211_STA_INFO_T_OFFSET]));
-- 
1.8.0.2


^ permalink raw reply related

* Re: [PATCH 1/3] iw: dump station rx bit rate information
From: Johannes Berg @ 2013-07-11 12:27 UTC (permalink / raw)
  To: Felix Fietkau; +Cc: linux-wireless
In-Reply-To: <1373545239-78697-1-git-send-email-nbd@openwrt.org>

Applied all, thanks.

johannes


^ permalink raw reply

* Re: [PATCH 08/50] USB: legousbtower: spin_lock in complete() cleanup
From: Oliver Neukum @ 2013-07-11 12:36 UTC (permalink / raw)
  To: Sergei Shtylyov
  Cc: Ming Lei, Greg Kroah-Hartman, linux-usb, Alan Stern, linux-input,
	linux-bluetooth, netdev, linux-wireless, linux-media, alsa-devel,
	Juergen Stuber
In-Reply-To: <51DEA289.5050509@cogentembedded.com>

On Thursday 11 July 2013 16:18:17 Sergei Shtylyov wrote:

>     I don't think this patch passes checkpatch.pl.

This series is a mechanical replacement in dozens of drivers.
We cannot demand nice formatting. If you want to do something
productive, check the locking in the driver.

	Regards
		Oliver


^ permalink raw reply

* Re: [PATCH 36/50] media: usb: em28xx: spin_lock in complete() cleanup
From: Devin Heitmueller @ 2013-07-11 12:42 UTC (permalink / raw)
  To: Ming Lei
  Cc: Greg Kroah-Hartman, linux-usb, Oliver Neukum, Alan Stern,
	linux-input, linux-bluetooth, netdev, linux-wireless, linux-media,
	alsa-devel, Mauro Carvalho Chehab
In-Reply-To: <1373533573-12272-37-git-send-email-ming.lei@canonical.com>

On Thu, Jul 11, 2013 at 5:05 AM, Ming Lei <ming.lei@canonical.com> 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>
> ---
>  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
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-media" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

I actually stumbled across this a couple of weeks ago, and have had an
identical patch running in a local dev tree.

Reviewed-by: Devin Heitmueller <dheitmueller@kernellabs.com>
Tested-by: Devin Heitmueller <dheitmueller@kernellabs.com>

-- 
Devin J. Heitmueller - Kernel Labs
http://www.kernellabs.com

^ permalink raw reply

* Re: [PATCH 08/50] USB: legousbtower: spin_lock in complete() cleanup
From: Ming Lei @ 2013-07-11 12:42 UTC (permalink / raw)
  To: Sergei Shtylyov
  Cc: Greg Kroah-Hartman, linux-usb, Oliver Neukum, Alan Stern,
	linux-input, linux-bluetooth, netdev, linux-wireless, linux-media,
	alsa-devel, Juergen Stuber
In-Reply-To: <51DEA289.5050509@cogentembedded.com>

On Thu, Jul 11, 2013 at 8:18 PM, Sergei Shtylyov
<sergei.shtylyov@cogentembedded.com> wrote:
> Hello.
>
>
> On 11-07-2013 13:05, Ming Lei wrote:
>
>> Complete() will be run with interrupt enabled, so change to
>> spin_lock_irqsave().
>
>
>> Cc: Juergen Stuber <starblue@users.sourceforge.net>
>> Signed-off-by: Ming Lei <ming.lei@canonical.com>
>> ---
>>   drivers/usb/misc/legousbtower.c |    5 +++--
>>   1 file changed, 3 insertions(+), 2 deletions(-)
>
>
>> diff --git a/drivers/usb/misc/legousbtower.c
>> b/drivers/usb/misc/legousbtower.c
>> index 8089479..4044989 100644
>> --- a/drivers/usb/misc/legousbtower.c
>> +++ b/drivers/usb/misc/legousbtower.c
>> @@ -771,6 +771,7 @@ static void tower_interrupt_in_callback (struct urb
>> *urb)
>>         struct lego_usb_tower *dev = urb->context;
>>         int status = urb->status;
>>         int retval;
>> +       unsigned long flags;
>>
>>         dbg(4, "%s: enter, status %d", __func__, status);
>>
>> @@ -788,7 +789,7 @@ static void tower_interrupt_in_callback (struct urb
>> *urb)
>>         }
>>
>>         if (urb->actual_length > 0) {
>> -               spin_lock (&dev->read_buffer_lock);
>> +               spin_lock_irqsave (&dev->read_buffer_lock, flags);
>>                 if (dev->read_buffer_length + urb->actual_length <
>> read_buffer_size) {
>>                         memcpy (dev->read_buffer +
>> dev->read_buffer_length,
>>                                 dev->interrupt_in_buffer,
>> @@ -799,7 +800,7 @@ static void tower_interrupt_in_callback (struct urb
>> *urb)
>>                 } else {
>>                         printk(KERN_WARNING "%s: read_buffer overflow, %d
>> bytes dropped", __func__, urb->actual_length);
>>                 }
>> -               spin_unlock (&dev->read_buffer_lock);
>> +               spin_unlock_irqrestore (&dev->read_buffer_lock, flags);
>>         }
>
>
>    I don't think this patch passes checkpatch.pl.

No errors reported from checkpatch.pl, only warnings which isn't introduced
by this patch.

Thanks,
--
Ming Lei

^ permalink raw reply

* Re: [PATCH 17/50] USB: serial: sierra: spin_lock in complete() cleanup
From: Sergei Shtylyov @ 2013-07-11 13:02 UTC (permalink / raw)
  To: Ming Lei
  Cc: Greg Kroah-Hartman, linux-usb, Oliver Neukum, Alan Stern,
	linux-input, linux-bluetooth, netdev, linux-wireless, linux-media,
	alsa-devel, Johan Hovold
In-Reply-To: <1373533573-12272-18-git-send-email-ming.lei@canonical.com>

Hello.

On 11-07-2013 13:05, Ming Lei wrote:

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

> Cc: Johan Hovold <jhovold@gmail.com>
> Signed-off-by: Ming Lei <ming.lei@canonical.com>
> ---
>   drivers/usb/serial/sierra.c |    9 +++++----
>   1 file changed, 5 insertions(+), 4 deletions(-)

> diff --git a/drivers/usb/serial/sierra.c b/drivers/usb/serial/sierra.c
> index de958c5..e79b6ad 100644
> --- a/drivers/usb/serial/sierra.c
> +++ b/drivers/usb/serial/sierra.c
> @@ -433,6 +433,7 @@ static void sierra_outdat_callback(struct urb *urb)
>   	struct sierra_port_private *portdata = usb_get_serial_port_data(port);
>   	struct sierra_intf_private *intfdata;
>   	int status = urb->status;
> +	unsigned long flags;
>
>   	intfdata = port->serial->private;
>
> @@ -443,12 +444,12 @@ static void sierra_outdat_callback(struct urb *urb)
>   		dev_dbg(&port->dev, "%s - nonzero write bulk status "
>   		    "received: %d\n", __func__, status);
>
> -	spin_lock(&portdata->lock);
> +	spin_lock_irqsave(&portdata->lock, flags);
>   	--portdata->outstanding_urbs;
> -	spin_unlock(&portdata->lock);
> -	spin_lock(&intfdata->susp_lock);
> +	spin_unlock_irqrestore(&portdata->lock, flags);
> +	spin_lock_irqsave(&intfdata->susp_lock, flags);

     You are allowing an interrupt enabled window where previously it 
wasn't possible. Why notleave these 2 lines as is?

>   	--intfdata->in_flight;
> -	spin_unlock(&intfdata->susp_lock);
> +	spin_unlock_irqrestore(&intfdata->susp_lock, flags);
>
>   	usb_serial_port_softint(port);
>   }

WBR, Sergei


^ permalink raw reply

* Re: [PATCH 45/50] sound: usb: usx2y: spin_lock in complete() cleanup
From: Sergei Shtylyov @ 2013-07-11 13:08 UTC (permalink / raw)
  To: Ming Lei
  Cc: Greg Kroah-Hartman, linux-usb, Oliver Neukum, Alan Stern,
	linux-input, linux-bluetooth, netdev, linux-wireless, linux-media,
	alsa-devel, Jaroslav Kysela, Takashi Iwai
In-Reply-To: <1373533573-12272-46-git-send-email-ming.lei@canonical.com>

On 11-07-2013 13:06, Ming Lei wrote:

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

    Changelog doesn't match the patch.

> Cc: Jaroslav Kysela <perex@perex.cz>
> Cc: Takashi Iwai <tiwai@suse.de>
> Cc: alsa-devel@alsa-project.org
> Signed-off-by: Ming Lei <ming.lei@canonical.com>
> ---
>   sound/usb/usx2y/usbusx2yaudio.c |    4 ++++
>   1 file changed, 4 insertions(+)

> diff --git a/sound/usb/usx2y/usbusx2yaudio.c b/sound/usb/usx2y/usbusx2yaudio.c
> index 4967fe9..e2ee893 100644
> --- a/sound/usb/usx2y/usbusx2yaudio.c
> +++ b/sound/usb/usx2y/usbusx2yaudio.c
> @@ -273,7 +273,11 @@ static void usX2Y_clients_stop(struct usX2Ydev *usX2Y)
>   		struct snd_usX2Y_substream *subs = usX2Y->subs[s];
>   		if (subs) {
>   			if (atomic_read(&subs->state) >= state_PRERUNNING) {
> +				unsigned long flags;
> +
> +				local_irq_save(flags);
>   				snd_pcm_stop(subs->pcm_substream, SNDRV_PCM_STATE_XRUN);
> +				local_irq_restore(flags);
>   			}

WBR, Sergei



^ permalink raw reply

* Re: [PATCH 46/50] Sound: usb: ua101: spin_lock in complete() cleanup
From: Sergei Shtylyov @ 2013-07-11 13:10 UTC (permalink / raw)
  To: Ming Lei
  Cc: Greg Kroah-Hartman, linux-usb, Oliver Neukum, Alan Stern,
	linux-input, linux-bluetooth, netdev, linux-wireless, linux-media,
	alsa-devel, Clemens Ladisch, Jaroslav Kysela, Takashi Iwai
In-Reply-To: <1373533573-12272-47-git-send-email-ming.lei@canonical.com>

On 11-07-2013 13:06, Ming Lei wrote:

    Here the subject doesn't match the patch.

> Complete() will be run with interrupt enabled, so disable local
> interrupt before holding a global lock which is held without irqsave.

> Cc: Clemens Ladisch <clemens@ladisch.de>
> Cc: Jaroslav Kysela <perex@perex.cz>
> Cc: Takashi Iwai <tiwai@suse.de>
> Cc: alsa-devel@alsa-project.org
> Signed-off-by: Ming Lei <ming.lei@canonical.com>
> ---
>   sound/usb/misc/ua101.c |   14 ++++++++++++--
>   1 file changed, 12 insertions(+), 2 deletions(-)

> diff --git a/sound/usb/misc/ua101.c b/sound/usb/misc/ua101.c
> index 8b5d2c5..52a60c6 100644
> --- a/sound/usb/misc/ua101.c
> +++ b/sound/usb/misc/ua101.c
> @@ -613,14 +613,24 @@ static int start_usb_playback(struct ua101 *ua)
>
>   static void abort_alsa_capture(struct ua101 *ua)
>   {
> -	if (test_bit(ALSA_CAPTURE_RUNNING, &ua->states))
> +	if (test_bit(ALSA_CAPTURE_RUNNING, &ua->states)) {
> +		unsigned long flags;
> +
> +		local_irq_save(flags);
>   		snd_pcm_stop(ua->capture.substream, SNDRV_PCM_STATE_XRUN);
> +		local_irq_restore(flags);
> +	}
>   }
>
>   static void abort_alsa_playback(struct ua101 *ua)
>   {
> -	if (test_bit(ALSA_PLAYBACK_RUNNING, &ua->states))
> +	if (test_bit(ALSA_PLAYBACK_RUNNING, &ua->states)) {
> +		unsigned long flags;
> +
> +		local_irq_save(flags);
>   		snd_pcm_stop(ua->playback.substream, SNDRV_PCM_STATE_XRUN);
> +		local_irq_restore(flags);
> +	}
>   }

WBR, Sergei


^ permalink raw reply

* Re: [PATCH 44/50] sound: usb: caiaq: spin_lock in complete() cleanup
From: Sergei Shtylyov @ 2013-07-11 13:12 UTC (permalink / raw)
  To: Ming Lei
  Cc: Greg Kroah-Hartman, linux-usb, Oliver Neukum, Alan Stern,
	linux-input, linux-bluetooth, netdev, linux-wireless, linux-media,
	alsa-devel, Daniel Mack, Jaroslav Kysela, Takashi Iwai
In-Reply-To: <1373533573-12272-45-git-send-email-ming.lei@canonical.com>

On 11-07-2013 13:06, Ming Lei wrote:

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

> Cc: Daniel Mack <zonque@gmail.com>
> Cc: Jaroslav Kysela <perex@perex.cz>
> Cc: Takashi Iwai <tiwai@suse.de>
> Cc: alsa-devel@alsa-project.org
> Signed-off-by: Ming Lei <ming.lei@canonical.com>
> ---
>   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;

    Emoty line wouldn't hurt here, after declaration.

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

WBR, Sergei


^ permalink raw reply


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox