From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtpout-03.galae.net (smtpout-03.galae.net [185.246.85.4]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 55AA53E2744 for ; Thu, 9 Apr 2026 17:09:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.246.85.4 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775754550; cv=none; b=QKuIVQomOzr3WYoTpah+HoM6USu+dbG/2y5FMHaH9rbLknJT50ZXWNC2rQHTy8U63Lcn7Z2dlQoi6OdU8iKpOuQ8H+ZIIuE5FXFMy8hpg5D79fP4qDJa47oOjptfLwFlknk7FMs8LMv04qqcOvHyFsgkI7LKnC3gALe+IF7Igy0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775754550; c=relaxed/simple; bh=qPId0LWCtAJUauy5dj/KCRDNqeDNfYFXGc79A02aINQ=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=TKLzsMZ8nSU5N3QYrYirmtMyNMnWrLjGl1oVlYDl7G6e3fQHkQjEYkEGeaGoDgFHDvveoyCm6LA3b6fx279KDGUI5+nAaHsw7bXX6vUYzJrcoaSPBGSsVzITNXVL+OUfkPJKgw5VHPsWTooPvb5ksMidztZch/TzbwHdgOKQ9/0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=OcWU6p4E; arc=none smtp.client-ip=185.246.85.4 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="OcWU6p4E" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-03.galae.net (Postfix) with ESMTPS id A90004E429AA; Thu, 9 Apr 2026 17:09:07 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id 7B402603E4; Thu, 9 Apr 2026 17:09:07 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id 4A52E104501A3; Thu, 9 Apr 2026 19:09:02 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1775754545; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=PUrev3OwtF7+aQkaLQNcxHy9DAd6gNcwgyZHwoDRdgs=; b=OcWU6p4Eq4OVCUQGSq0OR24F3SV9U9aoJdhjwYfqGnATABnWmw3hYwQNxsrBWr7LFEN0wY +zjRqf2kiNbPo/mU9nW61kDj5CwC7jaSAc5Gy3rkPy5Fj6M7a6/HMc++qZJDBCIVp5SsPv dJE7aBu08Dc+AWujlXmml9BdfZqEFleNP2qMh7AKwPjvG6avstJ/DraY1cnCzO32nFb0hm MbWiVfy6jfzGcJ3GtebCNIHq3TMe8Qh8ej8R1eIvUEP/2XYnx7UGtypJKwFS4d41ddVztJ uP4X8e1sExgc0UDbrUrd84ESpva7V1NRlz9nbV2ut6fF2cmdpdkXxjNkFsekMA== From: Kory Maincent Date: Thu, 09 Apr 2026 19:08:20 +0200 Subject: [PATCH RFC 04/12] drm/i915/display: Switch to drmm_mode_config_init() and drop manual cleanup Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20260409-feat_link_cap-v1-4-7069e8199ce2@bootlin.com> References: <20260409-feat_link_cap-v1-0-7069e8199ce2@bootlin.com> In-Reply-To: <20260409-feat_link_cap-v1-0-7069e8199ce2@bootlin.com> To: Jani Nikula , Rodrigo Vivi , Joonas Lahtinen , Tvrtko Ursulin , David Airlie , Simona Vetter , Dave Airlie , Jesse Barnes , Eric Anholt , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Chun-Kuang Hu , Philipp Zabel , Matthias Brugger , AngeloGioacchino Del Regno , Chris Wilson Cc: Thomas Petazzoni , Mark Yacoub , Sean Paul , Louis Chauvet , intel-gfx@lists.freedesktop.org, intel-xe@lists.freedesktop.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, linux-mediatek@lists.infradead.org, linux-arm-kernel@lists.infradead.org, Simona Vetter , Kory Maincent X-Mailer: b4 0.14-dev-d4707 X-Last-TLS-Session-Version: TLSv1.3 Replace drm_mode_config_init() with drmm_mode_config_init() in intel_mode_config_init(). The managed variant automatically registers drm_mode_config_cleanup() with devres, so drivers must no longer call it directly. Since intel_mode_config_cleanup() was solely a wrapper combining intel_atomic_global_obj_cleanup() and drm_mode_config_cleanup(), and the latter is now handled by DRM core, remove it entirely. Instead, register intel_atomic_global_obj_cleanup() as a devres action so it still runs just before drm_mode_config_cleanup() during teardown, preserving the correct cleanup ordering. Change intel_mode_config_init() to return int to propagate any error from drmm_mode_config_init(). Signed-off-by: Kory Maincent --- .../gpu/drm/i915/display/intel_display_driver.c | 37 ++++++++++++++-------- 1 file changed, 24 insertions(+), 13 deletions(-) diff --git a/drivers/gpu/drm/i915/display/intel_display_driver.c b/drivers/gpu/drm/i915/display/intel_display_driver.c index 23bfecc983e8d..d02393053cef4 100644 --- a/drivers/gpu/drm/i915/display/intel_display_driver.c +++ b/drivers/gpu/drm/i915/display/intel_display_driver.c @@ -12,6 +12,7 @@ #include #include #include +#include #include #include #include @@ -48,6 +49,7 @@ #include "intel_fbdev.h" #include "intel_fdi.h" #include "intel_flipq.h" +#include "intel_global_state.h" #include "intel_gmbus.h" #include "intel_hdcp.h" #include "intel_hotplug.h" @@ -111,13 +113,28 @@ static const struct drm_mode_config_helper_funcs intel_mode_config_funcs = { .atomic_commit_setup = drm_dp_mst_atomic_setup_commit, }; -static void intel_mode_config_init(struct intel_display *display) +static void intel_atomic_global_obj_cleanup_action(struct drm_device *drm, void *data) +{ + intel_atomic_global_obj_cleanup((struct intel_display *)data); +} + +static int intel_mode_config_init(struct intel_display *display) { struct drm_mode_config *mode_config = &display->drm->mode_config; + int ret; + + ret = drmm_mode_config_init(display->drm); + if (ret) + return ret; - drm_mode_config_init(display->drm); INIT_LIST_HEAD(&display->global.obj_list); + ret = drmm_add_action_or_reset(display->drm, + intel_atomic_global_obj_cleanup_action, + display); + if (ret) + return ret; + mode_config->min_width = 0; mode_config->min_height = 0; @@ -148,12 +165,8 @@ static void intel_mode_config_init(struct intel_display *display) } intel_cursor_mode_config_init(display); -} -static void intel_mode_config_cleanup(struct intel_display *display) -{ - intel_atomic_global_obj_cleanup(display); - drm_mode_config_cleanup(display->drm); + return 0; } static void intel_plane_possible_crtcs_init(struct intel_display *display) @@ -255,7 +268,9 @@ int intel_display_driver_probe_noirq(struct intel_display *display) intel_dmc_init(display); - intel_mode_config_init(display); + ret = intel_mode_config_init(display); + if (ret) + goto cleanup_wq_unordered; ret = intel_cdclk_init(display); if (ret) @@ -456,7 +471,7 @@ int intel_display_driver_probe_nogem(struct intel_display *display) ret = intel_crtc_init(display); if (ret) - goto err_mode_config; + return ret; intel_plane_possible_crtcs_init(display); intel_dpll_init(display); @@ -497,8 +512,6 @@ int intel_display_driver_probe_nogem(struct intel_display *display) err_hdcp: intel_hdcp_component_fini(display); -err_mode_config: - intel_mode_config_cleanup(display); return ret; } @@ -618,8 +631,6 @@ void intel_display_driver_remove_noirq(struct intel_display *display) intel_hdcp_component_fini(display); - intel_mode_config_cleanup(display); - intel_dp_tunnel_mgr_cleanup(display); intel_overlay_cleanup(display); -- 2.43.0