aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hwtracing
diff options
context:
space:
mode:
authorLeo Yan <leo.yan@linaro.org>2018-09-20 15:18:01 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2018-09-25 14:09:18 -0400
commitb3bee19e93e7fe9df01e0a90cec025781b638ad4 (patch)
treee46ea585b51020a293e848a0cf2287e47a64aa01 /drivers/hwtracing
parentb860801e3237ec4c74cf8de0be4816996757ae5c (diff)
coresight: tmc: Refactor loops in etb dump
In ETB dump function tmc_etb_dump_hw() it has nested loops. The second level loop is to iterate index in the range [0 .. drvdata->memwidth); but the index isn't really used in the code, thus the second level loop is useless. This patch is to remove the second level loop; the refactor also reduces indentation and we can use 'break' to replace 'goto' tag. Cc: Mathieu Poirier <mathieu.poirier@linaro.org> Signed-off-by: Leo Yan <leo.yan@linaro.org> Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/hwtracing')
-rw-r--r--drivers/hwtracing/coresight/coresight-tmc-etf.c17
1 files changed, 7 insertions, 10 deletions
diff --git a/drivers/hwtracing/coresight/coresight-tmc-etf.c b/drivers/hwtracing/coresight/coresight-tmc-etf.c
index 4156c95ce1bb..4bf3bfd7c078 100644
--- a/drivers/hwtracing/coresight/coresight-tmc-etf.c
+++ b/drivers/hwtracing/coresight/coresight-tmc-etf.c
@@ -38,23 +38,20 @@ static void tmc_etb_dump_hw(struct tmc_drvdata *drvdata)
38{ 38{
39 char *bufp; 39 char *bufp;
40 u32 read_data, lost; 40 u32 read_data, lost;
41 int i;
42 41
43 /* Check if the buffer wrapped around. */ 42 /* Check if the buffer wrapped around. */
44 lost = readl_relaxed(drvdata->base + TMC_STS) & TMC_STS_FULL; 43 lost = readl_relaxed(drvdata->base + TMC_STS) & TMC_STS_FULL;
45 bufp = drvdata->buf; 44 bufp = drvdata->buf;
46 drvdata->len = 0; 45 drvdata->len = 0;
47 while (1) { 46 while (1) {
48 for (i = 0; i < drvdata->memwidth; i++) { 47 read_data = readl_relaxed(drvdata->base + TMC_RRD);
49 read_data = readl_relaxed(drvdata->base + TMC_RRD); 48 if (read_data == 0xFFFFFFFF)
50 if (read_data == 0xFFFFFFFF) 49 break;
51 goto done; 50 memcpy(bufp, &read_data, 4);
52 memcpy(bufp, &read_data, 4); 51 bufp += 4;
53 bufp += 4; 52 drvdata->len += 4;
54 drvdata->len += 4;
55 }
56 } 53 }
57done: 54
58 if (lost) 55 if (lost)
59 coresight_insert_barrier_packet(drvdata->buf); 56 coresight_insert_barrier_packet(drvdata->buf);
60 return; 57 return;