drm/panfrost: Remove opp table when unloading
authorSteven Price <steven.price@arm.com>
Fri, 16 Aug 2019 09:31:07 +0000 (10:31 +0100)
committerRob Herring <robh@kernel.org>
Mon, 19 Aug 2019 16:38:51 +0000 (11:38 -0500)
The devfreq opp table needs to be removed when unloading the driver to
free the memory associated with it.

Signed-off-by: Steven Price <steven.price@arm.com>
Signed-off-by: Rob Herring <robh@kernel.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20190816093107.30518-3-steven.price@arm.com
drivers/gpu/drm/panfrost/panfrost_devfreq.c
drivers/gpu/drm/panfrost/panfrost_devfreq.h
drivers/gpu/drm/panfrost/panfrost_drv.c

index 77e1ad24de539ab0b7dc87ede7e1a837a1fbed9a..710d903f8e0dcffc4f8c437e0a44ccbd393ce1e5 100644 (file)
@@ -160,12 +160,18 @@ int panfrost_devfreq_init(struct panfrost_device *pfdev)
                DRM_DEV_ERROR(&pfdev->pdev->dev, "Couldn't initialize GPU devfreq\n");
                ret = PTR_ERR(pfdev->devfreq.devfreq);
                pfdev->devfreq.devfreq = NULL;
+               dev_pm_opp_of_remove_table(&pfdev->pdev->dev);
                return ret;
        }
 
        return 0;
 }
 
+void panfrost_devfreq_fini(struct panfrost_device *pfdev)
+{
+       dev_pm_opp_of_remove_table(&pfdev->pdev->dev);
+}
+
 void panfrost_devfreq_resume(struct panfrost_device *pfdev)
 {
        int i;
index eb999531ed900b1999de58dc4247d3a70f0c38a0..e3bc63e82843e48183a644e05871dcc3db403400 100644 (file)
@@ -5,6 +5,7 @@
 #define __PANFROST_DEVFREQ_H__
 
 int panfrost_devfreq_init(struct panfrost_device *pfdev);
+void panfrost_devfreq_fini(struct panfrost_device *pfdev);
 
 void panfrost_devfreq_resume(struct panfrost_device *pfdev);
 void panfrost_devfreq_suspend(struct panfrost_device *pfdev);
index ae70200be44a3b50b8c55c1b7ef8341ee3918cfb..44a558c6e17e76c92c3b1f5924718f64ec563ad8 100644 (file)
@@ -547,12 +547,14 @@ static int panfrost_probe(struct platform_device *pdev)
         */
        err = drm_dev_register(ddev, 0);
        if (err < 0)
-               goto err_out1;
+               goto err_out2;
 
        panfrost_gem_shrinker_init(ddev);
 
        return 0;
 
+err_out2:
+       panfrost_devfreq_fini(pfdev);
 err_out1:
        panfrost_device_fini(pfdev);
 err_out0:
@@ -571,6 +573,7 @@ static int panfrost_remove(struct platform_device *pdev)
        pm_runtime_get_sync(pfdev->dev);
        pm_runtime_put_sync_autosuspend(pfdev->dev);
        pm_runtime_disable(pfdev->dev);
+       panfrost_devfreq_fini(pfdev);
        panfrost_device_fini(pfdev);
        drm_dev_put(ddev);
        return 0;