From nobody Thu Nov 14 06:55:49 2024 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A7950C61DA4 for ; Wed, 22 Feb 2023 09:52:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231195AbjBVJwS (ORCPT ); Wed, 22 Feb 2023 04:52:18 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49942 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232305AbjBVJvz (ORCPT ); Wed, 22 Feb 2023 04:51:55 -0500 Received: from madras.collabora.co.uk (madras.collabora.co.uk [46.235.227.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A4CC33756A for ; Wed, 22 Feb 2023 01:50:09 -0800 (PST) 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 ECD2B66021B6; Wed, 22 Feb 2023 09:42:59 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1677058980; bh=ZVUGUSkQPIkJqJdXlquYlMTH70M4rX6hh28fX2ZpB5Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=icQqmQC1NwhnkaUQUa+HJKbglRLmbx/Cj2SKtRtzcRiAcaZ6bhD1Me/eThlsET4+i ujYA1sNyAbC9oPZFJYpa9XFob5Sx/YjCt4ShTyTalCwsz2Er43whYGhep8a2lvMUUH RyGA+0aIlYplbyCeYhJGCZ15xq/YKNHkZvkZNmAwwiDj5hAtK6901UscTnn1KpS865 S9bZSHyzPYmPHneLMLyiUwBFEEO2/IJPz4qE7tZTzZHGDdA944Hwwowg+WftffoDX6 nft5SV61zPfGuvYbc23A5utu3uh/YnAq0yL3fSR7UgphZZV1u2sJ93YcCnYJF9oBpi 5G644Bm21xEWw== From: AngeloGioacchino Del Regno To: matthias.bgg@gmail.com Cc: jason-jh.lin@mediatek.com, chunkuang.hu@kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, AngeloGioacchino Del Regno , Chen-Yu Tsai Subject: [PATCH v2 1/9] soc: mediatek: mtk-mmsys: Add .remove() callback Date: Wed, 22 Feb 2023 10:42:45 +0100 Message-Id: <20230222094253.23678-2-angelogioacchino.delregno@collabora.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230222094253.23678-1-angelogioacchino.delregno@collabora.com> References: <20230222094253.23678-1-angelogioacchino.delregno@collabora.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Add a .remove() callback to correctly unregister the multimedia clocks and DRM drivers. Signed-off-by: AngeloGioacchino Del Regno Reviewed-by: Chen-Yu Tsai --- drivers/soc/mediatek/mtk-mmsys.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/drivers/soc/mediatek/mtk-mmsys.c b/drivers/soc/mediatek/mtk-mm= sys.c index eb4c7e57896c..af22f3490034 100644 --- a/drivers/soc/mediatek/mtk-mmsys.c +++ b/drivers/soc/mediatek/mtk-mmsys.c @@ -121,6 +121,8 @@ static const struct mtk_mmsys_driver_data mt8365_mmsys_= driver_data =3D { struct mtk_mmsys { void __iomem *regs; const struct mtk_mmsys_driver_data *data; + struct platform_device *clks_pdev; + struct platform_device *drm_pdev; spinlock_t lock; /* protects mmsys_sw_rst_b reg */ struct reset_controller_dev rcdev; struct cmdq_client_reg cmdq_base; @@ -342,6 +344,7 @@ static int mtk_mmsys_probe(struct platform_device *pdev) PLATFORM_DEVID_AUTO, NULL, 0); if (IS_ERR(clks)) return PTR_ERR(clks); + mmsys->clks_pdev =3D clks; =20 if (mmsys->data->is_vppsys) goto out_probe_done; @@ -352,11 +355,22 @@ static int mtk_mmsys_probe(struct platform_device *pd= ev) platform_device_unregister(clks); return PTR_ERR(drm); } + mmsys->drm_pdev =3D drm; =20 out_probe_done: return 0; } =20 +static int mtk_mmsys_remove(struct platform_device *pdev) +{ + struct mtk_mmsys *mmsys =3D platform_get_drvdata(pdev); + + platform_device_unregister(mmsys->drm_pdev); + platform_device_unregister(mmsys->clks_pdev); + + return 0; +} + static const struct of_device_id of_match_mtk_mmsys[] =3D { { .compatible =3D "mediatek,mt2701-mmsys", @@ -431,6 +445,7 @@ static struct platform_driver mtk_mmsys_drv =3D { .of_match_table =3D of_match_mtk_mmsys, }, .probe =3D mtk_mmsys_probe, + .remove =3D mtk_mmsys_remove, }; =20 static int __init mtk_mmsys_init(void) --=20 2.39.2