2020-12-07 11:20:09

by Tian Tao

[permalink] [raw]
Subject: [PATCH drm/hisilicon v2 0/2] Code refactoring

patch #1 is used drmm_mode_config_init() to do code refactoring.
patch #2 is deleted unused variable ‘priv’ to avoid warning.

Changes since v1:
patch #1 is removed the unused structure member
variable mode_config_initialized.

Tian Tao (2):
drm/hisilicon: Use managed mode-config init
drm/hisilicon: Delete unused local parameters

drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c | 19 ++++---------------
drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.h | 1 -
2 files changed, 4 insertions(+), 16 deletions(-)

--
2.7.4


2020-12-07 11:20:36

by Tian Tao

[permalink] [raw]
Subject: [PATCH drm/hisilicon v2 1/2] 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 <[email protected]>
Reviewed-by: Thomas Zimmermann <[email protected]>
---
drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c | 14 +++-----------
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 3687753..7f01213 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 a49c10e..7d263f4 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)
--
2.7.4

2020-12-07 11:21:17

by Tian Tao

[permalink] [raw]
Subject: [PATCH drm/hisilicon v2 2/2] drm/hisilicon: Delete unused local parameters

delete unused variable ‘priv’ to avoid warning.

Signed-off-by: Tian Tao <[email protected]>
Reviewed-by: Thomas Zimmermann <[email protected]>
---
drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c
index 7f01213..7e91ef1 100644
--- a/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c
+++ b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c
@@ -250,12 +250,9 @@ static int hibmc_hw_init(struct hibmc_drm_private *priv)

static int hibmc_unload(struct drm_device *dev)
{
- struct hibmc_drm_private *priv = to_hibmc_drm_private(dev);
-
drm_atomic_helper_shutdown(dev);
-
pci_disable_msi(dev->pdev);
- dev->dev_private = NULL;
+
return 0;
}

--
2.7.4