Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp3903078ybl; Mon, 9 Dec 2019 02:01:28 -0800 (PST) X-Google-Smtp-Source: APXvYqx5Y5VtcYZr2Y3wB6CxS29jeFBXMtZ6x+UXAIeLBs9zy5aOhG4TgtqX64NAgdoDYBSfYgvv X-Received: by 2002:a9d:32e:: with SMTP id 43mr10593675otv.301.1575885687951; Mon, 09 Dec 2019 02:01:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1575885687; cv=none; d=google.com; s=arc-20160816; b=FNFQ9KuNJ0nuyb/9A9ZALFZjOJr1UO1eCjzFrI39iMmcN8t2U/K+dXCeAX7X2EWrAO zkVydyn0x+H21t85iQFpelVAjO3h6EwrtgF5qDuhU5mR6mupEKMDgpSiGDLhe77a4Idp OatawRrJIAl+RGPMPVwv/4oRU5/RUQrZyWV+idRjZlEP6+vSwW5IOkwyoZ8A6CBX57NQ FNAvB8eH3oX42v/3srRtJ9e3UvKnHA2ZLNEnEVvdAbSYWRE/L54LV2GVZVL/SSWxowfK yhpZ3q+p01tF9SyVbihOFyNRiztlqJTVe+zC0ZO9fDmIOUsyQERpIlLbmWYP0UW3UwYR XjmA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=ouB3fCnqZrSruZlpWvHLsxF/BlwhwW6i+HPhV6zq9BU=; b=aPY9trn6VT6mRcV/zBkEkaXegulWZPWn6CyW6GueZhWNqULAcq4rYF07yDKGM6UgZ1 amaGwWiyjkzOH7/YomeQqtnhb9MN08q91QpfympuzeWQynsFvsRU+d+4St/+rLXYwcFf EfQm3xMcheYsVfa6kWN3T+uikNb5DwR5G08xSWP7gCMYHBO5FXikh8kgQD5gLIe9PS6R +2eNP0c3XxaJCqz7yjDPHIiuh2XAzdnQa7/R158UbmrwsPm4OkLV3XrP/YVlqDUyPYhq 0dbo89ItmqqGSUQiV/mjROyp2ehD0UjvxYwZQMdyCYOMNxGRofF3WN1Po/bTohjdbpUe AN0w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=collabora.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c131si12071368oib.267.2019.12.09.02.01.17; Mon, 09 Dec 2019 02:01:27 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=collabora.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727378AbfLIJ7c (ORCPT + 99 others); Mon, 9 Dec 2019 04:59:32 -0500 Received: from bhuna.collabora.co.uk ([46.235.227.227]:40674 "EHLO bhuna.collabora.co.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727307AbfLIJ7c (ORCPT ); Mon, 9 Dec 2019 04:59:32 -0500 Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: eballetbo) with ESMTPSA id 1F91828BA5C Subject: Re: [resend PATCH v6 07/12] clk: mediatek: mt2712e: switch to platform device probing To: matthias.bgg@kernel.org, robh+dt@kernel.org, mark.rutland@arm.com, ck.hu@mediatek.com, p.zabel@pengutronix.de, airlied@linux.ie, mturquette@baylibre.com, sboyd@kernel.org, ulrich.hecht+renesas@gmail.com, laurent.pinchart@ideasonboard.com Cc: sean.wang@mediatek.com, sean.wang@kernel.org, rdunlap@infradead.org, wens@csie.org, hsinyi@chromium.org, frank-w@public-files.de, drinkcat@chromium.org, linux-media@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, linux-clk@vger.kernel.org, devicetree@vger.kernel.org, mbrugger@suse.com References: <20191207224740.24536-1-matthias.bgg@kernel.org> <20191207224740.24536-8-matthias.bgg@kernel.org> From: Enric Balletbo i Serra Message-ID: <9f4f8481-66de-6ca5-f9e0-6c6fa6a857eb@collabora.com> Date: Mon, 9 Dec 2019 10:59:25 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.2.2 MIME-Version: 1.0 In-Reply-To: <20191207224740.24536-8-matthias.bgg@kernel.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Matthias, On 7/12/19 23:47, matthias.bgg@kernel.org wrote: > From: Matthias Brugger > > Switch probing for the MMSYS to support invocation to a > plain paltform device. The driver will be probed by the DRM subsystem. > > Signed-off-by: Matthias Brugger > --- > drivers/clk/mediatek/clk-mt2712-mm.c | 39 +++++++++++++++++++--------- Same comments as previous patch. > 1 file changed, 27 insertions(+), 12 deletions(-) > > diff --git a/drivers/clk/mediatek/clk-mt2712-mm.c b/drivers/clk/mediatek/clk-mt2712-mm.c > index 1c5948be35f3..d018db568263 100644 > --- a/drivers/clk/mediatek/clk-mt2712-mm.c > +++ b/drivers/clk/mediatek/clk-mt2712-mm.c > @@ -4,14 +4,20 @@ > * Author: Weiyi Lu > */ > > +#include > #include > #include > +#include > > #include "clk-mtk.h" > #include "clk-gate.h" > > #include > > +struct clk_mt2712_mm_priv { > + struct clk_onecell_data *clk_data; > +}; > + > static const struct mtk_gate_regs mm0_cg_regs = { > .set_ofs = 0x104, > .clr_ofs = 0x108, > @@ -128,16 +134,22 @@ static const struct mtk_gate mm_clks[] = { > > static int clk_mt2712_mm_probe(struct platform_device *pdev) > { > - struct clk_onecell_data *clk_data; > int r; > - struct device_node *node = pdev->dev.of_node; > + struct device_node *node = pdev->dev.parent->of_node; > + struct clk_mt2712_mm_priv *private; > + > + private = devm_kzalloc(&pdev->dev, sizeof(*private), GFP_KERNEL); > + if (!private) > + return -ENOMEM; > > - clk_data = mtk_alloc_clk_data(CLK_MM_NR_CLK); > + private->clk_data = mtk_alloc_clk_data(CLK_MM_NR_CLK); > + platform_set_drvdata(pdev, private); > > mtk_clk_register_gates(node, mm_clks, ARRAY_SIZE(mm_clks), > - clk_data); > + private->clk_data); > > - r = of_clk_add_provider(node, of_clk_src_onecell_get, clk_data); > + r = of_clk_add_provider(node, of_clk_src_onecell_get, > + private->clk_data); > > if (r != 0) > pr_err("%s(): could not register clock provider: %d\n", > @@ -146,17 +158,20 @@ static int clk_mt2712_mm_probe(struct platform_device *pdev) > return r; > } > > -static const struct of_device_id of_match_clk_mt2712_mm[] = { > - { .compatible = "mediatek,mt2712-mmsys", }, > - {} > -}; > +static int clk_mt2712_mm_remove(struct platform_device *pdev) > +{ > + struct clk_mt2712_mm_priv *private = platform_get_drvdata(pdev); > + > + kfree(private->clk_data); > + > + return 0; > +} > > static struct platform_driver clk_mt2712_mm_drv = { > .probe = clk_mt2712_mm_probe, > + .remove = clk_mt2712_mm_remove, > .driver = { > .name = "clk-mt2712-mm", > - .of_match_table = of_match_clk_mt2712_mm, > }, > }; > - > -builtin_platform_driver(clk_mt2712_mm_drv); > +module_platform_driver(clk_mt2712_mm_drv); >