Commit 1c1b5bd4 authored by Tian Tao's avatar Tian Tao

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: default avatarTian Tao <tiantao6@hisilicon.com>
Reviewed-by: default avatarThomas Zimmermann <tzimmermann@suse.de>
Link: https://patchwork.freedesktop.org/patch/msgid/1607339778-20460-2-git-send-email-tiantao6@hisilicon.com
parent 13283a24
...@@ -96,8 +96,9 @@ static int hibmc_kms_init(struct hibmc_drm_private *priv) ...@@ -96,8 +96,9 @@ static int hibmc_kms_init(struct hibmc_drm_private *priv)
struct drm_device *dev = &priv->dev; struct drm_device *dev = &priv->dev;
int ret; int ret;
drm_mode_config_init(dev); ret = drmm_mode_config_init(dev);
priv->mode_config_initialized = true; if (ret)
return ret;
dev->mode_config.min_width = 0; dev->mode_config.min_width = 0;
dev->mode_config.min_height = 0; dev->mode_config.min_height = 0;
...@@ -125,14 +126,6 @@ static int hibmc_kms_init(struct hibmc_drm_private *priv) ...@@ -125,14 +126,6 @@ static int hibmc_kms_init(struct hibmc_drm_private *priv)
return 0; 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. * It can operate in one of three modes: 0, 1 or Sleep.
*/ */
...@@ -262,7 +255,6 @@ static int hibmc_unload(struct drm_device *dev) ...@@ -262,7 +255,6 @@ static int hibmc_unload(struct drm_device *dev)
drm_atomic_helper_shutdown(dev); drm_atomic_helper_shutdown(dev);
pci_disable_msi(dev->pdev); pci_disable_msi(dev->pdev);
hibmc_kms_fini(priv);
dev->dev_private = NULL; dev->dev_private = NULL;
return 0; return 0;
} }
......
...@@ -42,7 +42,6 @@ struct hibmc_drm_private { ...@@ -42,7 +42,6 @@ struct hibmc_drm_private {
struct drm_crtc crtc; struct drm_crtc crtc;
struct drm_encoder encoder; struct drm_encoder encoder;
struct hibmc_connector connector; struct hibmc_connector connector;
bool mode_config_initialized;
}; };
static inline struct hibmc_connector *to_hibmc_connector(struct drm_connector *connector) static inline struct hibmc_connector *to_hibmc_connector(struct drm_connector *connector)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment