From patchwork Wed Feb 22 09:42:45 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: 60453 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp481969wrd; Wed, 22 Feb 2023 01:58:08 -0800 (PST) X-Google-Smtp-Source: AK7set9BPgeg8w5vEEmmUlzeF/UWZzJLf96bXGqOEBD83GvDeBPT0hIj+3/r/LTuQ1XL9/BQZT0Y X-Received: by 2002:a17:907:9715:b0:7c1:458b:a947 with SMTP id jg21-20020a170907971500b007c1458ba947mr21758186ejc.26.1677059888340; Wed, 22 Feb 2023 01:58:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1677059888; cv=none; d=google.com; s=arc-20160816; b=iEQztg5jvpNRG94TP+lb8gG4gVST9JuUVlkGKaiea4S3UHQaHtULO1TB+r3yU1+KlT 3iLoSKdDuq2lJTM/ieMxt+2EzwKKc9cjrUpBO1ovnCiE6HkL4dHcTnAhDM1rQzd1olVh t9BedIrStdFgFfbMHUYP33tqqfeljbJgglXLeVokLJjZL34F3Hax8xE+mrb9f6YbdcxQ PuCsctqLmaW5mcaWp4ICdfCTpkUp3WYnPAexKQzgtjoCtA9LcaNbcA07/XwM6QbIotqB rHFhIRWtUHtStzv/6MosxD3vRRCdrZLmGxOiOzJ4RDYnVDzqLxHjczF41KcOSbusMHgM pE2Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=LySAHNP7mTCRe2nowX38J9T4myZvj8JYW77lo4fp3Tg=; b=xw8hTZQmvL0ShmHAImu5HTupHdm+MWpbSNa0EkbQ3QWkpcFEr1XCrF8yoYQJon/2jc siP2JbSWu87xoBnHLfxQK+PXGm34Y9w/MIDpCAKkLflU8kVonl2FnP9i09gnhZd8B6Yk ocdNenvWNTXV4sadVPyITR3gN1BpPZgCOCZZTzgKulyld+3pYJPLM6JpXNO/0YOZclk/ yVcK8uCZb6sM7hP4BKatrKeW0gMnh/UdPOw3MZC5e3iLnPwuvTVf2dNztqtK+GvXHtdd 8H5xrwAyC2oFXRsN2joI4bWtNsmDOpfUIEDfuHF3gL69Um2BUvw1vpB1MdOePfKUKrcg 0zBw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=icQqmQC1; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=collabora.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ms32-20020a170907622000b008b17a84e038si17444472ejc.329.2023.02.22.01.57.45; Wed, 22 Feb 2023 01:58:08 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=icQqmQC1; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=collabora.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232351AbjBVJwR (ORCPT + 99 others); Wed, 22 Feb 2023 04:52:17 -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 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1758524749326809562?= X-GMAIL-MSGID: =?utf-8?q?1758524749326809562?= 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-mmsys.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 = { 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 = clks; if (mmsys->data->is_vppsys) goto out_probe_done; @@ -352,11 +355,22 @@ static int mtk_mmsys_probe(struct platform_device *pdev) platform_device_unregister(clks); return PTR_ERR(drm); } + mmsys->drm_pdev = drm; out_probe_done: return 0; } +static int mtk_mmsys_remove(struct platform_device *pdev) +{ + struct mtk_mmsys *mmsys = 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[] = { { .compatible = "mediatek,mt2701-mmsys", @@ -431,6 +445,7 @@ static struct platform_driver mtk_mmsys_drv = { .of_match_table = of_match_mtk_mmsys, }, .probe = mtk_mmsys_probe, + .remove = mtk_mmsys_remove, }; static int __init mtk_mmsys_init(void)