Skip to contentSkip to conversation

omap3isp: Unregister media device as first

PATCH In review Sakari Ailus 2 participants 2 messages Oct 9, 2018 Media (V4L/DVB)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 omap3isp: Unregister media device as first

While there are issues related to object lifetime management, unregister the media device first when the driver is being unbound. This is slightly safer.

---
 drivers/media/platform/omap3isp/isp.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/media/platform/omap3isp/isp.c +2 -1
index 93f032a39470..4194ea82e6c4 100644
@@ -1587,6 +1587,8 @@ static void isp_pm_complete(struct device *dev)
 
 static void isp_unregister_entities(struct isp_device *isp)
 {
+	media_device_unregister(&isp->media_dev);
+
 	omap3isp_csi2_unregister_entities(&isp->isp_csi2a);
 	omap3isp_ccp2_unregister_entities(&isp->isp_ccp2);
 	omap3isp_ccdc_unregister_entities(&isp->isp_ccdc);
@@ -1597,7 +1599,6 @@ static void isp_unregister_entities(struct isp_device *isp)
 	omap3isp_stat_unregister_entities(&isp->isp_hist);
 
 	v4l2_device_unregister(&isp->v4l2_dev);
-	media_device_unregister(&isp->media_dev);
 	media_device_cleanup(&isp->media_dev);
 }
 
Signature · 1 line
2.11.0
Reviewed-by on v1 1/1
#1 lore raw

Hi Sakari,

Thank you for the patch.

Quoted 5 lines · On Tuesday, 9 October 2018 15:03:16 EEST Sakari Ailus wrote:

While there are issues related to object lifetime management, unregister the media device first when the driver is being unbound. This is slightly safer.

Quoted 25 lines
---
 drivers/media/platform/omap3isp/isp.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
(quoted diff) +0 -0

b/drivers/media/platform/omap3isp/isp.c index 93f032a39470..4194ea82e6c4 100644

drivers/media/platform/omap3isp/isp.c +2 -1
@@ -1587,6 +1587,8 @@ static void isp_pm_complete(struct device *dev)
 
 static void isp_unregister_entities(struct isp_device *isp)
 {
+	media_device_unregister(&isp->media_dev);
+
 	omap3isp_csi2_unregister_entities(&isp->isp_csi2a);
 	omap3isp_ccp2_unregister_entities(&isp->isp_ccp2);
 	omap3isp_ccdc_unregister_entities(&isp->isp_ccdc);
@@ -1597,7 +1599,6 @@ static void isp_unregister_entities(struct isp_device
 *isp) omap3isp_stat_unregister_entities(&isp->isp_hist);
 
 	v4l2_device_unregister(&isp->v4l2_dev);
-	media_device_unregister(&isp->media_dev);
 	media_device_cleanup(&isp->media_dev);
 }
Signature · 3 lines
Regards,

Laurent Pinchart