mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-10-28 15:20:41 +00:00
drivers:misc: ti-st: fix hci-ll on wake_ind collision
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> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
This commit is contained in:
parent
ef04d121f0
commit
6d71ba2105
1 changed files with 15 additions and 0 deletions
|
@ -236,6 +236,7 @@ void st_int_recv(void *disc_data,
|
||||||
int len = 0, type = 0;
|
int len = 0, type = 0;
|
||||||
unsigned char *plen;
|
unsigned char *plen;
|
||||||
struct st_data_s *st_gdata = (struct st_data_s *)disc_data;
|
struct st_data_s *st_gdata = (struct st_data_s *)disc_data;
|
||||||
|
unsigned long flags;
|
||||||
|
|
||||||
ptr = (char *)data;
|
ptr = (char *)data;
|
||||||
/* tty_receive sent null ? */
|
/* tty_receive sent null ? */
|
||||||
|
@ -248,6 +249,7 @@ void st_int_recv(void *disc_data,
|
||||||
"rx_count %ld", count, st_gdata->rx_state,
|
"rx_count %ld", count, st_gdata->rx_state,
|
||||||
st_gdata->rx_count);
|
st_gdata->rx_count);
|
||||||
|
|
||||||
|
spin_lock_irqsave(&st_gdata->lock, flags);
|
||||||
/* Decode received bytes here */
|
/* Decode received bytes here */
|
||||||
while (count) {
|
while (count) {
|
||||||
if (st_gdata->rx_count) {
|
if (st_gdata->rx_count) {
|
||||||
|
@ -308,13 +310,25 @@ void st_int_recv(void *disc_data,
|
||||||
* sleep state received --
|
* sleep state received --
|
||||||
*/
|
*/
|
||||||
st_ll_sleep_state(st_gdata, *ptr);
|
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++;
|
ptr++;
|
||||||
count--;
|
count--;
|
||||||
continue;
|
continue;
|
||||||
case LL_WAKE_UP_ACK:
|
case LL_WAKE_UP_ACK:
|
||||||
pr_debug("PM packet");
|
pr_debug("PM packet");
|
||||||
|
|
||||||
|
spin_unlock_irqrestore(&st_gdata->lock, flags);
|
||||||
/* wake up ack received */
|
/* wake up ack received */
|
||||||
st_wakeup_ack(st_gdata, *ptr);
|
st_wakeup_ack(st_gdata, *ptr);
|
||||||
|
spin_lock_irqsave(&st_gdata->lock, flags);
|
||||||
|
|
||||||
ptr++;
|
ptr++;
|
||||||
count--;
|
count--;
|
||||||
continue;
|
continue;
|
||||||
|
@ -337,6 +351,7 @@ void st_int_recv(void *disc_data,
|
||||||
ptr++;
|
ptr++;
|
||||||
count--;
|
count--;
|
||||||
}
|
}
|
||||||
|
spin_unlock_irqrestore(&st_gdata->lock, flags);
|
||||||
pr_debug("done %s", __func__);
|
pr_debug("done %s", __func__);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue