diff options
author | Jyri Sarha <jsarha@ti.com> | 2016-06-23 11:07:16 +0300 |
---|---|---|
committer | Jyri Sarha <jsarha@ti.com> | 2016-08-08 23:04:57 +0300 |
commit | 20a98acba5baf925d0d6fb334f1c55aa2ca7a708 (patch) | |
tree | b1102fe262e4aabc7a76f9488b1100fbbb8b08a8 /drivers/gpu/drm/tilcdc | |
parent | 10a55a18f50136fe7229ad9a3dea4f7c2d387f6a (diff) | |
download | blackbird-op-linux-20a98acba5baf925d0d6fb334f1c55aa2ca7a708.tar.gz blackbird-op-linux-20a98acba5baf925d0d6fb334f1c55aa2ca7a708.zip |
drm/tilcdc: Fix tilcdc component master unloading
Fix tilcdc component master unloading. If a subcomponent module
(tda998x in this case) is unloaded before its master (tilcdc in this
case), it calls drm_put_dev() and it should not be called again by
the master when its module is unloaded. However component_master_del()
must still be called and the check if the drm_put_dev() has been
called must be in component_master_ops unbind() callback, not in
platform_driver remove() callback.
Signed-off-by: Jyri Sarha <jsarha@ti.com>
Diffstat (limited to 'drivers/gpu/drm/tilcdc')
-rw-r--r-- | drivers/gpu/drm/tilcdc/tilcdc_drv.c | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/drivers/gpu/drm/tilcdc/tilcdc_drv.c b/drivers/gpu/drm/tilcdc/tilcdc_drv.c index ed68324504f6..16163a7e9ed1 100644 --- a/drivers/gpu/drm/tilcdc/tilcdc_drv.c +++ b/drivers/gpu/drm/tilcdc/tilcdc_drv.c @@ -651,6 +651,12 @@ static int tilcdc_bind(struct device *dev) static void tilcdc_unbind(struct device *dev) { + struct drm_device *ddev = dev_get_drvdata(dev); + + /* Check if a subcomponent has already triggered the unloading. */ + if (!ddev->dev_private) + return; + drm_put_dev(dev_get_drvdata(dev)); } @@ -683,17 +689,15 @@ static int tilcdc_pdev_probe(struct platform_device *pdev) static int tilcdc_pdev_remove(struct platform_device *pdev) { - struct drm_device *ddev = dev_get_drvdata(&pdev->dev); - struct tilcdc_drm_private *priv = ddev->dev_private; - - /* Check if a subcomponent has already triggered the unloading. */ - if (!priv) - return 0; + int ret; - if (priv->is_componentized) - component_master_del(&pdev->dev, &tilcdc_comp_ops); - else + ret = tilcdc_get_external_components(&pdev->dev, NULL); + if (ret < 0) + return ret; + else if (ret == 0) drm_put_dev(platform_get_drvdata(pdev)); + else + component_master_del(&pdev->dev, &tilcdc_comp_ops); return 0; } |