From: pavan_savoy@ti.com
To: linux-kernel@vger.kernel.org, gregkh@suse.de
Cc: Pavan Savoy <pavan_savoy@ti.com>
Subject: [PATCH 6/7] drivers:misc: ti-st: fix hci-ll on wake_ind collision
Date: Fri, 4 Feb 2011 02:23:14 -0600 [thread overview]
Message-ID: <1296807795-5408-7-git-send-email-pavan_savoy@ti.com> (raw)
In-Reply-To: <1296807795-5408-6-git-send-email-pavan_savoy@ti.com>
From: Pavan Savoy <pavan_savoy@ti.com>
Where file-transfer stops/pauses in between, is
result of a HCI-LL anamoly in ST LL driver.
ST LL did not copy the contents of WaitQ into the TxQ, when a WAKEUP_IND
collision happened.
Make also sure, that the copying mechanism is safe, by wrapping it around
spin locks inside st_int_recv().
This was easily reproduced when the sleep timeout was reduced to 100ms
for HCI-LL.
Signed-off-by: Pavan Savoy <pavan_savoy@ti.com>
---
drivers/misc/ti-st/st_core.c | 15 +++++++++++++++
1 files changed, 15 insertions(+), 0 deletions(-)
diff --git a/drivers/misc/ti-st/st_core.c b/drivers/misc/ti-st/st_core.c
index dd2c879..f0d24d8 100644
--- a/drivers/misc/ti-st/st_core.c
+++ b/drivers/misc/ti-st/st_core.c
@@ -236,6 +236,7 @@ void st_int_recv(void *disc_data,
int len = 0, type = 0;
unsigned char *plen;
struct st_data_s *st_gdata = (struct st_data_s *)disc_data;
+ unsigned long flags;
ptr = (char *)data;
/* tty_receive sent null ? */
@@ -248,6 +249,7 @@ void st_int_recv(void *disc_data,
"rx_count %ld", count, st_gdata->rx_state,
st_gdata->rx_count);
+ spin_lock_irqsave(&st_gdata->lock, flags);
/* Decode received bytes here */
while (count) {
if (st_gdata->rx_count) {
@@ -308,13 +310,25 @@ void st_int_recv(void *disc_data,
* sleep state received --
*/
st_ll_sleep_state(st_gdata, *ptr);
+ /* if WAKEUP_IND collides copy from waitq to txq
+ * and assume chip awake
+ */
+ spin_unlock_irqrestore(&st_gdata->lock, flags);
+ if (st_ll_getstate(st_gdata) == ST_LL_AWAKE)
+ st_wakeup_ack(st_gdata, LL_WAKE_UP_ACK);
+ spin_lock_irqsave(&st_gdata->lock, flags);
+
ptr++;
count--;
continue;
case LL_WAKE_UP_ACK:
pr_debug("PM packet");
+
+ spin_unlock_irqrestore(&st_gdata->lock, flags);
/* wake up ack received */
st_wakeup_ack(st_gdata, *ptr);
+ spin_lock_irqsave(&st_gdata->lock, flags);
+
ptr++;
count--;
continue;
@@ -337,6 +351,7 @@ void st_int_recv(void *disc_data,
ptr++;
count--;
}
+ spin_unlock_irqrestore(&st_gdata->lock, flags);
pr_debug("done %s", __func__);
return;
}
--
1.6.3.3
next prev parent reply other threads:[~2011-02-04 8:23 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-02-04 8:23 [PATCH 0/7] TI ST patches for new requirements pavan_savoy
2011-02-04 8:23 ` [PATCH 1/7] drivers:misc: ti-st: register with channel IDs pavan_savoy
2011-02-04 8:23 ` [PATCH 2/7] drivers:misc: ti-st: move from rfkill to sysfs pavan_savoy
2011-02-04 8:23 ` [PATCH 3/7] drivers:misc: ti-st: fix error codes pavan_savoy
2011-02-04 8:23 ` [PATCH 4/7] drivers:misc: ti-st: set right debug levels for logs pavan_savoy
2011-02-04 8:23 ` [PATCH 5/7] drivers:misc: ti-st: firmware download optimization pavan_savoy
2011-02-04 8:23 ` pavan_savoy [this message]
2011-02-04 8:23 ` [PATCH 7/7] drivers:misc: ti-st: remove multiple gpio handling pavan_savoy
-- strict thread matches above, loose matches on Subject: below --
2011-02-02 11:00 [PATCH 0/7] TI ST patches for new requirements pavan_savoy
2011-02-02 11:00 ` [PATCH 1/7] drivers:misc: ti-st: register with channel IDs pavan_savoy
2011-02-02 11:00 ` [PATCH 2/7] drivers:misc: ti-st: move from rfkill to sysfs pavan_savoy
2011-02-02 11:00 ` [PATCH 3/7] drivers:misc: ti-st: fix error codes pavan_savoy
2011-02-02 11:00 ` [PATCH 4/7] drivers:misc: ti-st: set right debug levels for logs pavan_savoy
2011-02-02 11:00 ` [PATCH 5/7] drivers:misc: ti-st: firmware download optimization pavan_savoy
2011-02-02 11:00 ` [PATCH 6/7] drivers:misc: ti-st: fix hci-ll on wake_ind collision pavan_savoy
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1296807795-5408-7-git-send-email-pavan_savoy@ti.com \
--to=pavan_savoy@ti.com \
--cc=gregkh@suse.de \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®