coresight: tmc: dump system memory content only when needed
[firefly-linux-kernel-4.4.55.git] / drivers / hwtracing / coresight / coresight-tmc-etr.c
index 0c107811a232e8e20548a52992c45f9f07a81ba9..7208584d0da7f4335d29c9daa7d81dd8203ed319 100644 (file)
@@ -76,7 +76,12 @@ static void tmc_etr_disable_hw(struct tmc_drvdata *drvdata)
        CS_UNLOCK(drvdata->base);
 
        tmc_flush_and_stop(drvdata);
-       tmc_etr_dump_hw(drvdata);
+       /*
+        * When operating in sysFS mode the content of the buffer needs to be
+        * read before the TMC is disabled.
+        */
+       if (local_read(&drvdata->mode) == CS_MODE_SYSFS)
+               tmc_etr_dump_hw(drvdata);
        tmc_disable_hw(drvdata);
 
        CS_LOCK(drvdata->base);