media: v4l2-subdev: Fix documentation of the subdev_notifier member
Subsystems (2)
PATCH 1/2 media: v4l2-subdev: Fix documentation of the subdev_notifier member
Fix the name of the function that registers the subdev_notifier member of the v4l2_subdev structure.
--- include/media/v4l2-subdev.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/media/v4l2-subdev.h +1 -1
@@ -854,7 +854,7 @@ struct v4l2_subdev_platform_data {* @asd: Pointer to respective &struct v4l2_async_subdev. * @notifier: Pointer to the managing notifier. * @subdev_notifier: A sub-device notifier implicitly registered for the sub- -* device using v4l2_device_register_sensor_subdev(). +* device using v4l2_async_register_subdev_sensor_common(). * @pdata: common part of subdevice platform data * * Each instance of a subdev driver should create this struct, either
Signature · 1 line
2.31.1
PATCH 2/2 media: v4l2-async: Make subdev notifier cleanup conditional
A dedicated subdev notified is registered when using the helper dedicated to sensors (v4l2_async_register_subdev_sensor_common), but this is not the case when a driver uses v4l2_async_register_subdev directly.
As a result, add a conditional check to deal with the dedicated subdev notifier only when necessary at the async subdev unregister step (and avoid operating on/freeing an unallocated notifier).
--- drivers/media/v4l2-core/v4l2-async.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)
drivers/media/v4l2-core/v4l2-async.c +6 -4
@@ -780,10 +780,12 @@ void v4l2_async_unregister_subdev(struct v4l2_subdev *sd)mutex_lock (&list_lock); -__v4l2_async_notifier_unregister (sd->subdev_notifier); -__v4l2_async_notifier_cleanup (sd->subdev_notifier); -kfree (sd->subdev_notifier); - sd->subdev_notifier =NULL ; +if (sd->subdev_notifier) { +__v4l2_async_notifier_unregister (sd->subdev_notifier); +__v4l2_async_notifier_cleanup (sd->subdev_notifier); +kfree (sd->subdev_notifier); + sd->subdev_notifier =NULL ; + }if (sd->asd) {struct v4l2_async_notifier *notifier = sd->notifier;
Signature · 1 line
2.31.1
Sakari Ailus
maintainerRe: [PATCH 2/2] media: v4l2-async: Make subdev notifier cleanup conditional
Hi Paul,
Quoted 4 lines · Paul Kocialkowski
A dedicated subdev notified is registered when using the helper dedicated to sensors (
v4l2_async_register_subdev_sensor_common), but this is not the case when a driver usesv4l2_async_register_subdevdirectly.
Is this a problem?
The notifier unregistration and cleanup functions should be safe to call on a notifier that's not been initialised or registered. The same goes for kfree with NULL argument.
Signature · 3 lines
Kind regards, Sakari Ailus
Re: [PATCH 2/2] media: v4l2-async: Make subdev notifier cleanup conditional
Hi Sakari,
Quoted 8 lines · Sakari Ailus
Hi Paul,
Quoted 4 lines · Paul Kocialkowski
A dedicated subdev notified is registered when using the helper dedicated to sensors (
v4l2_async_register_subdev_sensor_common), but this is not the case when a driver usesv4l2_async_register_subdevdirectly.
Quoted 5 lines
Is this a problem?
The notifier unregistration and cleanup functions should be safe to call on a notifier that's not been initialised or registered. The same goes for kfree with NULL argument.
I think you're right, the functions and kfree are indeed safe. I think I mixed things up with debugging an issue and assumed this was part of the fix I needed.
Sorry for the noise!
Paul
Signature · 3 lines
Paul Kocialkowski, Bootlin Embedded Linux and kernel engineering https://bootlin.com
Sakari Ailus
maintainerHi Paul,
Quoted 13 lines · Paul Kocialkowski
Fix the name of the function that registers the
subdev_notifiermember of thev4l2_subdevstructure.Signed-off-by Paul Kocialkowski <[email protected]>--- include/media/v4l2-subdev.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)include/media/v4l2-subdev.h +0
-0
include/media/v4l2-subdev.h struct v4l2_subdev_platform_data { · line 857
Quoted 5 lines
include/media/v4l2-subdev.h +1
-1@@ -854,7 +854,7 @@ struct v4l2_subdev_platform_data {* @asd: Pointer to respective &struct v4l2_async_subdev. * @notifier: Pointer to the managing notifier. * @subdev_notifier: A sub-device notifier implicitly registered for the sub- -* device using v4l2_device_register_sensor_subdev(). +* device using v4l2_async_register_subdev_sensor_common().
I agree in principle, but the function is nowadays called v4l2_async_register_subdev_sensor().
I can fix this while applying.
Signature · 3 lines
Regards, Sakari Ailus
Hi Sakari,
Quoted 25 lines · Sakari Ailus
Hi Paul,
Quoted 13 lines · Paul Kocialkowski
Fix the name of the function that registers the
subdev_notifiermember of thev4l2_subdevstructure.Signed-off-by Paul Kocialkowski <[email protected]>--- include/media/v4l2-subdev.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)include/media/v4l2-subdev.h +0
-0include/media/v4l2-subdev.h struct v4l2_subdev_platform_data { · line 857
Quoted 5 lines
include/media/v4l2-subdev.h +1
-1@@ -854,7 +854,7 @@ struct v4l2_subdev_platform_data {* @asd: Pointer to respective &struct v4l2_async_subdev. * @notifier: Pointer to the managing notifier. * @subdev_notifier: A sub-device notifier implicitly registered for the sub- -* device using v4l2_device_register_sensor_subdev(). +* device using v4l2_async_register_subdev_sensor_common(). I agree in principle, but the function is nowadays called
v4l2_async_register_subdev_sensor().
Quoted 1 line
I can fix this while applying.
Looks like I missed the rename when rebasing my patch on media/master! Of course, feel free to update with the new name.
Thanks,
Paul
Signature · 3 lines
Paul Kocialkowski, Bootlin Embedded Linux and kernel engineering https://bootlin.com