From patchwork Wed Jul 26 08:22:40 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AngeloGioacchino Del Regno X-Patchwork-Id: 13327600 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 gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id A449BC001DE for ; Wed, 26 Jul 2023 08:23:04 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 2079C10E16F; Wed, 26 Jul 2023 08:23:03 +0000 (UTC) Received: from madras.collabora.co.uk (madras.collabora.co.uk [IPv6:2a00:1098:0:82:1000:25:2eeb:e5ab]) by gabe.freedesktop.org (Postfix) with ESMTPS id AAF2310E18A for ; Wed, 26 Jul 2023 08:22:56 +0000 (UTC) Received: from IcarusMOD.eternityproject.eu (2-237-20-237.ip236.fastwebnet.it [2.237.20.237]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: kholk11) by madras.collabora.co.uk (Postfix) with ESMTPSA id D8B916607118; Wed, 26 Jul 2023 09:22:54 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1690359775; bh=Q3C1A1/WPCB7GbI1qxZ2/JfxdcuHFERjBQhqhmiBaJg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=W30kAM9VjbsptC4LXUxcchKuSEOJnLC9ADzIMueGjuYiDFH+AOvz3ncVSpl9zL3e8 wz5SeJfGapt4RQccVkA43tD9ddC7rrfeTfAMHJhkqu7t7F/2HriKC/D5DZGdCgP122 eVuiFWhc/EXAsiHVQtbnCpqTW+2vwr2j9oke+HkTviebSi5NWXBEUwYogLNBaThS8T 5GZJ0NVWdx8b/AHBtAYlJXenJAZEbd9msG0v+OOcjRaFRGeKBYCNk5IAsixxtPi5TD 64iZqYNm0Uvm2fkjGZxmf9Lw5vynEbYxXO1bqw54ix7LRZw9F27r2UmqLJWYS17dND oxL1pkItFLJCw== From: AngeloGioacchino Del Regno To: chunkuang.hu@kernel.org Subject: [PATCH v3 1/6] drm/mediatek: mtk_dpi: Simplify with devm_drm_bridge_add() Date: Wed, 26 Jul 2023 10:22:40 +0200 Message-ID: <20230726082245.550929-2-angelogioacchino.delregno@collabora.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230726082245.550929-1-angelogioacchino.delregno@collabora.com> References: <20230726082245.550929-1-angelogioacchino.delregno@collabora.com> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: fshao@chromium.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-mediatek@lists.infradead.org, matthias.bgg@gmail.com, kernel@collabora.com, linux-arm-kernel@lists.infradead.org, angelogioacchino.delregno@collabora.com Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Change drm_bridge_add() to its devm variant to slightly simplify the probe function. Signed-off-by: AngeloGioacchino Del Regno Reviewed-by: Fei Shao Reviewed-by: CK Hu --- drivers/gpu/drm/mediatek/mtk_dpi.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/mediatek/mtk_dpi.c b/drivers/gpu/drm/mediatek/mtk_dpi.c index 28bdb1f427ff..e4ee0d02893a 100644 --- a/drivers/gpu/drm/mediatek/mtk_dpi.c +++ b/drivers/gpu/drm/mediatek/mtk_dpi.c @@ -1089,11 +1089,12 @@ static int mtk_dpi_probe(struct platform_device *pdev) dpi->bridge.of_node = dev->of_node; dpi->bridge.type = DRM_MODE_CONNECTOR_DPI; - drm_bridge_add(&dpi->bridge); + ret = devm_drm_bridge_add(dev, &dpi->bridge); + if (ret) + return ret; ret = component_add(dev, &mtk_dpi_component_ops); if (ret) { - drm_bridge_remove(&dpi->bridge); dev_err(dev, "Failed to add component: %d\n", ret); return ret; } @@ -1103,10 +1104,7 @@ static int mtk_dpi_probe(struct platform_device *pdev) static int mtk_dpi_remove(struct platform_device *pdev) { - struct mtk_dpi *dpi = platform_get_drvdata(pdev); - component_del(&pdev->dev, &mtk_dpi_component_ops); - drm_bridge_remove(&dpi->bridge); return 0; }