Skip to contentSkip to conversation

media: imx7-mipi-csis: Add the missed v4l2_async_notifier_cleanup in remove

PATCH In review Chuhong Yuan 6 participants 7 messages Dec 9, 2019 – Dec 13, 2019

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 media: imx7-mipi-csis: Add the missed v4l2_async_notifier_cleanup in remove

All drivers in imx call v4l2_async_notifier_cleanup() after unregistering the notifier except this driver.
This should be a miss and we need to add the call to fix it.

---
 drivers/staging/media/imx/imx7-mipi-csis.c | 1 +
 1 file changed, 1 insertion(+)
drivers/staging/media/imx/imx7-mipi-csis.c +1 -0
index 99166afca071..2bfa85bb84e7 100644
@@ -1105,6 +1105,7 @@ static int mipi_csis_remove(struct platform_device *pdev)
 	mipi_csis_debugfs_exit(state);
 	v4l2_async_unregister_subdev(&state->mipi_sd);
 	v4l2_async_notifier_unregister(&state->subdev_notifier);
+	v4l2_async_notifier_cleanup(&state->subdev_notifier);
 
 	pm_runtime_disable(&pdev->dev);
 	mipi_csis_pm_suspend(&pdev->dev, true);
Signature · 1 line
2.24.0
Reviewed-by on v1 1/1
#1 lore raw

Hi Chuhong,
Thanks for the patch.

Quoted 5 lines · Chuhong Yuan

All drivers in imx call v4l2_async_notifier_cleanup() after unregistering the notifier except this driver.
This should be a miss and we need to add the call to fix it.

------
Cheers,
Rui

Quoted 19 lines
---
 drivers/staging/media/imx/imx7-mipi-csis.c | 1 +
 1 file changed, 1 insertion(+)
drivers/staging/media/imx/imx7-mipi-csis.c +1 -0
index 99166afca071..2bfa85bb84e7 100644
@@ -1105,6 +1105,7 @@ static int mipi_csis_remove(struct platform_device *pdev)
 	mipi_csis_debugfs_exit(state);
 	v4l2_async_unregister_subdev(&state->mipi_sd);
 	v4l2_async_notifier_unregister(&state->subdev_notifier);
+	v4l2_async_notifier_cleanup(&state->subdev_notifier);
 
 	pm_runtime_disable(&pdev->dev);
 	mipi_csis_pm_suspend(&pdev->dev, true);
Signature · 1 line
2.24.0
#2 lore raw

Steve, Philipp,

I'd like one (or both) of you to look over this first.

It looks as if the subdev_notifier field of struct csi_state is never used, except by the existing v4l2_async_notifier_unregister() call.

If I am right, then the real issue is that that field should be removed.

Regards,

Hans

Quoted 34 lines · Rui Miguel Silva

Hi Chuhong,
Thanks for the patch.

Quoted 5 lines · Chuhong Yuan

All drivers in imx call v4l2_async_notifier_cleanup() after unregistering the notifier except this driver.
This should be a miss and we need to add the call to fix it.

------
Cheers,
Rui

Quoted 19 lines
---
 drivers/staging/media/imx/imx7-mipi-csis.c | 1 +
 1 file changed, 1 insertion(+)
drivers/staging/media/imx/imx7-mipi-csis.c +1 -0
index 99166afca071..2bfa85bb84e7 100644
@@ -1105,6 +1105,7 @@ static int mipi_csis_remove(struct platform_device *pdev)
 	mipi_csis_debugfs_exit(state);
 	v4l2_async_unregister_subdev(&state->mipi_sd);
 	v4l2_async_notifier_unregister(&state->subdev_notifier);
+	v4l2_async_notifier_cleanup(&state->subdev_notifier);
 
 	pm_runtime_disable(&pdev->dev);
 	mipi_csis_pm_suspend(&pdev->dev, true);
Signature · 1 line
2.24.0
#3 lore raw
In reply to Chuhong Yuan
Quoted 14 lines · Chuhong Yuan

All drivers in imx call v4l2_async_notifier_cleanup() after unregistering the notifier except this driver.
This should be a miss and we need to add the call to fix it.

---
 drivers/staging/media/imx/imx7-mipi-csis.c | 1 +
 1 file changed, 1 insertion(+)
drivers/staging/media/imx/imx7-mipi-csis.c +0 -0
index 99166afca071..2bfa85bb84e7 100644

drivers/staging/media/imx/imx7-mipi-csis.c static int mipi_csis_remove(struct platform_device *pdev) · line 1109

Quoted 5 lines
drivers/staging/media/imx/imx7-mipi-csis.c +1 -0
@@ -1105,6 +1105,7 @@ static int mipi_csis_remove(struct platform_device *pdev)
 	mipi_csis_debugfs_exit(state);
 	v4l2_async_unregister_subdev(&state->mipi_sd);
 	v4l2_async_notifier_unregister(&state->subdev_notifier);
+	v4l2_async_notifier_cleanup(&state->subdev_notifier);
 

In this case the "state->subdev_notifier" was never initialized or used so both v4l2_async_notifier_unregister() and v4l2_async_notifier_cleanup() are no-ops.

We should just delete "subdev_notifier".

regards,
dan carpenter

_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

maintainer
#4 lore raw
Quoted 25 lines · Dan Carpenter
Quoted 14 lines · Chuhong Yuan

All drivers in imx call v4l2_async_notifier_cleanup() after unregistering the notifier except this driver.
This should be a miss and we need to add the call to fix it.

