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: 64544 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp1755705wrd; Mon, 6 Mar 2023 02:10:47 -0800 (PST) X-Google-Smtp-Source: AK7set/890c4ID6LjzD5KrsSL5tqU4y3tdfDFeIY8t13L0a2L+7Frc9rS4OlpeiWEnoVQkvkaqkF X-Received: by 2002:a05:6402:383:b0:4ad:1e35:771f with SMTP id o3-20020a056402038300b004ad1e35771fmr8988967edv.35.1678097447069; Mon, 06 Mar 2023 02:10:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1678097447; cv=none; d=google.com; s=arc-20160816; b=dYLyunx5aDedipZ1bnefidMnJ+gGUKtFAaFxQBeUcJRH7aClBkp1Sej3i1K9ZdnByr ZyCAmcirV6xYg8znYundMnBs2ye991UzjvRRTmKB6uEggVSzFls/jaO4inguGrPEgLLy JfClkkdeVHO0K4T/V28s12rBeSXRRYRNbm+wnY/ujfhk12j01118N/y9+pinP2zXdHTz 1eDKd25uKMce/toQgeItOqWHYQBVM6CZZSTTbDOoKalKncIqAcer9HKjZBJs6I+SvJOM H+5WVlMtbQhGFPjY6rda/ssTo4CmlZNrp/fd4OTvcxc3OpbtXoPUDkxfADk1wnHEGVvU ePPQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=5Zsu1W/z3JDiobzIQrJRFmRWQh4/4G+n5NfLenBJUu8=; b=hQZcnG6OghsjHElpoN9NtsrEDwflLISXhulGpGZsShEMJxzPB/AM6oySeypFe6ibMe dnyS5GB3JBH4d1zIe0Xn0fy/t+V13Epyct1cQHHwTWTrRFjRss4ljV32SgVq046LDPPY GigTFohTNt9SNv5E//WRP3A3lFMnpSIuSgzTdYdr7cf1CMDCbFcc/AqOkLRCAiDX01z1 1ffyI/LADJfX/LhcD+zpdlBNJv87MV5iPqFyJaiZBhQ8TQ43dsYbpSq+BPL4PrkIf9n1 aZg/6V52BaILYOTr3XrhrwlEoFeH4o1aPKCjDesGYIrSHknTDz0G3ylXmz6h//69rLiJ cOvg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=IOQ1dpwg; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b4-20020aa7d484000000b004acc575090fsi9845940edr.36.2023.03.06.02.10.22; Mon, 06 Mar 2023 02:10:47 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=IOQ1dpwg; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230325AbjCFKJb (ORCPT + 99 others); Mon, 6 Mar 2023 05:09:31 -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 X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1759612708722117534?= X-GMAIL-MSGID: =?utf-8?q?1759612708722117534?= 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);