From 2cf818c2552c69abcb299ecae0c7a3991376e506 Mon Sep 17 00:00:00 2001 From: Mao Jinlong Date: Sun, 28 Jun 2020 09:42:56 +0800 Subject: [PATCH] tmc-etr: Fix duplicate logs issue when use sw usb mode If etr driver data size is smaller than the sysfs buffer size, it will read the data from the begainning of etr buffer repeatedly when the actual read size plus the offset is greater than etr driver data size. Compare with etr buffer size instead of etr driver data size to fix this issue. Change-Id: Ic523f8c5efd8348de7be80128a96d4e1ce867b9b Signed-off-by: Mao Jinlong --- drivers/hwtracing/coresight/coresight-byte-cntr.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/hwtracing/coresight/coresight-byte-cntr.c b/drivers/hwtracing/coresight/coresight-byte-cntr.c index a928e48b7bc9..c9c9807fbd80 100644 --- a/drivers/hwtracing/coresight/coresight-byte-cntr.c +++ b/drivers/hwtracing/coresight/coresight-byte-cntr.c @@ -351,7 +351,8 @@ static int usb_transfer_small_packet(struct qdss_request *usb_req, drvdata->usb_req = usb_req; req_size -= actual; - if ((drvdata->offset + actual) >= tmcdrvdata->size) + if ((drvdata->offset + actual) >= + tmcdrvdata->etr_buf->size) drvdata->offset = 0; else drvdata->offset += actual; @@ -458,7 +459,7 @@ static void usb_read_work_fn(struct work_struct *work) sg_mark_end(&usb_req->sg[i]); if ((drvdata->offset + actual) >= - tmcdrvdata->size) + tmcdrvdata->etr_buf->size) drvdata->offset = 0; else drvdata->offset += actual;