* [PATCH] media: i2c: cx25840: guard media_entity_cleanup() calls
@ 2026-11-12 8:52 Zixin Wang
2026-11-12 9:12 ` Sakari Ailus
0 siblings, 1 reply; 2+ messages in thread
From: Zixin Wang @ 2026-11-12 8:52 UTC (permalink / raw)
To: Mauro Carvalho Chehab
Cc: Hans Verkuil, Sakari Ailus, Biren Pandya, linux-media,
linux-kernel, Zixin Wang
sd->entity only exists when CONFIG_MEDIA_CONTROLLER is enabled, but the
two media_entity_cleanup() calls added by commit 634be628b5cc
("media: i2c: cx25840-core: Add missing media_entity_cleanup()") are
unconditional. Building with CONFIG_MEDIA_CONTROLLER=n therefore fails:
drivers/media/i2c/cx25840/cx25840-core.c:3964:41: error:
'struct v4l2_subdev' has no member named 'entity'
Guard both calls with #if defined(CONFIG_MEDIA_CONTROLLER), matching the
existing media entity setup in cx25840_probe().
The failure was reproduced with CONFIG_MEDIA_CONTROLLER=n. After the
change the driver builds with both CONFIG_MEDIA_CONTROLLER=n and =y.
AI assistance: the fix and this changelog were drafted with the Qoder
coding assistant; the sender reviewed the change and ran the builds.
Fixes: 634be628b5cc ("media: i2c: cx25840-core: Add missing media_entity_cleanup()")
Link: https://bugzilla.kernel.org/show_bug.cgi?id=222245
Signed-off-by: Zixin Wang <w1355457260@gmail.com>
---
drivers/media/i2c/cx25840/cx25840-core.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/drivers/media/i2c/cx25840/cx25840-core.c b/drivers/media/i2c/cx25840/cx25840-core.c
index 7066b2252afd..91794ec59e2d 100644
--- a/drivers/media/i2c/cx25840/cx25840-core.c
+++ b/drivers/media/i2c/cx25840/cx25840-core.c
@@ -3961,7 +3961,9 @@ static int cx25840_probe(struct i2c_client *client)
int err = state->hdl.error;
v4l2_ctrl_handler_free(&state->hdl);
+#if defined(CONFIG_MEDIA_CONTROLLER)
media_entity_cleanup(&sd->entity);
+#endif
return err;
}
if (!is_cx2583x(state))
@@ -3986,7 +3988,9 @@ static void cx25840_remove(struct i2c_client *client)
cx25840_ir_remove(sd);
v4l2_device_unregister_subdev(sd);
v4l2_ctrl_handler_free(&state->hdl);
+#if defined(CONFIG_MEDIA_CONTROLLER)
media_entity_cleanup(&sd->entity);
+#endif
}
static const struct i2c_device_id cx25840_id[] = {
--
2.56.1
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] media: i2c: cx25840: guard media_entity_cleanup() calls
2026-11-12 8:52 [PATCH] media: i2c: cx25840: guard media_entity_cleanup() calls Zixin Wang
@ 2026-11-12 9:12 ` Sakari Ailus
0 siblings, 0 replies; 2+ messages in thread
From: Sakari Ailus @ 2026-11-12 9:12 UTC (permalink / raw)
To: Zixin Wang
Cc: Mauro Carvalho Chehab, Hans Verkuil, Biren Pandya, linux-media,
linux-kernel
Hi Zixin,
On Thu, Nov 12, 2026 at 04:52:51PM +0800, Zixin Wang wrote:
> sd->entity only exists when CONFIG_MEDIA_CONTROLLER is enabled, but the
> two media_entity_cleanup() calls added by commit 634be628b5cc
> ("media: i2c: cx25840-core: Add missing media_entity_cleanup()") are
> unconditional. Building with CONFIG_MEDIA_CONTROLLER=n therefore fails:
>
> drivers/media/i2c/cx25840/cx25840-core.c:3964:41: error:
> 'struct v4l2_subdev' has no member named 'entity'
How about instead turning media_entity_cleanup() into a macro that does
nothing with the arguments if MC is disabled?
>
> Guard both calls with #if defined(CONFIG_MEDIA_CONTROLLER), matching the
> existing media entity setup in cx25840_probe().
>
> The failure was reproduced with CONFIG_MEDIA_CONTROLLER=n. After the
> change the driver builds with both CONFIG_MEDIA_CONTROLLER=n and =y.
>
> AI assistance: the fix and this changelog were drafted with the Qoder
> coding assistant; the sender reviewed the change and ran the builds.
This goes below the '---' line.
>
> Fixes: 634be628b5cc ("media: i2c: cx25840-core: Add missing media_entity_cleanup()")
> Link: https://bugzilla.kernel.org/show_bug.cgi?id=222245
> Signed-off-by: Zixin Wang <w1355457260@gmail.com>
> ---
> drivers/media/i2c/cx25840/cx25840-core.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/drivers/media/i2c/cx25840/cx25840-core.c b/drivers/media/i2c/cx25840/cx25840-core.c
> index 7066b2252afd..91794ec59e2d 100644
> --- a/drivers/media/i2c/cx25840/cx25840-core.c
> +++ b/drivers/media/i2c/cx25840/cx25840-core.c
> @@ -3961,7 +3961,9 @@ static int cx25840_probe(struct i2c_client *client)
> int err = state->hdl.error;
>
> v4l2_ctrl_handler_free(&state->hdl);
> +#if defined(CONFIG_MEDIA_CONTROLLER)
> media_entity_cleanup(&sd->entity);
> +#endif
> return err;
> }
> if (!is_cx2583x(state))
> @@ -3986,7 +3988,9 @@ static void cx25840_remove(struct i2c_client *client)
> cx25840_ir_remove(sd);
> v4l2_device_unregister_subdev(sd);
> v4l2_ctrl_handler_free(&state->hdl);
> +#if defined(CONFIG_MEDIA_CONTROLLER)
> media_entity_cleanup(&sd->entity);
> +#endif
> }
>
> static const struct i2c_device_id cx25840_id[] = {
--
Regards,
Sakari Ailus
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-11-12 9:12 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-12 8:52 [PATCH] media: i2c: cx25840: guard media_entity_cleanup() calls Zixin Wang
2026-11-12 9:12 ` Sakari Ailus
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®