public inbox for linux-media@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/1] media: ipu3-cio2: Fix container_of() macro wrapper arguments
@ 2023-04-17  9:29 Sakari Ailus
  2023-04-17 10:45 ` Cao, Bingbu
  0 siblings, 1 reply; 2+ messages in thread
From: Sakari Ailus @ 2023-04-17  9:29 UTC (permalink / raw)
  To: linux-media; +Cc: bingbu.cao

The argument of the to_sensor_asd() is called the same as the field name
for the container_of() macro, so it only works if the argument name is
"asd". Fix it.

Also switch to container_of_const().

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
---
 drivers/media/pci/intel/ipu3/ipu3-cio2-main.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/media/pci/intel/ipu3/ipu3-cio2-main.c b/drivers/media/pci/intel/ipu3/ipu3-cio2-main.c
index fa53d0835c89c..39ad1309a61b5 100644
--- a/drivers/media/pci/intel/ipu3/ipu3-cio2-main.c
+++ b/drivers/media/pci/intel/ipu3/ipu3-cio2-main.c
@@ -1374,7 +1374,8 @@ struct sensor_async_subdev {
 	struct csi2_bus_info csi2;
 };
 
-#define to_sensor_asd(asd)	container_of(asd, struct sensor_async_subdev, asd)
+#define to_sensor_asd(__asd)	\
+	container_of_const(__asd, struct sensor_async_subdev, asd)
 
 /* The .bound() notifier callback when a match is found */
 static int cio2_notifier_bound(struct v4l2_async_notifier *notifier,
-- 
2.30.2


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

* RE: [PATCH 1/1] media: ipu3-cio2: Fix container_of() macro wrapper arguments
  2023-04-17  9:29 [PATCH 1/1] media: ipu3-cio2: Fix container_of() macro wrapper arguments Sakari Ailus
@ 2023-04-17 10:45 ` Cao, Bingbu
  0 siblings, 0 replies; 2+ messages in thread
From: Cao, Bingbu @ 2023-04-17 10:45 UTC (permalink / raw)
  To: Sakari Ailus, linux-media@vger.kernel.org

Reviewed-by: Bingbu Cao <bingbu.cao@intel.com>


------------------------------------------------------------------------
BRs,  
Bingbu Cao 

>-----Original Message-----
>From: Sakari Ailus <sakari.ailus@linux.intel.com>
>Sent: Monday, April 17, 2023 17:30
>To: linux-media@vger.kernel.org
>Cc: Cao, Bingbu <bingbu.cao@intel.com>
>Subject: [PATCH 1/1] media: ipu3-cio2: Fix container_of() macro wrapper
>arguments
>
>The argument of the to_sensor_asd() is called the same as the field name
>for the container_of() macro, so it only works if the argument name is
>"asd". Fix it.
>
>Also switch to container_of_const().
>
>Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
>---
> drivers/media/pci/intel/ipu3/ipu3-cio2-main.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
>diff --git a/drivers/media/pci/intel/ipu3/ipu3-cio2-main.c
>b/drivers/media/pci/intel/ipu3/ipu3-cio2-main.c
>index fa53d0835c89c..39ad1309a61b5 100644
>--- a/drivers/media/pci/intel/ipu3/ipu3-cio2-main.c
>+++ b/drivers/media/pci/intel/ipu3/ipu3-cio2-main.c
>@@ -1374,7 +1374,8 @@ struct sensor_async_subdev {
> 	struct csi2_bus_info csi2;
> };
>
>-#define to_sensor_asd(asd)	container_of(asd, struct sensor_async_subdev,
>asd)
>+#define to_sensor_asd(__asd)	\
>+	container_of_const(__asd, struct sensor_async_subdev, asd)
>
> /* The .bound() notifier callback when a match is found */  static int
>cio2_notifier_bound(struct v4l2_async_notifier *notifier,
>--
>2.30.2


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

end of thread, other threads:[~2023-04-17 10:48 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-04-17  9:29 [PATCH 1/1] media: ipu3-cio2: Fix container_of() macro wrapper arguments Sakari Ailus
2023-04-17 10:45 ` Cao, Bingbu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox