linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] coresight: tmc: minor fix for output log
@ 2017-04-07 15:22 Leo Yan
  2017-04-20 15:58 ` Mathieu Poirier
  0 siblings, 1 reply; 2+ messages in thread
From: Leo Yan @ 2017-04-07 15:22 UTC (permalink / raw)
  To: linux-arm-kernel

In current code the output logs are not well symmetric for sink and link
enabling and disabling. This patch is to fix that so can output paired
logs.

Cc: Mathieu Poirier <mathieu.poirier@linaro.org>
Signed-off-by: Leo Yan <leo.yan@linaro.org>
---
 drivers/hwtracing/coresight/coresight-tmc-etf.c | 25 +++++++++++++++++--------
 1 file changed, 17 insertions(+), 8 deletions(-)

diff --git a/drivers/hwtracing/coresight/coresight-tmc-etf.c b/drivers/hwtracing/coresight/coresight-tmc-etf.c
index 1549436..3a1c181 100644
--- a/drivers/hwtracing/coresight/coresight-tmc-etf.c
+++ b/drivers/hwtracing/coresight/coresight-tmc-etf.c
@@ -166,9 +166,6 @@ static int tmc_enable_etf_sink_sysfs(struct coresight_device *csdev)
 	if (!used)
 		kfree(buf);
 
-	if (!ret)
-		dev_info(drvdata->dev, "TMC-ETB/ETF enabled\n");
-
 	return ret;
 }
 
@@ -204,15 +201,27 @@ static int tmc_enable_etf_sink_perf(struct coresight_device *csdev)
 
 static int tmc_enable_etf_sink(struct coresight_device *csdev, u32 mode)
 {
+	int ret;
+	struct tmc_drvdata *drvdata = dev_get_drvdata(csdev->dev.parent);
+
 	switch (mode) {
 	case CS_MODE_SYSFS:
-		return tmc_enable_etf_sink_sysfs(csdev);
+		ret = tmc_enable_etf_sink_sysfs(csdev);
+		break;
 	case CS_MODE_PERF:
-		return tmc_enable_etf_sink_perf(csdev);
+		ret = tmc_enable_etf_sink_perf(csdev);
+		break;
+	/* We shouldn't be here */
+	default:
+		ret = -EINVAL;
+		break;
 	}
 
-	/* We shouldn't be here */
-	return -EINVAL;
+	if (ret)
+		return ret;
+
+	dev_info(drvdata->dev, "TMC-ETB/ETF enabled\n");
+	return 0;
 }
 
 static void tmc_disable_etf_sink(struct coresight_device *csdev)
@@ -273,7 +282,7 @@ static void tmc_disable_etf_link(struct coresight_device *csdev,
 	drvdata->mode = CS_MODE_DISABLED;
 	spin_unlock_irqrestore(&drvdata->spinlock, flags);
 
-	dev_info(drvdata->dev, "TMC disabled\n");
+	dev_info(drvdata->dev, "TMC-ETF disabled\n");
 }
 
 static void *tmc_alloc_etf_buffer(struct coresight_device *csdev, int cpu,
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [PATCH] coresight: tmc: minor fix for output log
  2017-04-07 15:22 [PATCH] coresight: tmc: minor fix for output log Leo Yan
@ 2017-04-20 15:58 ` Mathieu Poirier
  0 siblings, 0 replies; 2+ messages in thread
From: Mathieu Poirier @ 2017-04-20 15:58 UTC (permalink / raw)
  To: linux-arm-kernel

On 7 April 2017 at 09:22, Leo Yan <leo.yan@linaro.org> wrote:
> In current code the output logs are not well symmetric for sink and link
> enabling and disabling. This patch is to fix that so can output paired
> logs.
>
> Cc: Mathieu Poirier <mathieu.poirier@linaro.org>
> Signed-off-by: Leo Yan <leo.yan@linaro.org>
> ---
>  drivers/hwtracing/coresight/coresight-tmc-etf.c | 25 +++++++++++++++++--------
>  1 file changed, 17 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/hwtracing/coresight/coresight-tmc-etf.c b/drivers/hwtracing/coresight/coresight-tmc-etf.c
> index 1549436..3a1c181 100644
> --- a/drivers/hwtracing/coresight/coresight-tmc-etf.c
> +++ b/drivers/hwtracing/coresight/coresight-tmc-etf.c
> @@ -166,9 +166,6 @@ static int tmc_enable_etf_sink_sysfs(struct coresight_device *csdev)
>         if (!used)
>                 kfree(buf);
>
> -       if (!ret)
> -               dev_info(drvdata->dev, "TMC-ETB/ETF enabled\n");
> -
>         return ret;
>  }
>
> @@ -204,15 +201,27 @@ static int tmc_enable_etf_sink_perf(struct coresight_device *csdev)
>
>  static int tmc_enable_etf_sink(struct coresight_device *csdev, u32 mode)
>  {
> +       int ret;
> +       struct tmc_drvdata *drvdata = dev_get_drvdata(csdev->dev.parent);
> +
>         switch (mode) {
>         case CS_MODE_SYSFS:
> -               return tmc_enable_etf_sink_sysfs(csdev);
> +               ret = tmc_enable_etf_sink_sysfs(csdev);
> +               break;
>         case CS_MODE_PERF:
> -               return tmc_enable_etf_sink_perf(csdev);
> +               ret = tmc_enable_etf_sink_perf(csdev);
> +               break;
> +       /* We shouldn't be here */
> +       default:
> +               ret = -EINVAL;
> +               break;
>         }
>
> -       /* We shouldn't be here */
> -       return -EINVAL;
> +       if (ret)
> +               return ret;
> +
> +       dev_info(drvdata->dev, "TMC-ETB/ETF enabled\n");
> +       return 0;
>  }
>
>  static void tmc_disable_etf_sink(struct coresight_device *csdev)
> @@ -273,7 +282,7 @@ static void tmc_disable_etf_link(struct coresight_device *csdev,
>         drvdata->mode = CS_MODE_DISABLED;
>         spin_unlock_irqrestore(&drvdata->spinlock, flags);
>
> -       dev_info(drvdata->dev, "TMC disabled\n");
> +       dev_info(drvdata->dev, "TMC-ETF disabled\n");
>  }
>

Applied - thanks.
Mathieu

>  static void *tmc_alloc_etf_buffer(struct coresight_device *csdev, int cpu,
> --
> 2.7.4
>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-04-20 15:58 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-04-07 15:22 [PATCH] coresight: tmc: minor fix for output log Leo Yan
2017-04-20 15:58 ` Mathieu Poirier

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).