From patchwork Mon Oct 25 15:15:33 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 12582175 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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 80DDAC433F5 for ; Mon, 25 Oct 2021 15:17:00 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 6C1E460F9B for ; Mon, 25 Oct 2021 15:17:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233962AbhJYPTV (ORCPT ); Mon, 25 Oct 2021 11:19:21 -0400 Received: from new3-smtp.messagingengine.com ([66.111.4.229]:50737 "EHLO new3-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233958AbhJYPSu (ORCPT ); Mon, 25 Oct 2021 11:18:50 -0400 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailnew.nyi.internal (Postfix) with ESMTP id 9EF3B5806C6; Mon, 25 Oct 2021 11:16:27 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute4.internal (MEProxy); Mon, 25 Oct 2021 11:16:27 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cerno.tech; h= from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; s=fm1; bh=/QMqV2xNvARcz 7m7ICXmWasIz89maW9VgPKXP0jtMvU=; b=coO6P4VH5A8Ej0CNGlnVd3ln37LGX E0k9sNt6J5hnux9DwmVPfmhaGYQ/BRGbjOMRqfdWaMa6M6AqfNjeZcextg2/lZHn knxCpg1tsIIrZLmSVXRvlgZI5OILJTAAWlrq1ZD/lIlNxgkZXMCkPUb/Pn+TYZPW Poj7a3qKRc7VmOUEeqB6dsDW9dtBrmSVRksUbmk1/7yN15EbzSjlZ3y+rQMTr8gk STfFE55JRWnw58g8DiA1rEqLgGa16cFeFiUpLt9o/fH3USuVRgtP4ix/6vLu2tWZ JTqdecLViLz9proSeiWz5vDY98kQA2y3vkmeDDarzYP332D+6M1/H96IA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:date:from :in-reply-to:message-id:mime-version:references:subject:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm1; bh=/QMqV2xNvARcz7m7ICXmWasIz89maW9VgPKXP0jtMvU=; b=dUJIuxky uxiMQam3PPl3OgbRmqB4uM8VLCiUEBoDJ0UU4MNVSwGyxaeNuMo2PHLos8ljH9mA ODyxgkpdsKP8fnA1ozfGIv4159Nntar2JBL4JT626QIDQwNqLACYmsXs69AsIhBa UQTnDfEigTtJ/sB9KLPKQAh/S6e1CBbBnkcP70zhXjSh7slw0quzbxk1KcHmtLwY Eq9xsH+29/kECouLbp3FLi/Ub+cnP+Wj/WeVz6kW0ULMcW4vV7mVuPYZtwFDubhv saS1SelAd9Uq9FFDIeSiQ6uVEsfQHk012iq5ej2DKfiSq7dLEBlwA+KUuD4CG6x1 r9Yd5X6Bx9b/Nw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvtddrvdefhedgkeefucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvufffkffojghfggfgsedtkeertdertddtnecuhfhrohhmpeforgigihhm vgcutfhiphgrrhguuceomhgrgihimhgvsegtvghrnhhordhtvggthheqnecuggftrfgrth htvghrnhepvdekleevfeffkeejhfffueelteelfeduieefheduudfggffhhfffheevveeh hedvnecuvehluhhsthgvrhfuihiivgepieenucfrrghrrghmpehmrghilhhfrhhomhepmh grgihimhgvsegtvghrnhhordhtvggthh X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 25 Oct 2021 11:16:26 -0400 (EDT) From: Maxime Ripard To: Thierry Reding , Laurent Pinchart , Andrzej Hajda , Robert Foss , Jonas Karlman , Daniel Vetter , David Airlie , Maarten Lankhorst , Thomas Zimmermann , Maxime Ripard , Jernej Skrabec , Sam Ravnborg , Neil Armstrong Cc: Seung-Woo Kim , linux-arm-msm@vger.kernel.org, Joonyoung Shim , Rob Clark , Tian Tao , Chen Feng , Xinwei Kong , Kyungmin Park , linux-samsung-soc@vger.kernel.org, Xinliang Liu , John Stultz , linux-kernel@vger.kernel.org, Inki Dae , dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, Sean Paul Subject: [PATCH v6 18/21] drm/bridge: tc358775: Switch to devm MIPI-DSI helpers Date: Mon, 25 Oct 2021 17:15:33 +0200 Message-Id: <20211025151536.1048186-19-maxime@cerno.tech> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211025151536.1048186-1-maxime@cerno.tech> References: <20211025151536.1048186-1-maxime@cerno.tech> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org Let's switch to the new devm MIPI-DSI function to register and attach our secondary device. This also avoids leaking the device when we detach the bridge. Acked-by: Sam Ravnborg Signed-off-by: Maxime Ripard --- drivers/gpu/drm/bridge/tc358775.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/drivers/gpu/drm/bridge/tc358775.c b/drivers/gpu/drm/bridge/tc358775.c index 2272adcc5b4a..35e66d1b6456 100644 --- a/drivers/gpu/drm/bridge/tc358775.c +++ b/drivers/gpu/drm/bridge/tc358775.c @@ -610,11 +610,10 @@ static int tc_bridge_attach(struct drm_bridge *bridge, return -EPROBE_DEFER; } - dsi = mipi_dsi_device_register_full(host, &info); + dsi = devm_mipi_dsi_device_register_full(dev, host, &info); if (IS_ERR(dsi)) { dev_err(dev, "failed to create dsi device\n"); - ret = PTR_ERR(dsi); - goto err_dsi_device; + return PTR_ERR(dsi); } tc->dsi = dsi; @@ -623,19 +622,15 @@ static int tc_bridge_attach(struct drm_bridge *bridge, dsi->format = MIPI_DSI_FMT_RGB888; dsi->mode_flags = MIPI_DSI_MODE_VIDEO; - ret = mipi_dsi_attach(dsi); + ret = devm_mipi_dsi_attach(dev, dsi); if (ret < 0) { dev_err(dev, "failed to attach dsi to host\n"); - goto err_dsi_attach; + return ret; } /* Attach the panel-bridge to the dsi bridge */ return drm_bridge_attach(bridge->encoder, tc->panel_bridge, &tc->bridge, flags); -err_dsi_attach: - mipi_dsi_device_unregister(dsi); -err_dsi_device: - return ret; } static const struct drm_bridge_funcs tc_bridge_funcs = {