public inbox for linux-media@vger.kernel.org
 help / color / mirror / Atom feed
From: Stanislaw Gruszka <stanislaw.gruszka@linux.intel.com>
To: linux-media@vger.kernel.org
Cc: Sakari Ailus <sakari.ailus@linux.intel.com>,
	Bingbu Cao <bingbu.cao@intel.com>
Subject: [PATCH 6/7] media: intel/ipu6: Introduce isys and dev accessors macros
Date: Mon,  7 Apr 2025 15:40:36 +0200	[thread overview]
Message-ID: <20250407134037.808367-7-stanislaw.gruszka@linux.intel.com> (raw)
In-Reply-To: <20250407134037.808367-1-stanislaw.gruszka@linux.intel.com>

Add macro and inline function to get access ipu6_isys and device back
pointer. Using the helpers will allow to transformation to common
structures.

Signed-off-by: Stanislaw Gruszka <stanislaw.gruszka@linux.intel.com>
---
Note: this gives checkpatch error about space around ":" , but 
the same error is already in include/media/v4l2-common.h and
include/media/v4l2-subdev.h , so ignore it.

 drivers/media/pci/intel/ipu6/ipu6-isys.h | 27 ++++++++++++++++++++++++
 1 file changed, 27 insertions(+)

diff --git a/drivers/media/pci/intel/ipu6/ipu6-isys.h b/drivers/media/pci/intel/ipu6/ipu6-isys.h
index bf6008bfe539..c753656b04f4 100644
--- a/drivers/media/pci/intel/ipu6/ipu6-isys.h
+++ b/drivers/media/pci/intel/ipu6/ipu6-isys.h
@@ -16,6 +16,7 @@
 #include <media/v4l2-device.h>
 
 #include "ipu6.h"
+#include "ipu6-bus.h"
 #include "ipu6-fw-isys.h"
 #include "ipu6-isys-csi2.h"
 #include "ipu6-isys-video.h"
@@ -165,6 +166,32 @@ struct ipu6_isys {
 	struct isys_iwake_watermark iwake_watermark;
 };
 
+static inline struct ipu6_isys *stream_to_isys6(struct isys_stream *stream)
+{
+	return stream->isys;
+}
+
+static inline struct ipu6_isys *video_to_isys6(struct ipu6_isys_video *video)
+{
+	return video->isys;
+}
+
+static inline struct ipu6_isys *csi2_to_isys6(struct ipu6_isys_csi2 *csi2)
+{
+	return csi2->isys;
+}
+
+#define to_isys(p)                                      \
+	_Generic(p,                                     \
+		struct isys_stream *: stream_to_isys6,  \
+		struct ipu6_isys_csi2 *: csi2_to_isys6, \
+		struct ipu6_isys_video *: video_to_isys6)(p)
+
+static inline struct device *isys_to_dev(struct ipu6_isys *isys)
+{
+	return &isys->adev->auxdev.dev;
+}
+
 struct isys_fw_msgs {
 	union {
 		u64 dummy;
-- 
2.34.1


  parent reply	other threads:[~2025-04-07 13:41 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-07 13:40 [PATCH 0/7] media: intel/ipu6: continue on ipu7 code sharing preparation Stanislaw Gruszka
2025-04-07 13:40 ` [PATCH 1/7] media: intel/ipu6: Use isd name in isys.h Stanislaw Gruszka
2025-04-07 13:40 ` [PATCH 2/7] media: intel/ipu6: Remove line_align Stanislaw Gruszka
2025-04-10 12:04   ` Sakari Ailus
2025-04-10 13:12     ` Stanislaw Gruszka
2025-04-10 15:34       ` Sakari Ailus
2025-04-07 13:40 ` [PATCH 3/7] media: intel/ipu6: Move common structures definitions to isys.h Stanislaw Gruszka
2025-04-07 13:40 ` [PATCH 4/7] media: intel/ipu6: Rename common structures Stanislaw Gruszka
2025-04-07 13:40 ` [PATCH 5/7] media: intel/ipu6: Remove deprecated lock comment Stanislaw Gruszka
2025-04-07 13:40 ` Stanislaw Gruszka [this message]
2025-04-07 13:40 ` [PATCH 7/7] media: intel/ipu6: Start using accessors to get dev pointer Stanislaw Gruszka
2025-04-10 15:34 ` [PATCH 0/7] media: intel/ipu6: continue on ipu7 code sharing preparation Sakari Ailus
2025-04-14 10:11   ` Stanislaw Gruszka
2025-04-14 12:52     ` Sakari Ailus

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=20250407134037.808367-7-stanislaw.gruszka@linux.intel.com \
    --to=stanislaw.gruszka@linux.intel.com \
    --cc=bingbu.cao@intel.com \
    --cc=linux-media@vger.kernel.org \
    --cc=sakari.ailus@linux.intel.com \
    /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