2020-12-03 03:12:50

by Tian Tao

[permalink] [raw]
Subject: [PATCH] drm/hisilicon: Use managed VRAM-helper initialization

updated to use drmm_vram_helper_init()

Signed-off-by: Tian Tao <[email protected]>
---
drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c | 1 -
drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.h | 1 -
drivers/gpu/drm/hisilicon/hibmc/hibmc_ttm.c | 19 +++----------------
3 files changed, 3 insertions(+), 18 deletions(-)

diff --git a/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c
index 8020604..5aea2e9 100644
--- a/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c
+++ b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c
@@ -249,7 +249,6 @@ static int hibmc_unload(struct drm_device *dev)

pci_disable_msi(dev->pdev);
hibmc_kms_fini(priv);
- hibmc_mm_fini(priv);
dev->dev_private = NULL;
return 0;
}
diff --git a/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.h b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.h
index 7e0c756..2786de5 100644
--- a/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.h
+++ b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.h
@@ -64,7 +64,6 @@ int hibmc_de_init(struct hibmc_drm_private *priv);
int hibmc_vdac_init(struct hibmc_drm_private *priv);

int hibmc_mm_init(struct hibmc_drm_private *hibmc);
-void hibmc_mm_fini(struct hibmc_drm_private *hibmc);
int hibmc_dumb_create(struct drm_file *file, struct drm_device *dev,
struct drm_mode_create_dumb *args);
int hibmc_ddc_create(struct drm_device *drm_dev, struct hibmc_connector *connector);
diff --git a/drivers/gpu/drm/hisilicon/hibmc/hibmc_ttm.c b/drivers/gpu/drm/hisilicon/hibmc/hibmc_ttm.c
index e84fb81..892d566 100644
--- a/drivers/gpu/drm/hisilicon/hibmc/hibmc_ttm.c
+++ b/drivers/gpu/drm/hisilicon/hibmc/hibmc_ttm.c
@@ -23,15 +23,12 @@

int hibmc_mm_init(struct hibmc_drm_private *hibmc)
{
- struct drm_vram_mm *vmm;
int ret;
struct drm_device *dev = &hibmc->dev;

- vmm = drm_vram_helper_alloc_mm(dev,
- pci_resource_start(dev->pdev, 0),
- hibmc->fb_size);
- if (IS_ERR(vmm)) {
- ret = PTR_ERR(vmm);
+ ret = drmm_vram_helper_init(dev, pci_resource_start(dev->pdev, 0),
+ hibmc->fb_size);
+ if (ret) {
drm_err(dev, "Error initializing VRAM MM; %d\n", ret);
return ret;
}
@@ -39,16 +36,6 @@ int hibmc_mm_init(struct hibmc_drm_private *hibmc)
return 0;
}

-void hibmc_mm_fini(struct hibmc_drm_private *hibmc)
-{
- struct drm_device *dev = &hibmc->dev;
-
- if (!dev->vram_mm)
- return;
-
- drm_vram_helper_release_mm(dev);
-}
-
int hibmc_dumb_create(struct drm_file *file, struct drm_device *dev,
struct drm_mode_create_dumb *args)
{
--
2.7.4


2020-12-03 06:01:13

by Thomas Zimmermann

[permalink] [raw]
Subject: Re: [PATCH] drm/hisilicon: Use managed VRAM-helper initialization

Hi

Am 03.12.20 um 04:09 schrieb Tian Tao:
> updated to use drmm_vram_helper_init()
>
> Signed-off-by: Tian Tao <[email protected]>

Reviewed-by: Thomas Zimmermann <[email protected]>

As a good follow-up patch, I would suggest to get rig of the entire file
hibmc_ttm.c. drmm_vram_helper_init() can be called directly from
hibmc_load(). hibmc_dumb_create() and hibmc_mode_funcs can go to
hibmc_drm_drv.c.

Best regards
Thomas

> ---
> drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c | 1 -
> drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.h | 1 -
> drivers/gpu/drm/hisilicon/hibmc/hibmc_ttm.c | 19 +++----------------
> 3 files changed, 3 insertions(+), 18 deletions(-)
>
> diff --git a/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c
> index 8020604..5aea2e9 100644
> --- a/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c
> +++ b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c
> @@ -249,7 +249,6 @@ static int hibmc_unload(struct drm_device *dev)
>
> pci_disable_msi(dev->pdev);
> hibmc_kms_fini(priv);
> - hibmc_mm_fini(priv);
> dev->dev_private = NULL;
> return 0;
> }
> diff --git a/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.h b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.h
> index 7e0c756..2786de5 100644
> --- a/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.h
> +++ b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.h
> @@ -64,7 +64,6 @@ int hibmc_de_init(struct hibmc_drm_private *priv);
> int hibmc_vdac_init(struct hibmc_drm_private *priv);
>
> int hibmc_mm_init(struct hibmc_drm_private *hibmc);
> -void hibmc_mm_fini(struct hibmc_drm_private *hibmc);
> int hibmc_dumb_create(struct drm_file *file, struct drm_device *dev,
> struct drm_mode_create_dumb *args);
> int hibmc_ddc_create(struct drm_device *drm_dev, struct hibmc_connector *connector);
> diff --git a/drivers/gpu/drm/hisilicon/hibmc/hibmc_ttm.c b/drivers/gpu/drm/hisilicon/hibmc/hibmc_ttm.c
> index e84fb81..892d566 100644
> --- a/drivers/gpu/drm/hisilicon/hibmc/hibmc_ttm.c
> +++ b/drivers/gpu/drm/hisilicon/hibmc/hibmc_ttm.c
> @@ -23,15 +23,12 @@
>
> int hibmc_mm_init(struct hibmc_drm_private *hibmc)
> {
> - struct drm_vram_mm *vmm;
> int ret;
> struct drm_device *dev = &hibmc->dev;
>
> - vmm = drm_vram_helper_alloc_mm(dev,
> - pci_resource_start(dev->pdev, 0),
> - hibmc->fb_size);
> - if (IS_ERR(vmm)) {
> - ret = PTR_ERR(vmm);
> + ret = drmm_vram_helper_init(dev, pci_resource_start(dev->pdev, 0),
> + hibmc->fb_size);
> + if (ret) {
> drm_err(dev, "Error initializing VRAM MM; %d\n", ret);
> return ret;
> }
> @@ -39,16 +36,6 @@ int hibmc_mm_init(struct hibmc_drm_private *hibmc)
> return 0;
> }
>
> -void hibmc_mm_fini(struct hibmc_drm_private *hibmc)
> -{
> - struct drm_device *dev = &hibmc->dev;
> -
> - if (!dev->vram_mm)
> - return;
> -
> - drm_vram_helper_release_mm(dev);
> -}
> -
> int hibmc_dumb_create(struct drm_file *file, struct drm_device *dev,
> struct drm_mode_create_dumb *args)
> {
>

--
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Maxfeldstr. 5, 90409 Nürnberg, Germany
(HRB 36809, AG Nürnberg)
Geschäftsführer: Felix Imendörffer


Attachments:
OpenPGP_signature (855.00 B)
OpenPGP digital signature