linux-media.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/3] media: Use v4l2_event_subdev_unsubscribe() in more drivers
@ 2025-08-01 21:19 Laurent Pinchart
  2025-08-01 21:19 ` [PATCH 1/3] media: omap3isp: Drop custom .unsubscribe_event() handler Laurent Pinchart
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Laurent Pinchart @ 2025-08-01 21:19 UTC (permalink / raw)
  To: linux-media
  Cc: Hans de Goede, Sakari Ailus, Steve Longerbeam, Philipp Zabel,
	Hans Verkuil, linux-staging, imx

Hello,

This small patch series contains drive-by cleanups for the omap3isp,
atomisp and imx media drivers. I noticed that all those drivers
implemented custom subdev .unsubscribe_event() handlers, for those
handlers to perform exactly the same operation as
v4l2_event_subdev_unsubscribe(). The series replaces them with direct
usage of the v4l2_event_subdev_unsubscribe() function.

Laurent Pinchart (3):
  media: omap3isp: Drop custom .unsubscribe_event() handler
  media: staging: atomisp: Drop custom .unsubscribe_event() handler
  media: staging: imx: Drop custom .unsubscribe_event() handler

 drivers/media/platform/ti/omap3isp/ispccdc.c       | 8 +-------
 drivers/media/platform/ti/omap3isp/isph3a_aewb.c   | 2 +-
 drivers/media/platform/ti/omap3isp/isph3a_af.c     | 2 +-
 drivers/media/platform/ti/omap3isp/isphist.c       | 2 +-
 drivers/media/platform/ti/omap3isp/ispstat.c       | 7 -------
 drivers/media/platform/ti/omap3isp/ispstat.h       | 3 ---
 drivers/staging/media/atomisp/pci/atomisp_subdev.c | 9 +--------
 drivers/staging/media/imx/imx-media-csi.c          | 8 +-------
 8 files changed, 6 insertions(+), 35 deletions(-)


base-commit: d968e50b5c26642754492dea23cbd3592bde62d8
-- 
Regards,

Laurent Pinchart


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

* [PATCH 1/3] media: omap3isp: Drop custom .unsubscribe_event() handler
  2025-08-01 21:19 [PATCH 0/3] media: Use v4l2_event_subdev_unsubscribe() in more drivers Laurent Pinchart
@ 2025-08-01 21:19 ` Laurent Pinchart
  2025-08-01 21:19 ` [PATCH 2/3] media: staging: atomisp: " Laurent Pinchart
  2025-08-01 21:19 ` [PATCH 3/3] media: staging: imx: " Laurent Pinchart
  2 siblings, 0 replies; 5+ messages in thread
From: Laurent Pinchart @ 2025-08-01 21:19 UTC (permalink / raw)
  To: linux-media
  Cc: Hans de Goede, Sakari Ailus, Steve Longerbeam, Philipp Zabel,
	Hans Verkuil, linux-staging, imx

The ccdc_unsubscribe_event() and omap3isp_stat_unsubscribe_event()
functions simply call v4l2_event_unsubscribe(), forwarding their
arguments. Replace them with the v4l2_event_subdev_unsubscribe() helper
that performs exactly the same operation.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
---
 drivers/media/platform/ti/omap3isp/ispccdc.c     | 8 +-------
 drivers/media/platform/ti/omap3isp/isph3a_aewb.c | 2 +-
 drivers/media/platform/ti/omap3isp/isph3a_af.c   | 2 +-
 drivers/media/platform/ti/omap3isp/isphist.c     | 2 +-
 drivers/media/platform/ti/omap3isp/ispstat.c     | 7 -------
 drivers/media/platform/ti/omap3isp/ispstat.h     | 3 ---
 6 files changed, 4 insertions(+), 20 deletions(-)

diff --git a/drivers/media/platform/ti/omap3isp/ispccdc.c b/drivers/media/platform/ti/omap3isp/ispccdc.c
index 7d0c723dcd11..55ee14e8b449 100644
--- a/drivers/media/platform/ti/omap3isp/ispccdc.c
+++ b/drivers/media/platform/ti/omap3isp/ispccdc.c
@@ -1873,12 +1873,6 @@ static int ccdc_subscribe_event(struct v4l2_subdev *sd, struct v4l2_fh *fh,
 	return v4l2_event_subscribe(fh, sub, OMAP3ISP_CCDC_NEVENTS, NULL);
 }
 
