diff options
author | Tian Tao <tiantao6@hisilicon.com> | 2020-12-07 14:16:17 +0300 |
---|---|---|
committer | Tian Tao <tiantao6@hisilicon.com> | 2020-12-09 03:33:31 +0300 |
commit | 1c1b5bd4cc2d0e00e9ce04d27d20eba0f94fe510 (patch) | |
tree | 13faa35a45e40c1aa60e59d3b15e6bacfb4e2ab2 | |
parent | 13283a241540085269b1f10c5b6590bdffca2bc0 (diff) | |
download | linux-1c1b5bd4cc2d0e00e9ce04d27d20eba0f94fe510.tar.xz |
drm/hisilicon: Use managed mode-config init
Using drmm_mode_config_init() sets up managed release of modesetting
resources.
v2:
Remove the unused structure member variable mode_config_initialized.
Signed-off-by: Tian Tao <tiantao6@hisilicon.com>
Reviewed-by: Thomas Zimmermann <tzimmermann@suse.de>
Link: https://patchwork.freedesktop.org/patch/msgid/1607339778-20460-2-git-send-email-tiantao6@hisilicon.com
-rw-r--r-- | drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c | 14 | ||||
-rw-r--r-- | drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.h | 1 |
2 files changed, 3 insertions, 12 deletions
diff --git a/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c index 3687753dba9a..7f01213d3684 100644 --- a/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c +++ b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c @@ -96,8 +96,9 @@ static int hibmc_kms_init(struct hibmc_drm_private *priv) struct drm_device *dev = &priv->dev; int ret; - drm_mode_config_init(dev); - priv->mode_config_initialized = true; + ret = drmm_mode_config_init(dev); + if (ret) + return ret; dev->mode_config.min_width = 0; dev->mode_config.min_height = 0; @@ -125,14 +126,6 @@ static int hibmc_kms_init(struct hibmc_drm_private *priv) return 0; } -static void hibmc_kms_fini(struct hibmc_drm_private *priv) -{ - if (priv->mode_config_initialized) { - drm_mode_config_cleanup(&priv->dev); - priv->mode_config_initialized = false; - } -} - /* * It can operate in one of three modes: 0, 1 or Sleep. */ @@ -262,7 +255,6 @@ static int hibmc_unload(struct drm_device *dev) drm_atomic_helper_shutdown(dev); pci_disable_msi(dev->pdev); - hibmc_kms_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 a49c10e3ec34..7d263f4d7078 100644 --- a/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.h +++ b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.h @@ -42,7 +42,6 @@ struct hibmc_drm_private { struct drm_crtc crtc; struct drm_encoder encoder; struct hibmc_connector connector; - bool mode_config_initialized; }; static inline struct hibmc_connector *to_hibmc_connector(struct drm_connector *connector) |