From patchwork Thu Oct 21 07:39:37 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 12574159 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 41421C4332F for ; Thu, 21 Oct 2021 07:41:18 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 2BBF8610CF for ; Thu, 21 Oct 2021 07:41:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231667AbhJUHnc (ORCPT ); Thu, 21 Oct 2021 03:43:32 -0400 Received: from wnew3-smtp.messagingengine.com ([64.147.123.17]:53023 "EHLO wnew3-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231628AbhJUHnC (ORCPT ); Thu, 21 Oct 2021 03:43:02 -0400 Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailnew.west.internal (Postfix) with ESMTP id B40312B0134C; Thu, 21 Oct 2021 03:40:44 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute6.internal (MEProxy); Thu, 21 Oct 2021 03:40:46 -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=iaT5PVQQV1J3N O3ZCJQqw6ZfLRU5QGqUsJkfrgMTcgM=; b=QA2AfUgJTN6Odfzl/Os8U1ZwheHj+ +VCJ/6g0ff+Xf9V/vdxJcVJEcxaJprwUt7y11VxUpI3i8/PaDfQpapAXlTGnzcni Jf5GWuWjblhxYBQ3zNAjZIkwMeq1uIRZ+E0PImXm2XlTCwvvfMANPi4Yeo10vRf3 cMyQ7O3RSXZtO9MH+A4BYEWiJ/M4cNwypCDl189Rcc+DIw296lsfygxnc13HqvRW 9mpYYrgomGVSSL7KGmgSLQMXHTLrGKJiCcS+DEqsGoDbe97B2ytNBTyzOItrFypI LxcPgkvFIC/Df5gJ9QQ7HX/7XVWP95jpxBmsblYYmLKdSOau3fIJa/2hQ== 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=iaT5PVQQV1J3NO3ZCJQqw6ZfLRU5QGqUsJkfrgMTcgM=; b=abp4hxHn Htc/1yVOEeIw0IckS+SonQ2uQzjyj4a1y8I4mhmQsXauEBxBi4ZE5JS9J+leMNHy SA9tR4PgPa2b09qfLf0mriyBxRdATSpDRwayGeyO59dbQEsAU2MUSZexCBUoGNeI T3HfpzwkhXMHJ3cmZUO5ju6hphvIDKby5CrrqB4K2IFki/9FY/UbLc4z6sWkKU65 TLKGICMT9rhnSn6DUZbQhddkB08U6j1uyR1h1pEMmJTXkpGYJITcKXsvWRKa8V26 ckynuieMZRxDCRDNqrtxRe65q2+rR9MAcVdbefl4g9ngmKfc3xEFc6WOuDTHiI+e q4Cq6yo7FciEKw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvtddrvddvhedgudduiecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enucfjughrpefhvffufffkofgjfhgggfestdekredtredttdenucfhrhhomhepofgrgihi mhgvucftihhprghrugcuoehmrgigihhmvgestggvrhhnohdrthgvtghhqeenucggtffrrg htthgvrhhnpedvkeelveefffekjefhffeuleetleefudeifeehuddugffghffhffehveev heehvdenucevlhhushhtvghrufhiiigvpeefnecurfgrrhgrmhepmhgrihhlfhhrohhmpe hmrgigihhmvgestggvrhhnohdrthgvtghh X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 21 Oct 2021 03:40:43 -0400 (EDT) From: Maxime Ripard To: Laurent Pinchart , Maarten Lankhorst , Thomas Zimmermann , Maxime Ripard , Sam Ravnborg , Daniel Vetter , David Airlie , Thierry Reding , Andrzej Hajda , Robert Foss , Neil Armstrong , Jonas Karlman , Jernej Skrabec Cc: Seung-Woo Kim , Xinliang Liu , linux-samsung-soc@vger.kernel.org, linux-kernel@vger.kernel.org, Tian Tao , freedreno@lists.freedesktop.org, Chen Feng , Joonyoung Shim , Kyungmin Park , John Stultz , Rob Clark , linux-arm-msm@vger.kernel.org, Sean Paul , Inki Dae , Xinwei Kong , dri-devel@lists.freedesktop.org Subject: [PATCH v5 11/21] drm/bridge: ps8640: Switch to devm MIPI-DSI helpers Date: Thu, 21 Oct 2021 09:39:37 +0200 Message-Id: <20211021073947.499373-12-maxime@cerno.tech> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211021073947.499373-1-maxime@cerno.tech> References: <20211021073947.499373-1-maxime@cerno.tech> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@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 on removal. Acked-by: Sam Ravnborg Signed-off-by: Maxime Ripard --- drivers/gpu/drm/bridge/parade-ps8640.c | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/drivers/gpu/drm/bridge/parade-ps8640.c b/drivers/gpu/drm/bridge/parade-ps8640.c index 3aaa90913bf8..5ae15fc407c5 100644 --- a/drivers/gpu/drm/bridge/parade-ps8640.c +++ b/drivers/gpu/drm/bridge/parade-ps8640.c @@ -428,7 +428,7 @@ static int ps8640_bridge_attach(struct drm_bridge *bridge, if (!host) return -ENODEV; - 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); @@ -442,27 +442,22 @@ static int ps8640_bridge_attach(struct drm_bridge *bridge, MIPI_DSI_MODE_VIDEO_SYNC_PULSE; dsi->format = MIPI_DSI_FMT_RGB888; dsi->lanes = NUM_MIPI_LANES; - ret = mipi_dsi_attach(dsi); + + ret = devm_mipi_dsi_attach(dev, dsi); if (ret) { dev_err(dev, "failed to attach dsi device: %d\n", ret); - goto err_dsi_attach; + return ret; } ret = drm_dp_aux_register(&ps_bridge->aux); if (ret) { dev_err(dev, "failed to register DP AUX channel: %d\n", ret); - goto err_aux_register; + return ret; } /* Attach the panel-bridge to the dsi bridge */ return drm_bridge_attach(bridge->encoder, ps_bridge->panel_bridge, &ps_bridge->bridge, flags); - -err_aux_register: - mipi_dsi_detach(dsi); -err_dsi_attach: - mipi_dsi_device_unregister(dsi); - return ret; } static void ps8640_bridge_detach(struct drm_bridge *bridge)