-static int ccdc_unsubscribe_event(struct v4l2_subdev *sd, struct v4l2_fh *fh,
-				  struct v4l2_event_subscription *sub)
-{
-	return v4l2_event_unsubscribe(fh, sub);
-}
-
 /*
  * ccdc_set_stream - Enable/Disable streaming on the CCDC module
  * @sd: ISP CCDC V4L2 subdevice
@@ -2487,7 +2481,7 @@ static int ccdc_init_formats(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh)
 static const struct v4l2_subdev_core_ops ccdc_v4l2_core_ops = {
 	.ioctl = ccdc_ioctl,
 	.subscribe_event = ccdc_subscribe_event,
-	.unsubscribe_event = ccdc_unsubscribe_event,
+	.unsubscribe_event = v4l2_event_subdev_unsubscribe,
 };
 
 /* V4L2 subdev video operations */
diff --git a/drivers/media/platform/ti/omap3isp/isph3a_aewb.c b/drivers/media/platform/ti/omap3isp/isph3a_aewb.c
index e6c54c4bbfca..ae93da9c4542 100644
--- a/drivers/media/platform/ti/omap3isp/isph3a_aewb.c
+++ b/drivers/media/platform/ti/omap3isp/isph3a_aewb.c
@@ -269,7 +269,7 @@ static const struct ispstat_ops h3a_aewb_ops = {
 static const struct v4l2_subdev_core_ops h3a_aewb_subdev_core_ops = {
 	.ioctl = h3a_aewb_ioctl,
 	.subscribe_event = omap3isp_stat_subscribe_event,
-	.unsubscribe_event = omap3isp_stat_unsubscribe_event,
+	.unsubscribe_event = v4l2_event_subdev_unsubscribe,
 };
 
 static const struct v4l2_subdev_video_ops h3a_aewb_subdev_video_ops = {
diff --git a/drivers/media/platform/ti/omap3isp/isph3a_af.c b/drivers/media/platform/ti/omap3isp/isph3a_af.c
index de7b116d0122..ca478da4ad34 100644
--- a/drivers/media/platform/ti/omap3isp/isph3a_af.c
+++ b/drivers/media/platform/ti/omap3isp/isph3a_af.c
@@ -334,7 +334,7 @@ static const struct ispstat_ops h3a_af_ops = {
 static const struct v4l2_subdev_core_ops h3a_af_subdev_core_ops = {
 	.ioctl = h3a_af_ioctl,
 	.subscribe_event = omap3isp_stat_subscribe_event,
-	.unsubscribe_event = omap3isp_stat_unsubscribe_event,
+	.unsubscribe_event = v4l2_event_subdev_unsubscribe,
 };
 
 static const struct v4l2_subdev_video_ops h3a_af_subdev_video_ops = {
diff --git a/drivers/media/platform/ti/omap3isp/isphist.c b/drivers/media/platform/ti/omap3isp/isphist.c
index 0ef78aace6da..7851ad13d84f 100644
--- a/drivers/media/platform/ti/omap3isp/isphist.c
+++ b/drivers/media/platform/ti/omap3isp/isphist.c
@@ -456,7 +456,7 @@ static const struct ispstat_ops hist_ops = {
 static const struct v4l2_subdev_core_ops hist_subdev_core_ops = {
 	.ioctl = hist_ioctl,
 	.subscribe_event = omap3isp_stat_subscribe_event,
-	.unsubscribe_event = omap3isp_stat_unsubscribe_event,
+	.unsubscribe_event = v4l2_event_subdev_unsubscribe,
 };
 
 static const struct v4l2_subdev_video_ops hist_subdev_video_ops = {
diff --git a/drivers/media/platform/ti/omap3isp/ispstat.c b/drivers/media/platform/ti/omap3isp/ispstat.c
index d3da68408ecb..07bd62a93d99 100644
--- a/drivers/media/platform/ti/omap3isp/ispstat.c
+++ b/drivers/media/platform/ti/omap3isp/ispstat.c
@@ -1010,13 +1010,6 @@ int omap3isp_stat_subscribe_event(struct v4l2_subdev *subdev,
 	return v4l2_event_subscribe(fh, sub, STAT_NEVENTS, NULL);
 }
 
-int omap3isp_stat_unsubscribe_event(struct v4l2_subdev *subdev,
-				    struct v4l2_fh *fh,
-				    struct v4l2_event_subscription *sub)
-{
-	return v4l2_event_unsubscribe(fh, sub);
-}
-
 void omap3isp_stat_unregister_entities(struct ispstat *stat)
 {
 	v4l2_device_unregister_subdev(&stat->subdev);
diff --git a/drivers/media/platform/ti/omap3isp/ispstat.h b/drivers/media/platform/ti/omap3isp/ispstat.h
index b548e617cf62..59842c4a9c33 100644
--- a/drivers/media/platform/ti/omap3isp/ispstat.h
+++ b/drivers/media/platform/ti/omap3isp/ispstat.h
@@ -135,9 +135,6 @@ void omap3isp_stat_cleanup(struct ispstat *stat);
 int omap3isp_stat_subscribe_event(struct v4l2_subdev *subdev,
 				  struct v4l2_fh *fh,
 				  struct v4l2_event_subscription *sub);
-int omap3isp_stat_unsubscribe_event(struct v4l2_subdev *subdev,
-				    struct v4l2_fh *fh,
-				    struct v4l2_event_subscription *sub);
 int omap3isp_stat_s_stream(struct v4l2_subdev *subdev, int enable);
 
 int omap3isp_stat_busy(struct ispstat *stat);
-- 
Regards,

Laurent Pinchart


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

* [PATCH 2/3] media: staging: atomisp: Drop custom .unsubscribe_event() handler
  2025-08-01 21:19 [PATCH 0/3] media: Use v4l2_event_subdev_unsubscribe() in more drivers Laurent Pinchart
  2025-08-01 21:19 ` [PATCH 1/3] media: omap3isp: Drop custom .unsubscribe_event() handler Laurent Pinchart
@ 2025-08-01 21:19 ` Laurent Pinchart
  2025-08-01 21:19 ` [PATCH 3/3] media: staging: imx: " Laurent Pinchart
  2 siblings, 0 replies; 5+ messages in thread
From: Laurent Pinchart @ 2025-08-01 21:19 UTC (permalink / raw)
  To: linux-media
  Cc: Hans de Goede, Sakari Ailus, Steve Longerbeam, Philipp Zabel,
	Hans Verkuil, linux-staging, imx

The isp_subdev_unsubscribe_event() function simply calls
v4l2_event_unsubscribe(), forwarding its arguments. Replace it with the
v4l2_event_subdev_unsubscribe() helper that performs exactly the same
operation.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
---
 drivers/staging/media/atomisp/pci/atomisp_subdev.c | 9 +--------
 1 file changed, 1 insertion(+), 8 deletions(-)

diff --git a/drivers/staging/media/atomisp/pci/atomisp_subdev.c b/drivers/staging/media/atomisp/pci/atomisp_subdev.c
index 22c0ae0b1b7b..3d56ca83ecb7 100644
--- a/drivers/staging/media/atomisp/pci/atomisp_subdev.c
+++ b/drivers/staging/media/atomisp/pci/atomisp_subdev.c
@@ -161,13 +161,6 @@ static int isp_subdev_subscribe_event(struct v4l2_subdev *sd,
 	return v4l2_event_subscribe(fh, sub, 16, NULL);
 }
 
-static int isp_subdev_unsubscribe_event(struct v4l2_subdev *sd,
-					struct v4l2_fh *fh,
-					struct v4l2_event_subscription *sub)
-{
-	return v4l2_event_unsubscribe(fh, sub);
-}
-
 /*
  * isp_subdev_enum_mbus_code - Handle pixel format enumeration
  * @sd: pointer to v4l2 subdev structure
@@ -575,7 +568,7 @@ static int isp_subdev_set_format(struct v4l2_subdev *sd,
 static const struct v4l2_subdev_core_ops isp_subdev_v4l2_core_ops = {
 	.ioctl = isp_subdev_ioctl,
 	.subscribe_event = isp_subdev_subscribe_event,
-	.unsubscribe_event = isp_subdev_unsubscribe_event,
+	.unsubscribe_event = v4l2_event_subdev_unsubscribe,
 };
 
 /* V4L2 subdev pad operations */
-- 
Regards,

Laurent Pinchart


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

* [PATCH 3/3] media: staging: imx: Drop custom .unsubscribe_event() handler
  2025-08-01 21:19 [PATCH 0/3] media: Use v4l2_event_subdev_unsubscribe() in more drivers Laurent Pinchart
  2025-08-01 21:19 ` [PATCH 1/3] media: omap3isp: Drop custom .unsubscribe_event() handler Laurent Pinchart
  2025-08-01 21:19 ` [PATCH 2/3] media: staging: atomisp: " Laurent Pinchart
@ 2025-08-01 21:19 ` Laurent Pinchart
  2025-08-05 20:52   ` Frank Li
  2 siblings, 1 reply; 5+ messages in thread
From: Laurent Pinchart @ 2025-08-01 21:19 UTC (permalink / raw)
  To: linux-media
  Cc: Hans de Goede, Sakari Ailus, Steve Longerbeam, Philipp Zabel,
	Hans Verkuil, linux-staging, imx

The csi_unsubscribe_event() function simply calls
v4l2_event_unsubscribe(), forwarding its arguments. Replace it with the
v4l2_event_subdev_unsubscribe() helper that performs exactly the same
operation.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
---
 drivers/staging/media/imx/imx-media-csi.c | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)

diff --git a/drivers/staging/media/imx/imx-media-csi.c b/drivers/staging/media/imx/imx-media-csi.c
index a7cd3ef95fc3..fd7e37d803e7 100644
--- a/drivers/staging/media/imx/imx-media-csi.c
+++ b/drivers/staging/media/imx/imx-media-csi.c
@@ -1751,12 +1751,6 @@ static int csi_subscribe_event(struct v4l2_subdev *sd, struct v4l2_fh *fh,
 	return v4l2_event_subscribe(fh, sub, 0, NULL);
 }
 
-static int csi_unsubscribe_event(struct v4l2_subdev *sd, struct v4l2_fh *fh,
-				 struct v4l2_event_subscription *sub)
-{
-	return v4l2_event_unsubscribe(fh, sub);
-}
-
 static int csi_registered(struct v4l2_subdev *sd)
 {
 	struct csi_priv *priv = v4l2_get_subdevdata(sd);
@@ -1872,7 +1866,7 @@ static const struct media_entity_operations csi_entity_ops = {
 
 static const struct v4l2_subdev_core_ops csi_core_ops = {
 	.subscribe_event = csi_subscribe_event,
-	.unsubscribe_event = csi_unsubscribe_event,
+	.unsubscribe_event = v4l2_event_subdev_unsubscribe,
 };
 
 static const struct v4l2_subdev_video_ops csi_video_ops = {
-- 
Regards,

Laurent Pinchart


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

* Re: [PATCH 3/3] media: staging: imx: Drop custom .unsubscribe_event() handler
  2025-08-01 21:19 ` [PATCH 3/3] media: staging: imx: " Laurent Pinchart
@ 2025-08-05 20:52   ` Frank Li
  0 siblings, 0 replies; 5+ messages in thread
From: Frank Li @ 2025-08-05 20:52 UTC (permalink / raw)
  To: Laurent Pinchart
  Cc: linux-media, Hans de Goede, Sakari Ailus, Steve Longerbeam,
	Philipp Zabel, Hans Verkuil, linux-staging, imx

On Sat, Aug 02, 2025 at 12:19:33AM +0300, Laurent Pinchart wrote:
> The csi_unsubscribe_event() function simply calls
> v4l2_event_unsubscribe(), forwarding its arguments. Replace it with the
> v4l2_event_subdev_unsubscribe() helper that performs exactly the same
> operation.
>
> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> ---

Reviewed-by: Frank Li <Frank.Li@nxp.com>

>  drivers/staging/media/imx/imx-media-csi.c | 8 +-------
>  1 file changed, 1 insertion(+), 7 deletions(-)
>
> diff --git a/drivers/staging/media/imx/imx-media-csi.c b/drivers/staging/media/imx/imx-media-csi.c
> index a7cd3ef95fc3..fd7e37d803e7 100644
> --- a/drivers/staging/media/imx/imx-media-csi.c
> +++ b/drivers/staging/media/imx/imx-media-csi.c
> @@ -1751,12 +1751,6 @@ static int csi_subscribe_event(struct v4l2_subdev *sd, struct v4l2_fh *fh,
>  	return v4l2_event_subscribe(fh, sub, 0, NULL);
>  }
>
> -static int csi_unsubscribe_event(struct v4l2_subdev *sd, struct v4l2_fh *fh,
> -				 struct v4l2_event_subscription *sub)
> -{
> -	return v4l2_event_unsubscribe(fh, sub);
> -}
> -
>  static int csi_registered(struct v4l2_subdev *sd)
>  {
>  	struct csi_priv *priv = v4l2_get_subdevdata(sd);
> @@ -1872,7 +1866,7 @@ static const struct media_entity_operations csi_entity_ops = {
>
>  static const struct v4l2_subdev_core_ops csi_core_ops = {
>  	.subscribe_event = csi_subscribe_event,
> -	.unsubscribe_event = csi_unsubscribe_event,
> +	.unsubscribe_event = v4l2_event_subdev_unsubscribe,
>  };
>
>  static const struct v4l2_subdev_video_ops csi_video_ops = {
> --
> Regards,
>
> Laurent Pinchart
>

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

end of thread, other threads:[~2025-08-05 20:52 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-01 21:19 [PATCH 0/3] media: Use v4l2_event_subdev_unsubscribe() in more drivers Laurent Pinchart
2025-08-01 21:19 ` [PATCH 1/3] media: omap3isp: Drop custom .unsubscribe_event() handler Laurent Pinchart
2025-08-01 21:19 ` [PATCH 2/3] media: staging: atomisp: " Laurent Pinchart
2025-08-01 21:19 ` [PATCH 3/3] media: staging: imx: " Laurent Pinchart
2025-08-05 20:52   ` Frank Li

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).