From: Johan Hovold <johan+linaro@kernel.org>
To: Rob Clark <robdclark@gmail.com>,
Abhinav Kumar <quic_abhinavk@quicinc.com>,
Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Cc: Sean Paul <sean@poorly.run>, David Airlie <airlied@gmail.com>,
Daniel Vetter <daniel@ffwll.ch>,
linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org,
freedreno@lists.freedesktop.org, linux-kernel@vger.kernel.org,
Johan Hovold <johan+linaro@kernel.org>
Subject: [PATCH 09/10] drm/msm: use drmm_mode_config_init()
Date: Mon, 6 Mar 2023 11:07:21 +0100 [thread overview]
Message-ID: <20230306100722.28485-10-johan+linaro@kernel.org> (raw)
In-Reply-To: <20230306100722.28485-1-johan+linaro@kernel.org>
Switch to using drmm_mode_config_init() so that the mode config is
released when the last reference to the DRM device is dropped rather
than unconditionally at unbind() (which may be too soon).
Signed-off-by: Johan Hovold <johan+linaro@kernel.org>
---
drivers/gpu/drm/msm/msm_drv.c | 11 +++++------
1 file changed, 5 insertions(+), 6 deletions(-)
diff --git a/drivers/gpu/drm/msm/msm_drv.c b/drivers/gpu/drm/msm/msm_drv.c
index 73c597565f99..ade17947d1e5 100644
--- a/drivers/gpu/drm/msm/msm_drv.c
+++ b/drivers/gpu/drm/msm/msm_drv.c
@@ -247,8 +247,6 @@ static int msm_drm_uninit(struct device *dev)
if (kms)
msm_disp_snapshot_destroy(ddev);
- drm_mode_config_cleanup(ddev);
-
for (i = 0; i < priv->num_bridges; i++)
drm_bridge_remove(priv->bridges[i]);
priv->num_bridges = 0;
@@ -454,11 +452,13 @@ static int msm_drm_init(struct device *dev, const struct drm_driver *drv)
might_lock(&priv->lru.lock);
fs_reclaim_release(GFP_KERNEL);
- drm_mode_config_init(ddev);
+ ret = drmm_mode_config_init(ddev);
+ if (ret)
+ goto err_destroy_wq;
ret = msm_init_vram(ddev);
if (ret)
- goto err_cleanup_mode_config;
+ goto err_destroy_wq;
/* Bind all our sub-components: */
ret = component_bind_all(dev, ddev);
@@ -563,8 +563,7 @@ static int msm_drm_init(struct device *dev, const struct drm_driver *drv)
err_deinit_vram:
msm_deinit_vram(ddev);
-err_cleanup_mode_config:
- drm_mode_config_cleanup(ddev);
+err_destroy_wq:
destroy_workqueue(priv->wq);
err_put_dev:
drm_dev_put(ddev);
--
2.39.2
WARNING: multiple messages have this Message-ID (diff)
From: Johan Hovold <johan+linaro@kernel.org>
To: Rob Clark <robdclark@gmail.com>,
Abhinav Kumar <quic_abhinavk@quicinc.com>,
Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Cc: Sean Paul <sean@poorly.run>,
freedreno@lists.freedesktop.org, linux-kernel@vger.kernel.org,
dri-devel@lists.freedesktop.org, linux-arm-msm@vger.kernel.org,
Johan Hovold <johan+linaro@kernel.org>
Subject: [PATCH 09/10] drm/msm: use drmm_mode_config_init()
Date: Mon, 6 Mar 2023 11:07:21 +0100 [thread overview]
Message-ID: <20230306100722.28485-10-johan+linaro@kernel.org> (raw)
In-Reply-To: <20230306100722.28485-1-johan+linaro@kernel.org>
Switch to using drmm_mode_config_init() so that the mode config is
released when the last reference to the DRM device is dropped rather
than unconditionally at unbind() (which may be too soon).
Signed-off-by: Johan Hovold <johan+linaro@kernel.org>
---
drivers/gpu/drm/msm/msm_drv.c | 11 +++++------
1 file changed, 5 insertions(+), 6 deletions(-)
diff --git a/drivers/gpu/drm/msm/msm_drv.c b/drivers/gpu/drm/msm/msm_drv.c
index 73c597565f99..ade17947d1e5 100644
--- a/drivers/gpu/drm/msm/msm_drv.c
+++ b/drivers/gpu/drm/msm/msm_drv.c
@@ -247,8 +247,6 @@ static int msm_drm_uninit(struct device *dev)
if (kms)
msm_disp_snapshot_destroy(ddev);
- drm_mode_config_cleanup(ddev);
-
for (i = 0; i < priv->num_bridges; i++)
drm_bridge_remove(priv->bridges[i]);
priv->num_bridges = 0;
@@ -454,11 +452,13 @@ static int msm_drm_init(struct device *dev, const struct drm_driver *drv)
might_lock(&priv->lru.lock);
fs_reclaim_release(GFP_KERNEL);
- drm_mode_config_init(ddev);
+ ret = drmm_mode_config_init(ddev);
+ if (ret)
+ goto err_destroy_wq;
ret = msm_init_vram(ddev);
if (ret)
- goto err_cleanup_mode_config;
+ goto err_destroy_wq;
/* Bind all our sub-components: */
ret = component_bind_all(dev, ddev);
@@ -563,8 +563,7 @@ static int msm_drm_init(struct device *dev, const struct drm_driver *drv)
err_deinit_vram:
msm_deinit_vram(ddev);
-err_cleanup_mode_config:
- drm_mode_config_cleanup(ddev);
+err_destroy_wq:
destroy_workqueue(priv->wq);
err_put_dev:
drm_dev_put(ddev);
--
2.39.2
next prev parent reply other threads:[~2023-03-06 10:09 UTC|newest]
Thread overview: 56+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-06 10:07 [PATCH 00/10] drm/msm: fix bind error handling Johan Hovold
2023-03-06 10:07 ` Johan Hovold
2023-03-06 10:07 ` [PATCH 01/10] Revert "drm/msm: Add missing check and destroy for alloc_ordered_workqueue" Johan Hovold
2023-03-06 10:07 ` Johan Hovold
2023-03-28 12:49 ` Dmitry Baryshkov
2023-03-28 12:49 ` Dmitry Baryshkov
2023-03-06 10:07 ` [PATCH 02/10] Revert "drm/msm: Fix failure paths in msm_drm_init()" Johan Hovold
2023-03-06 10:07 ` Johan Hovold
2023-03-28 12:49 ` Dmitry Baryshkov
2023-03-28 12:49 ` Dmitry Baryshkov
2023-03-06 10:07 ` [PATCH 03/10] drm/msm: fix NULL-deref on snapshot tear down Johan Hovold
2023-03-06 10:07 ` Johan Hovold
2023-03-21 15:06 ` Dmitry Baryshkov
2023-03-21 15:06 ` Dmitry Baryshkov
2023-03-06 10:07 ` [PATCH 04/10] drm/msm: fix NULL-deref on irq uninstall Johan Hovold
2023-03-06 10:07 ` Johan Hovold
2023-03-21 15:17 ` Dmitry Baryshkov
2023-03-21 15:17 ` Dmitry Baryshkov
2023-03-06 10:07 ` [PATCH 05/10] drm/msm: fix drm device leak on bind errors Johan Hovold
2023-03-06 10:07 ` Johan Hovold
2023-03-21 14:54 ` Dmitry Baryshkov
2023-03-21 14:54 ` Dmitry Baryshkov
2023-03-22 7:47 ` Johan Hovold
2023-03-22 7:47 ` Johan Hovold
2023-03-24 22:04 ` Dmitry Baryshkov
2023-03-24 22:04 ` Dmitry Baryshkov
2023-03-06 10:07 ` [PATCH 06/10] drm/msm: fix vram " Johan Hovold
2023-03-06 10:07 ` Johan Hovold
2023-03-24 22:06 ` Dmitry Baryshkov
2023-03-24 22:06 ` Dmitry Baryshkov
2023-03-06 10:07 ` [PATCH 07/10] drm/msm: fix missing wq allocation error handling Johan Hovold
2023-03-06 10:07 ` Johan Hovold
2023-03-28 12:50 ` Dmitry Baryshkov
2023-03-28 12:50 ` Dmitry Baryshkov
2023-03-06 10:07 ` [PATCH 08/10] drm/msm: fix workqueue leak on bind errors Johan Hovold
2023-03-06 10:07 ` Johan Hovold
2023-03-28 12:50 ` Dmitry Baryshkov
2023-03-28 12:50 ` Dmitry Baryshkov
2023-03-06 10:07 ` Johan Hovold [this message]
2023-03-06 10:07 ` [PATCH 09/10] drm/msm: use drmm_mode_config_init() Johan Hovold
2023-03-06 12:38 ` Dmitry Baryshkov
2023-03-06 12:38 ` Dmitry Baryshkov
2023-03-06 13:31 ` Johan Hovold
2023-03-06 13:31 ` Johan Hovold
2023-03-06 10:07 ` [PATCH 10/10] drm/msm: move include directive Johan Hovold
2023-03-06 10:07 ` Johan Hovold
2023-03-21 14:43 ` Dmitry Baryshkov
2023-03-21 14:43 ` Dmitry Baryshkov
2023-03-21 13:02 ` [PATCH 00/10] drm/msm: fix bind error handling Johan Hovold
2023-03-21 13:02 ` Johan Hovold
2023-03-21 15:21 ` Dmitry Baryshkov
2023-03-21 15:21 ` Dmitry Baryshkov
2023-03-22 7:54 ` Johan Hovold
2023-03-22 7:54 ` Johan Hovold
2023-03-28 22:37 ` Dmitry Baryshkov
2023-03-28 22:37 ` Dmitry Baryshkov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230306100722.28485-10-johan+linaro@kernel.org \
--to=johan+linaro@kernel.org \
--cc=airlied@gmail.com \
--cc=daniel@ffwll.ch \
--cc=dmitry.baryshkov@linaro.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=freedreno@lists.freedesktop.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=quic_abhinavk@quicinc.com \
--cc=robdclark@gmail.com \
--cc=sean@poorly.run \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.