From patchwork Mon Mar 6 10:07:21 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johan Hovold X-Patchwork-Id: 13160804 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3B431C6FD19 for ; Mon, 6 Mar 2023 10:09:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230300AbjCFKJ0 (ORCPT ); Mon, 6 Mar 2023 05:09:26 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60620 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230281AbjCFKJW (ORCPT ); Mon, 6 Mar 2023 05:09:22 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8A84E12851; Mon, 6 Mar 2023 02:09:20 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 0937260DCF; Mon, 6 Mar 2023 10:09:20 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0204BC43443; Mon, 6 Mar 2023 10:09:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1678097359; bh=3O2+vKPnLHdh79mUXLHW8Z5Q6SqDEjWRNnKKiIQoTyo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IOQ1dpwgPoDXO4aiBJSjYqIBjjTrJvx4ZM6BOucb21+jO367iDOtXc9uMsB2xp22s 4hx3KBEAws9s2wc9vNLId50VtSst4NzGH9V7rJvoFS/A11MUBW02HA+0jHS3yCsr8F x8Y/aK2QG7EHznQ7PU5t4uq4USyZh2NMntJ5LgVYZsEDIuyDW2VQ2sL29UXYFQ/0rl zV0hOYaV8DkkUePYi0FA1WuOr3B40kaUOBF4TREIf44sN1/mBHKdUAmbiO7z1rcTpv XhMP/mfQ5RzYfMB5YoMdxx3xgvawGJmdcqDNPZP6M1+SgwsTs8rBSa9tc5pIioox8j 7eXa/DguDGy/w== Received: from johan by xi.lan with local (Exim 4.94.2) (envelope-from ) id 1pZ7n5-0007Qx-NB; Mon, 06 Mar 2023 11:09:59 +0100 From: Johan Hovold To: Rob Clark , Abhinav Kumar , Dmitry Baryshkov Cc: Sean Paul , David Airlie , Daniel Vetter , linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, linux-kernel@vger.kernel.org, Johan Hovold Subject: [PATCH 09/10] drm/msm: use drmm_mode_config_init() Date: Mon, 6 Mar 2023 11:07:21 +0100 Message-Id: <20230306100722.28485-10-johan+linaro@kernel.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230306100722.28485-1-johan+linaro@kernel.org> References: <20230306100722.28485-1-johan+linaro@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.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 --- 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);