Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm/panfrost: Remove opp table when unloading

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

authored by

Steven Price and committed by
Rob Herring
aa4fffec e21dd290

+11 -1
+6
drivers/gpu/drm/panfrost/panfrost_devfreq.c
··· 160 160 DRM_DEV_ERROR(&pfdev->pdev->dev, "Couldn't initialize GPU devfreq\n"); 161 161 ret = PTR_ERR(pfdev->devfreq.devfreq); 162 162 pfdev->devfreq.devfreq = NULL; 163 + dev_pm_opp_of_remove_table(&pfdev->pdev->dev); 163 164 return ret; 164 165 } 165 166 166 167 return 0; 168 + } 169 + 170 + void panfrost_devfreq_fini(struct panfrost_device *pfdev) 171 + { 172 + dev_pm_opp_of_remove_table(&pfdev->pdev->dev); 167 173 } 168 174 169 175 void panfrost_devfreq_resume(struct panfrost_device *pfdev)
+1
drivers/gpu/drm/panfrost/panfrost_devfreq.h
··· 5 5 #define __PANFROST_DEVFREQ_H__ 6 6 7 7 int panfrost_devfreq_init(struct panfrost_device *pfdev); 8 + void panfrost_devfreq_fini(struct panfrost_device *pfdev); 8 9 9 10 void panfrost_devfreq_resume(struct panfrost_device *pfdev); 10 11 void panfrost_devfreq_suspend(struct panfrost_device *pfdev);
+4 -1
drivers/gpu/drm/panfrost/panfrost_drv.c
··· 547 547 */ 548 548 err = drm_dev_register(ddev, 0); 549 549 if (err < 0) 550 - goto err_out1; 550 + goto err_out2; 551 551 552 552 panfrost_gem_shrinker_init(ddev); 553 553 554 554 return 0; 555 555 556 + err_out2: 557 + panfrost_devfreq_fini(pfdev); 556 558 err_out1: 557 559 panfrost_device_fini(pfdev); 558 560 err_out0: ··· 573 571 pm_runtime_get_sync(pfdev->dev); 574 572 pm_runtime_put_sync_autosuspend(pfdev->dev); 575 573 pm_runtime_disable(pfdev->dev); 574 + panfrost_devfreq_fini(pfdev); 576 575 panfrost_device_fini(pfdev); 577 576 drm_dev_put(ddev); 578 577 return 0;