Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1720251

[GIT PULL 05/15] intel_th: Streamline the subdevice tree accessors

From Alexander Shishkin <alexander.shishkin@linux.intel.com>
Newsgroups linux.kernel
Subject [GIT PULL 05/15] intel_th: Streamline the subdevice tree accessors
Date 2017-08-25 18:30 +0200
Message-ID <uipEC-6ki-27@gated-at.bofh.it> (permalink)
References <uipuV-6gP-5@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


Make to_intel_th*() accessors available from the main header file.

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

diff --git a/drivers/hwtracing/intel_th/core.c b/drivers/hwtracing/intel_th/core.c
index 8da567abc0..e6d302ba17 100644
--- a/drivers/hwtracing/intel_th/core.c
+++ b/drivers/hwtracing/intel_th/core.c
@@ -156,21 +156,6 @@ static struct device_type intel_th_source_device_type = {
 	.release	= intel_th_device_release,
 };
 
-static struct intel_th *to_intel_th(struct intel_th_device *thdev)
-{
-	/*
-	 * subdevice tree is flat: if this one is not a switch, its
-	 * parent must be
-	 */
-	if (thdev->type != INTEL_TH_SWITCH)
-		thdev = to_intel_th_hub(thdev);
-
-	if (WARN_ON_ONCE(!thdev || thdev->type != INTEL_TH_SWITCH))
-		return NULL;
-
-	return dev_get_drvdata(thdev->dev.parent);
-}
-
 static char *intel_th_output_devnode(struct device *dev, umode_t *mode,
 				     kuid_t *uid, kgid_t *gid)
 {
diff --git a/drivers/hwtracing/intel_th/intel_th.h b/drivers/hwtracing/intel_th/intel_th.h
index c03f28ef64..496286ce79 100644
--- a/drivers/hwtracing/intel_th/intel_th.h
+++ b/drivers/hwtracing/intel_th/intel_th.h
@@ -173,7 +173,7 @@ struct intel_th_driver {
 	((_d) ? to_intel_th_driver(_d) : NULL)
 
 static inline struct intel_th_device *
-to_intel_th_hub(struct intel_th_device *thdev)
+to_intel_th_parent(struct intel_th_device *thdev)
 {
 	struct device *parent = thdev->dev.parent;
 
@@ -183,6 +183,29 @@ to_intel_th_hub(struct intel_th_device *thdev)
 	return to_intel_th_device(parent);
 }
 
+static inline struct intel_th_device *
+to_intel_th_hub(struct intel_th_device *thdev)
+{
+	/*
+	 * subdevice tree is flat: if this one is not a switch, its
+	 * parent must be
+	 */
+	if (thdev->type == INTEL_TH_SWITCH)
+		return thdev;
+
+	return to_intel_th_parent(thdev);
+}
+
+static inline struct intel_th *to_intel_th(struct intel_th_device *thdev)
+{
+	thdev = to_intel_th_hub(thdev);
+
+	if (WARN_ON_ONCE(!thdev || thdev->type != INTEL_TH_SWITCH))
+		return NULL;
+
+	return dev_get_drvdata(thdev->dev.parent);
+}
+
 struct intel_th *
 intel_th_alloc(struct device *dev, struct resource *devres,
 	       unsigned int ndevres, int irq);
-- 
2.14.1

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[GIT PULL 00/15] stm class/intel_th: Updates for 4.14 Alexander Shishkin <alexander.shishkin@linux.intel.com> - 2017-08-25 18:20 +0200
  [GIT PULL 04/15] intel_th: Output devices without ports don't need assigning Alexander Shishkin <alexander.shishkin@linux.intel.com> - 2017-08-25 18:30 +0200
  [GIT PULL 03/15] intel_th: pci: Enable bus mastering Alexander Shishkin <alexander.shishkin@linux.intel.com> - 2017-08-25 18:30 +0200
  [GIT PULL 05/15] intel_th: Streamline the subdevice tree accessors Alexander Shishkin <alexander.shishkin@linux.intel.com> - 2017-08-25 18:30 +0200
  [GIT PULL 02/15] stm class: Document the stm_ftrace Alexander Shishkin <alexander.shishkin@linux.intel.com> - 2017-08-25 18:30 +0200
  [GIT PULL 12/15] intel_th: pci: Add Cannon Lake PCH-LP support Alexander Shishkin <alexander.shishkin@linux.intel.com> - 2017-08-25 18:40 +0200
  [GIT PULL 10/15] intel_th: pti: Support Low Power Path output port type Alexander Shishkin <alexander.shishkin@linux.intel.com> - 2017-08-25 18:40 +0200
  [GIT PULL 11/15] intel_th: pci: Add Cannon Lake PCH-H support Alexander Shishkin <alexander.shishkin@linux.intel.com> - 2017-08-25 18:40 +0200
  [GIT PULL 13/15] intel_th: pci: Use drvdata for quirks Alexander Shishkin <alexander.shishkin@linux.intel.com> - 2017-08-25 18:40 +0200
  [GIT PULL 07/15] intel_th: Make the switch allocate its subdevices Alexander Shishkin <alexander.shishkin@linux.intel.com> - 2017-08-25 18:40 +0200
  [GIT PULL 09/15] intel_th: Enumerate Low Power Path output port type Alexander Shishkin <alexander.shishkin@linux.intel.com> - 2017-08-25 18:40 +0200
  [GIT PULL 15/15] intel_th: Perform time resync on capture start Alexander Shishkin <alexander.shishkin@linux.intel.com> - 2017-08-25 18:40 +0200
  [GIT PULL 08/15] intel_th: msu: Use the real device in case of IOMMU domain allocation Alexander Shishkin <alexander.shishkin@linux.intel.com> - 2017-08-25 18:40 +0200
  [GIT PULL 14/15] intel_th: Add global activate/deactivate callbacks for the glue layers Alexander Shishkin <alexander.shishkin@linux.intel.com> - 2017-08-25 18:40 +0200
  [GIT PULL 06/15] intel_th: Make SOURCE devices children of the root device Alexander Shishkin <alexander.shishkin@linux.intel.com> - 2017-08-25 18:40 +0200
  Re: [GIT PULL 00/15] stm class/intel_th: Updates for 4.14 Greg KH <greg@kroah.com> - 2017-08-28 17:00 +0200

csiph-web