mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Alexander Shishkin <alexander.shishkin@linux.intel.com>
To: Greg KH <greg@kroah.com>
Cc: Mathieu Poirier <mathieu.poirier@linaro.org>,
	Chunyan Zhang <zhang.chunyan@linaro.org>,
	linux-kernel@vger.kernel.org,
	Alexander Shishkin <alexander.shishkin@linux.intel.com>
Subject: [GIT PULL 14/15] intel_th: Add global activate/deactivate callbacks for the glue layers
Date: Fri, 25 Aug 2017 19:16:05 +0300	[thread overview]
Message-ID: <20170825161606.2670-15-alexander.shishkin@linux.intel.com> (raw)
In-Reply-To: <20170825161606.2670-1-alexander.shishkin@linux.intel.com>

A glue layer may want to install its own hooks into trace capture start
and stop paths to apply workarounds. This adds optional callbacks.

Signed-off-by: Alexander Shishkin <alexander.shishkin@linux.intel.com>
---
 drivers/hwtracing/intel_th/core.c     | 26 ++++++++++++++++++++++----
 drivers/hwtracing/intel_th/intel_th.h |  2 ++
 2 files changed, 24 insertions(+), 4 deletions(-)

diff --git a/drivers/hwtracing/intel_th/core.c b/drivers/hwtracing/intel_th/core.c
index e915ab24f4..998e3e5507 100644
--- a/drivers/hwtracing/intel_th/core.c
+++ b/drivers/hwtracing/intel_th/core.c
@@ -226,6 +226,7 @@ static int intel_th_output_activate(struct intel_th_device *thdev)
 {
 	struct intel_th_driver *thdrv =
 		to_intel_th_driver_or_null(thdev->dev.driver);
+	struct intel_th *th = to_intel_th(thdev);
 	int ret = 0;
 
 	if (!thdrv)
@@ -236,15 +237,28 @@ static int intel_th_output_activate(struct intel_th_device *thdev)
 
 	pm_runtime_get_sync(&thdev->dev);
 
+	if (th->activate)
+		ret = th->activate(th);
+	if (ret)
+		goto fail_put;
+
 	if (thdrv->activate)
 		ret = thdrv->activate(thdev);
 	else
 		intel_th_trace_enable(thdev);
 
-	if (ret) {
-		pm_runtime_put(&thdev->dev);
-		module_put(thdrv->driver.owner);
-	}
+	if (ret)
+		goto fail_deactivate;
+
+	return 0;
+
+fail_deactivate:
+	if (th->deactivate)
+		th->deactivate(th);
+
+fail_put:
+	pm_runtime_put(&thdev->dev);
+	module_put(thdrv->driver.owner);
 
 	return ret;
 }
@@ -253,6 +267,7 @@ static void intel_th_output_deactivate(struct intel_th_device *thdev)
 {
 	struct intel_th_driver *thdrv =
 		to_intel_th_driver_or_null(thdev->dev.driver);
+	struct intel_th *th = to_intel_th(thdev);
 
 	if (!thdrv)
 		return;
@@ -262,6 +277,9 @@ static void intel_th_output_deactivate(struct intel_th_device *thdev)
 	else
 		intel_th_trace_disable(thdev);
 
+	if (th->deactivate)
+		th->deactivate(th);
+
 	pm_runtime_put(&thdev->dev);
 	module_put(thdrv->driver.owner);
 }
diff --git a/drivers/hwtracing/intel_th/intel_th.h b/drivers/hwtracing/intel_th/intel_th.h
index 68244602ca..78a4fb28b1 100644
--- a/drivers/hwtracing/intel_th/intel_th.h
+++ b/drivers/hwtracing/intel_th/intel_th.h
@@ -263,6 +263,8 @@ struct intel_th {
 	struct intel_th_drvdata	*drvdata;
 
 	struct resource		*resource;
+	int			(*activate)(struct intel_th *);
+	void			(*deactivate)(struct intel_th *);
 	unsigned int		num_thdevs;
 	unsigned int		num_resources;
 	int			irq;
-- 
2.14.1

  parent reply	other threads:[~2017-08-25 16:34 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-25 16:15 [GIT PULL 00/15] stm class/intel_th: Updates for 4.14 Alexander Shishkin
2017-08-25 16:15 ` [GIT PULL 01/15] stm: Potential read overflow in stm_char_policy_set_ioctl() Alexander Shishkin
2017-08-25 16:15 ` [GIT PULL 02/15] stm class: Document the stm_ftrace Alexander Shishkin
2017-08-25 16:15 ` [GIT PULL 03/15] intel_th: pci: Enable bus mastering Alexander Shishkin
2017-08-25 16:15 ` [GIT PULL 04/15] intel_th: Output devices without ports don't need assigning Alexander Shishkin
2017-08-25 16:15 ` [GIT PULL 05/15] intel_th: Streamline the subdevice tree accessors Alexander Shishkin
2017-08-25 16:15 ` [GIT PULL 06/15] intel_th: Make SOURCE devices children of the root device Alexander Shishkin
2017-08-25 16:15 ` [GIT PULL 07/15] intel_th: Make the switch allocate its subdevices Alexander Shishkin
2017-08-25 16:15 ` [GIT PULL 08/15] intel_th: msu: Use the real device in case of IOMMU domain allocation Alexander Shishkin
2017-08-25 16:16 ` [GIT PULL 09/15] intel_th: Enumerate Low Power Path output port type Alexander Shishkin
2017-08-25 16:16 ` [GIT PULL 10/15] intel_th: pti: Support " Alexander Shishkin
2017-08-25 16:16 ` [GIT PULL 11/15] intel_th: pci: Add Cannon Lake PCH-H support Alexander Shishkin
2017-08-25 16:16 ` [GIT PULL 12/15] intel_th: pci: Add Cannon Lake PCH-LP support Alexander Shishkin
2017-08-25 16:16 ` [GIT PULL 13/15] intel_th: pci: Use drvdata for quirks Alexander Shishkin
2017-08-25 16:16 ` Alexander Shishkin [this message]
2017-08-25 16:16 ` [GIT PULL 15/15] intel_th: Perform time resync on capture start Alexander Shishkin
2017-08-28 14:59 ` [GIT PULL 00/15] stm class/intel_th: Updates for 4.14 Greg KH

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170825161606.2670-15-alexander.shishkin@linux.intel.com \
    --to=alexander.shishkin@linux.intel.com \
    --cc=greg@kroah.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mathieu.poirier@linaro.org \
    --cc=zhang.chunyan@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome