summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--drivers/char/diag/diagfwd_peripheral.c23
1 files changed, 20 insertions, 3 deletions
diff --git a/drivers/char/diag/diagfwd_peripheral.c b/drivers/char/diag/diagfwd_peripheral.c
index 4b5db01dbdf3..aaa587975469 100644
--- a/drivers/char/diag/diagfwd_peripheral.c
+++ b/drivers/char/diag/diagfwd_peripheral.c
@@ -991,6 +991,21 @@ static void __diag_fwd_open(struct diagfwd_info *fwd_info)
if (!fwd_info->inited)
return;
+ /*
+ * Logging mode here is reflecting previous mode
+ * status and will be updated to new mode later.
+ *
+ * Keeping the buffers busy for Memory Device Mode.
+ */
+
+ if ((driver->logging_mode != DIAG_USB_MODE) ||
+ driver->usb_connected) {
+ if (fwd_info->buf_1)
+ atomic_set(&fwd_info->buf_1->in_busy, 0);
+ if (fwd_info->buf_2)
+ atomic_set(&fwd_info->buf_2->in_busy, 0);
+ }
+
if (fwd_info->p_ops && fwd_info->p_ops->open)
fwd_info->p_ops->open(fwd_info->ctxt);
@@ -1151,11 +1166,13 @@ void diagfwd_write_done(uint8_t peripheral, uint8_t type, int ctxt)
return;
fwd_info = &peripheral_info[type][peripheral];
- if (ctxt == 1 && fwd_info->buf_1)
+ if (ctxt == 1 && fwd_info->buf_1) {
atomic_set(&fwd_info->buf_1->in_busy, 0);
- else if (ctxt == 2 && fwd_info->buf_2)
+ driver->cpd_len_1 = 0;
+ } else if (ctxt == 2 && fwd_info->buf_2) {
atomic_set(&fwd_info->buf_2->in_busy, 0);
- else if (ctxt == 3 && fwd_info->buf_upd_1_a) {
+ driver->cpd_len_2 = 0;
+ } else if (ctxt == 3 && fwd_info->buf_upd_1_a) {
atomic_set(&fwd_info->buf_upd_1_a->in_busy, 0);
if (driver->cpd_len_1 == 0)
atomic_set(&fwd_info->buf_1->in_busy, 0);