From patchwork Mon Oct 25 15:15:29 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 12582167 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 8FD76C433FE for ; Mon, 25 Oct 2021 15:16:31 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 7BF8E60F9D for ; Mon, 25 Oct 2021 15:16:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233971AbhJYPSw (ORCPT ); Mon, 25 Oct 2021 11:18:52 -0400 Received: from new3-smtp.messagingengine.com ([66.111.4.229]:48705 "EHLO new3-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233897AbhJYPSl (ORCPT ); Mon, 25 Oct 2021 11:18:41 -0400 Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailnew.nyi.internal (Postfix) with ESMTP id 7B2E55806C0; Mon, 25 Oct 2021 11:16:18 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute3.internal (MEProxy); Mon, 25 Oct 2021 11:16:18 -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=aINb3yyNPEGy8 1/IksR4f28ybF+VpRvrF3mAjvmMCck=; b=m2TmID25oAKCCRNJ4zWZNB5aWejsb n7WYWtbVGlSbS0dMzMv26gC+9l3Ehzj1obMWdyE0HxGW4wYaOZRZTw3QID9X8hmL xqvP2IQN8PUm/BeQhW6w5hGZwZ3tZWS1tJXdqoQ9uzjn+u9Lw76Ah6E+VmHHN4LR fkK6E/YNGkMKh3B6Fpz4A3sN5p85QttLz2ElZA2z+62sCkfJRJwQTJWT55sgArtf N9wGiVQWtE2LMMccBAQkh6eO3ZHEKHapJUlQvoOQ58iOHIvAIkrZzbRyjKDo7G4z 7oN/ckPA+2s5aEqpwgE3IAAf1zIYRY/PKnxPiq0v6dsgUbJYj6AadW9HQ== 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=aINb3yyNPEGy81/IksR4f28ybF+VpRvrF3mAjvmMCck=; b=QxNL/KMm gNifumTn7jZ7sn7osNTjOBm3g6jfTZLQcPqfKACTlaimUdZHOTUQuBG314n00h3o DF1hY/WuQOEKndIeYbvxaqbbuSdVO3zxoK4bVHzjE7y5ZyCBpxyp8gJqdQgG8v3a cTWDz0IvbMW6tuZUGNtst8qxHnXOEQQKe1lad+N3yScaOtRgmnKlAHizs8Q8E19b LChRUUPOv35KT+X+wFgrYduKWmdW0rUon8YI9ZcL81YY4cCi54T2Zq5JY5ZdiAR7 TLY5LXquoydjcgOjA8bFF+jhdcohvz5nGQ21eHcpfUyPO5S27tgi7ss+yqgIU9w5 5gl3jD+3WbeG6w== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvtddrvdefhedgkeefucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvufffkffojghfggfgsedtkeertdertddtnecuhfhrohhmpeforgigihhm vgcutfhiphgrrhguuceomhgrgihimhgvsegtvghrnhhordhtvggthheqnecuggftrfgrth htvghrnhepvdekleevfeffkeejhfffueelteelfeduieefheduudfggffhhfffheevveeh hedvnecuvehluhhsthgvrhfuihiivgepvdenucfrrghrrghmpehmrghilhhfrhhomhepmh grgihimhgvsegtvghrnhhordhtvggthh X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 25 Oct 2021 11:16:16 -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 , Laurent Pinchart Subject: [PATCH v6 14/21] drm/bridge: sn65dsi83: Switch to devm MIPI-DSI helpers Date: Mon, 25 Oct 2021 17:15:29 +0200 Message-Id: <20211025151536.1048186-15-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 but don't remove its driver. Acked-by: Sam Ravnborg Tested-by: Laurent Pinchart Signed-off-by: Maxime Ripard --- drivers/gpu/drm/bridge/ti-sn65dsi83.c | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/drivers/gpu/drm/bridge/ti-sn65dsi83.c b/drivers/gpu/drm/bridge/ti-sn65dsi83.c index 3bfd07caf8d7..539edd2c19f5 100644 --- a/drivers/gpu/drm/bridge/ti-sn65dsi83.c +++ b/drivers/gpu/drm/bridge/ti-sn65dsi83.c @@ -262,7 +262,7 @@ static int sn65dsi83_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)) { return dev_err_probe(dev, PTR_ERR(dsi), "failed to create dsi device\n"); @@ -274,18 +274,14 @@ static int sn65dsi83_attach(struct drm_bridge *bridge, dsi->format = MIPI_DSI_FMT_RGB888; dsi->mode_flags = MIPI_DSI_MODE_VIDEO | MIPI_DSI_MODE_VIDEO_BURST; - 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; } return drm_bridge_attach(bridge->encoder, ctx->panel_bridge, &ctx->bridge, flags); - -err_dsi_attach: - mipi_dsi_device_unregister(dsi); - return ret; } static void sn65dsi83_detach(struct drm_bridge *bridge) @@ -295,8 +291,6 @@ static void sn65dsi83_detach(struct drm_bridge *bridge) if (!ctx->dsi) return; - mipi_dsi_detach(ctx->dsi); - mipi_dsi_device_unregister(ctx->dsi); ctx->dsi = NULL; }