From patchwork Fri Sep 10 10:11:59 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 508802 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9700EC433FE for ; Fri, 10 Sep 2021 10:13:06 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 7E8876108B for ; Fri, 10 Sep 2021 10:13:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232317AbhIJKOO (ORCPT ); Fri, 10 Sep 2021 06:14:14 -0400 Received: from wnew4-smtp.messagingengine.com ([64.147.123.18]:47277 "EHLO wnew4-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232236AbhIJKON (ORCPT ); Fri, 10 Sep 2021 06:14:13 -0400 Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailnew.west.internal (Postfix) with ESMTP id 037582B0094D; Fri, 10 Sep 2021 06:12:52 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute5.internal (MEProxy); Fri, 10 Sep 2021 06:12:55 -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=fm3; bh=1YX5njk0kRv3r NsS7AJ+7rDWNovGCl+gZ2FuKuYsCtY=; b=155IEI/O4BaxC5xRHhz3+ld10fI7l jhjgJEYbqtinb4uGZWec+pUZov/PohSvyd2cWKjt+V3plY9asBrq1b029+Lot9vI syUFBV5TsBmrPNqMAZixpmuU86nZ/KQ4kE3zeN2fHusFDVQscnm4UUyMwILEVXm4 peR0pxKr+BSdZWl6xP8M6/BzdEfioTOQDpMwdv7TkEZSFCXOYWlL6r8FgoFqW/vJ altFyo/nrft1Xo6zBjMTK81VjKfCoBHt37WXeoXNziL60BpTCFUhGxyd0VCRdDCP 4+mrUVyg8/uX90oqvLlrCLU00MFPu7h3yioihUXtrK4DiGwZ4eLz0g+zw== 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= fm3; bh=1YX5njk0kRv3rNsS7AJ+7rDWNovGCl+gZ2FuKuYsCtY=; b=MWZ/LMsJ nJCVGI3FWIxFArS4DOlCBzKFneUelMbr2C3dahKGyJuAW7hFJXB5YPgIQ2OHw1xI EuqxO1az4gfxRXfLkCrdDb48rDHarV2wXSEB1y7jLDfleJua9/fHS0HdMm9u4CYU Aah65c8NbllI17PVIx1hLNdMumbR1ua6n69Hhk8VCZ8BRoLIBwunfSSI18EvgR9b JqlWaBXL/lNDDbM3XOFMqSphKYe+2Y9NIR++x9MNjWdi4qEUkbHTUZDH5KL1buYt 4TOoTw1NHUOEP78uA29EUDFYRsEByphwtJi+Pme/6dLzfh+gbGEDtKCf0ZfggkOf VrC8eBV4hXJmqA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvtddrudeguddgvdegucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvufffkffojghfggfgsedtkeertdertddtnecuhfhrohhmpeforgigihhm vgcutfhiphgrrhguuceomhgrgihimhgvsegtvghrnhhordhtvggthheqnecuggftrfgrth htvghrnhepvdekleevfeffkeejhfffueelteelfeduieefheduudfggffhhfffheevveeh hedvnecuvehluhhsthgvrhfuihiivgepvdenucfrrghrrghmpehmrghilhhfrhhomhepmh grgihimhgvsegtvghrnhhordhtvggthh X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 10 Sep 2021 06:12:52 -0400 (EDT) From: Maxime Ripard To: Andrzej Hajda , Sam Ravnborg , Daniel Vetter , David Airlie , Jonas Karlman , Laurent Pinchart , Thierry Reding , Maarten Lankhorst , Thomas Zimmermann , Maxime Ripard , Neil Armstrong , Robert Foss , Jernej Skrabec Cc: Sean Paul , freedreno@lists.freedesktop.org, Kyungmin Park , linux-kernel@vger.kernel.org, Xinliang Liu , Seung-Woo Kim , Tian Tao , Inki Dae , linux-samsung-soc@vger.kernel.org, linux-arm-msm@vger.kernel.org, Rob Clark , dri-devel@lists.freedesktop.org, John Stultz , Chen Feng , Xinwei Kong , Joonyoung Shim Subject: [PATCH v4 05/24] drm/bridge: adv7533: Switch to devm MIPI-DSI helpers Date: Fri, 10 Sep 2021 12:11:59 +0200 Message-Id: <20210910101218.1632297-6-maxime@cerno.tech> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210910101218.1632297-1-maxime@cerno.tech> References: <20210910101218.1632297-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 when we detach the bridge. Signed-off-by: Maxime Ripard --- drivers/gpu/drm/bridge/adv7511/adv7511.h | 1 - drivers/gpu/drm/bridge/adv7511/adv7511_drv.c | 2 -- drivers/gpu/drm/bridge/adv7511/adv7533.c | 20 ++++---------------- 3 files changed, 4 insertions(+), 19 deletions(-) diff --git a/drivers/gpu/drm/bridge/adv7511/adv7511.h b/drivers/gpu/drm/bridge/adv7511/adv7511.h index 05e3abb5a0c9..592ecfcf00ca 100644 --- a/drivers/gpu/drm/bridge/adv7511/adv7511.h +++ b/drivers/gpu/drm/bridge/adv7511/adv7511.h @@ -401,7 +401,6 @@ void adv7533_mode_set(struct adv7511 *adv, const struct drm_display_mode *mode); int adv7533_patch_registers(struct adv7511 *adv); int adv7533_patch_cec_registers(struct adv7511 *adv); int adv7533_attach_dsi(struct adv7511 *adv); -void adv7533_detach_dsi(struct adv7511 *adv); int adv7533_parse_dt(struct device_node *np, struct adv7511 *adv); #ifdef CONFIG_DRM_I2C_ADV7511_AUDIO diff --git a/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c b/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c index 76555ae64e9c..9e3585f23cf1 100644 --- a/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c +++ b/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c @@ -1307,8 +1307,6 @@ static int adv7511_remove(struct i2c_client *i2c) { struct adv7511 *adv7511 = i2c_get_clientdata(i2c); - if (adv7511->type == ADV7533 || adv7511->type == ADV7535) - adv7533_detach_dsi(adv7511); i2c_unregister_device(adv7511->i2c_cec); clk_disable_unprepare(adv7511->cec_clk); diff --git a/drivers/gpu/drm/bridge/adv7511/adv7533.c b/drivers/gpu/drm/bridge/adv7511/adv7533.c index 59d718bde8c4..eb7579dec40a 100644 --- a/drivers/gpu/drm/bridge/adv7511/adv7533.c +++ b/drivers/gpu/drm/bridge/adv7511/adv7533.c @@ -153,11 +153,10 @@ int adv7533_attach_dsi(struct adv7511 *adv) 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); } adv->dsi = dsi; @@ -167,24 +166,13 @@ int adv7533_attach_dsi(struct adv7511 *adv) dsi->mode_flags = MIPI_DSI_MODE_VIDEO | MIPI_DSI_MODE_VIDEO_SYNC_PULSE | MIPI_DSI_MODE_NO_EOT_PACKET | MIPI_DSI_MODE_VIDEO_HSE; - 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 0; - -err_dsi_attach: - mipi_dsi_device_unregister(dsi); -err_dsi_device: - return ret; -} - -void adv7533_detach_dsi(struct adv7511 *adv) -{ - mipi_dsi_detach(adv->dsi); - mipi_dsi_device_unregister(adv->dsi); } int adv7533_parse_dt(struct device_node *np, struct adv7511 *adv)