---
 drivers/staging/media/imx/imx7-mipi-csis.c | 1 +
 1 file changed, 1 insertion(+)
drivers/staging/media/imx/imx7-mipi-csis.c +0 -0
index 99166afca071..2bfa85bb84e7 100644

drivers/staging/media/imx/imx7-mipi-csis.c static int mipi_csis_remove(struct platform_device *pdev) · line 1109

Quoted 5 lines
drivers/staging/media/imx/imx7-mipi-csis.c +1 -0
@@ -1105,6 +1105,7 @@ static int mipi_csis_remove(struct platform_device *pdev)
 	mipi_csis_debugfs_exit(state);
 	v4l2_async_unregister_subdev(&state->mipi_sd);
 	v4l2_async_notifier_unregister(&state->subdev_notifier);
+	v4l2_async_notifier_cleanup(&state->subdev_notifier);
 

In this case the "state->subdev_notifier" was never initialized or used so both v4l2_async_notifier_unregister() and v4l2_async_notifier_cleanup() are no-ops.

Quoted 1 line

We should just delete "subdev_notifier".

I agree with Dan and Hans, the subdev_notifier field and the v4l2_async_notifier_unregister() call should be removed. Since this issue was there from the start, the patch can be tagged as fixing commit 7807063b862b.

regards
Philipp

#5 lore raw
In reply to Dan Carpenter

Hi Dan,
Thanks for the inputs.

Quoted 9 lines · Dan Carpenter
Quoted 8 lines · Chuhong Yuan

All drivers in imx call v4l2_async_notifier_cleanup() after unregistering the notifier except this driver. This should be a miss and we need to add the call to fix it.

drivers/staging/media/imx/imx7-mipi-csis.c | 1 +

 1 file changed, 1 insertion(+)
Quoted 15 lines
Quoted 11 lines
(quoted diff) +0 -0

b/drivers/staging/media/imx/imx7-mipi-csis.c index 99166afca071..2bfa85bb84e7 100644 --- a/drivers/staging/media/imx/imx7-mipi-csis.c +++ b/drivers/staging/media/imx/imx7-mipi-csis.c @@ -1105,6 +1105,7 @@ static int mipi_csis_remove(struct platform_device *pdev) mipi_csis_debugfs_exit(state); v4l2_async_unregister_subdev(&state->mipi_sd); v4l2_async_notifier_unregister(&state->subdev_notifier); + v4l2_async_notifier_cleanup(&state->subdev_notifier);

In this case the "state->subdev_notifier" was never initialized or used so both v4l2_async_notifier_unregister() and v4l2_async_notifier_cleanup() are no-ops.

I have applied this patch on top of Steve's series [0], since by the timeline I was expecting to be applied before this one, that series adds a bound notifier, even though, it is not named the same, eheh.

That trigged me to think that this cleanup was correct since a notifier was initialized in probe.

But as you say, it is a no-ops in the end.

@Steve, that said, it looks that in [0], you will need to add some unregister and cleanup for the notifiers that you are adding in several places.

A patch to fix this will follow.

------
Cheers,
Rui

[0]: https://patchwork.kernel.org/project/linux-media/list/?series=207517

Quoted 8 lines

We should just delete "subdev_notifier".

regards, dan carpenter

_______________________________________________ devel mailing list [email protected]
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

maintainer
#6 lore raw
Quoted 30 lines · Rui Miguel Silva

Hi Dan,
Thanks for the inputs.

Quoted 9 lines · Dan Carpenter
Quoted 8 lines · Chuhong Yuan

All drivers in imx call v4l2_async_notifier_cleanup() after unregistering the notifier except this driver. This should be a miss and we need to add the call to fix it.

drivers/staging/media/imx/imx7-mipi-csis.c | 1 +

  1 file changed, 1 insertion(+)
Quoted 14 lines
Quoted 11 lines
(quoted diff) +0 -0

b/drivers/staging/media/imx/imx7-mipi-csis.c index 99166afca071..2bfa85bb84e7 100644 --- a/drivers/staging/media/imx/imx7-mipi-csis.c +++ b/drivers/staging/media/imx/imx7-mipi-csis.c @@ -1105,6 +1105,7 @@ static int mipi_csis_remove(struct platform_device *pdev) mipi_csis_debugfs_exit(state); v4l2_async_unregister_subdev(&state->mipi_sd); v4l2_async_notifier_unregister(&state->subdev_notifier); + v4l2_async_notifier_cleanup(&state->subdev_notifier);

In this case the "state->subdev_notifier" was never initialized or used so both v4l2_async_notifier_unregister() and v4l2_async_notifier_cleanup() are no-ops.

I have applied this patch on top of Steve's series [0], since by the timeline I was expecting to be applied before this one, that series adds a bound notifier, even though, it is not named the same, eheh.

Quoted 8 lines

That trigged me to think that this cleanup was correct since a notifier was initialized in probe.

But as you say, it is a no-ops in the end.

@Steve, that said, it looks that in [0], you will need to add some unregister and cleanup for the notifiers that you are adding in several places.

Well, turns out I had failed to notice that an async notifier was already included in 'struct imx7_csi' as 'subdev_notifier', even though it was unused. So I ended up creating a duplicate 'notifier'. I'll cleaning that up in v3 of [0].

Steve

Quoted 17 lines

A patch to fix this will follow.

------
Cheers,
Rui

[0]: https://patchwork.kernel.org/project/linux-media/list/?series=207517

Quoted 7 lines

We should just delete "subdev_notifier".

regards, dan carpenter

_______________________________________________ devel mailing list [email protected]
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel