From: Sakari Ailus <sakari.ailus@linux.intel.com>
To: linux-media@vger.kernel.org
Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>, hans@jjverkuil.nl
Subject: [PATCH 3/3] media: v4l2-dev: Make macros to obtain containers const-aware
Date: Thu, 2 Oct 2025 13:32:56 +0300 [thread overview]
Message-ID: <20251002103256.2081947-5-sakari.ailus@linux.intel.com> (raw)
In-Reply-To: <20251002103256.2081947-1-sakari.ailus@linux.intel.com>
Retain the constness of the graph objects and interfaces in macros to
obtain their containers, by switching to container_of_const().
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
---
include/media/media-entity.h | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/include/media/media-entity.h b/include/media/media-entity.h
index 64cf590b1134..b91ff6f8c3bb 100644
--- a/include/media/media-entity.h
+++ b/include/media/media-entity.h
@@ -627,7 +627,7 @@ static inline bool media_entity_enum_intersects(
* @gobj: Pointer to the struct &media_gobj graph object
*/
#define gobj_to_entity(gobj) \
- container_of(gobj, struct media_entity, graph_obj)
+ container_of_const(gobj, struct media_entity, graph_obj)
/**
* gobj_to_pad - returns the struct &media_pad pointer from the
@@ -636,7 +636,7 @@ static inline bool media_entity_enum_intersects(
* @gobj: Pointer to the struct &media_gobj graph object
*/
#define gobj_to_pad(gobj) \
- container_of(gobj, struct media_pad, graph_obj)
+ container_of_const(gobj, struct media_pad, graph_obj)
/**
* gobj_to_link - returns the struct &media_link pointer from the
@@ -645,7 +645,7 @@ static inline bool media_entity_enum_intersects(
* @gobj: Pointer to the struct &media_gobj graph object
*/
#define gobj_to_link(gobj) \
- container_of(gobj, struct media_link, graph_obj)
+ container_of_const(gobj, struct media_link, graph_obj)
/**
* gobj_to_intf - returns the struct &media_interface pointer from the
@@ -654,7 +654,7 @@ static inline bool media_entity_enum_intersects(
* @gobj: Pointer to the struct &media_gobj graph object
*/
#define gobj_to_intf(gobj) \
- container_of(gobj, struct media_interface, graph_obj)
+ container_of_const(gobj, struct media_interface, graph_obj)
/**
* intf_to_devnode - returns the struct media_intf_devnode pointer from the
@@ -663,7 +663,7 @@ static inline bool media_entity_enum_intersects(
* @intf: Pointer to struct &media_intf_devnode
*/
#define intf_to_devnode(intf) \
- container_of(intf, struct media_intf_devnode, intf)
+ container_of_const(intf, struct media_intf_devnode, intf)
/**
* media_gobj_create - Initialize a graph object
--
2.47.3
next prev parent reply other threads:[~2025-10-02 10:33 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-02 10:32 [PATCH 0/3] Switch to container_of_const() in macros Sakari Ailus
2025-10-02 10:32 ` [PATCH 1/3] media: v4l2-subdev: Make media_entity_to_v4l2_subdev() const-aware Sakari Ailus
2025-10-02 10:32 ` [PATCH 2/3] media: v4l2-dev: Make macros to obtain containers const-aware Sakari Ailus
2025-10-02 10:32 ` [PATCH 3/3] media: mc: " Sakari Ailus
2025-10-02 10:32 ` Sakari Ailus [this message]
2025-10-02 10:45 ` [PATCH 3/3] media: v4l2-dev: " 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=20251002103256.2081947-5-sakari.ailus@linux.intel.com \
--to=sakari.ailus@linux.intel.com \
--cc=hans@jjverkuil.nl \
--cc=laurent.pinchart@ideasonboard.com \
--cc=linux-media@vger.kernel.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