[3/6] drm/ast: Use managed VRAM-helper initialization
diff mbox series

Message ID 20200708074912.25422-4-tzimmermann@suse.de
State New
Headers show
Series
  • drm/ast: Managed MM
Related show

Commit Message

Thomas Zimmermann July 8, 2020, 7:49 a.m. UTC
As a first step to managed MM code in ast, switch over VRAM MM helpers.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
---
 drivers/gpu/drm/ast/ast_mm.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

Comments

Sam Ravnborg July 8, 2020, 5:20 p.m. UTC | #1
On Wed, Jul 08, 2020 at 09:49:09AM +0200, Thomas Zimmermann wrote:
> As a first step to managed MM code in ast, switch over VRAM MM helpers.
> 
> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
> ---
>  drivers/gpu/drm/ast/ast_mm.c | 7 ++-----
>  1 file changed, 2 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/gpu/drm/ast/ast_mm.c b/drivers/gpu/drm/ast/ast_mm.c
> index 9c3788a4c1c5..c0bbcfed9c43 100644
> --- a/drivers/gpu/drm/ast/ast_mm.c
> +++ b/drivers/gpu/drm/ast/ast_mm.c
> @@ -39,9 +39,8 @@ int ast_mm_init(struct ast_private *ast)
>  	int ret;
>  	struct drm_device *dev = ast->dev;
>  
> -	vmm = drm_vram_helper_alloc_mm(
> -		dev, pci_resource_start(dev->pdev, 0),
> -		ast->vram_size);
> +	vmm = drmm_vram_helper_alloc_mm(dev, pci_resource_start(dev->pdev, 0),
> +					ast->vram_size);
>  	if (IS_ERR(vmm)) {
>  		ret = PTR_ERR(vmm);
>  		drm_err(dev, "Error initializing VRAM MM; %d\n", ret);

This would be a little simpler if drmm_vram_helper_alloc_mm() return an
int error code as suggested in previous patch.

	Sam

> @@ -60,8 +59,6 @@ void ast_mm_fini(struct ast_private *ast)
>  {
>  	struct drm_device *dev = ast->dev;
>  
> -	drm_vram_helper_release_mm(dev);
> -
>  	arch_phys_wc_del(ast->fb_mtrr);
>  	arch_io_free_memtype_wc(pci_resource_start(dev->pdev, 0),
>  				pci_resource_len(dev->pdev, 0));
> -- 
> 2.27.0

Patch
diff mbox series

diff --git a/drivers/gpu/drm/ast/ast_mm.c b/drivers/gpu/drm/ast/ast_mm.c
index 9c3788a4c1c5..c0bbcfed9c43 100644
--- a/drivers/gpu/drm/ast/ast_mm.c
+++ b/drivers/gpu/drm/ast/ast_mm.c
@@ -39,9 +39,8 @@  int ast_mm_init(struct ast_private *ast)
 	int ret;
 	struct drm_device *dev = ast->dev;
 
-	vmm = drm_vram_helper_alloc_mm(
-		dev, pci_resource_start(dev->pdev, 0),
-		ast->vram_size);
+	vmm = drmm_vram_helper_alloc_mm(dev, pci_resource_start(dev->pdev, 0),
+					ast->vram_size);
 	if (IS_ERR(vmm)) {
 		ret = PTR_ERR(vmm);
 		drm_err(dev, "Error initializing VRAM MM; %d\n", ret);
@@ -60,8 +59,6 @@  void ast_mm_fini(struct ast_private *ast)
 {
 	struct drm_device *dev = ast->dev;
 
-	drm_vram_helper_release_mm(dev);
-
 	arch_phys_wc_del(ast->fb_mtrr);
 	arch_io_free_memtype_wc(pci_resource_start(dev->pdev, 0),
 				pci_resource_len(dev->pdev, 0));