Message ID | 20230206152928.918562-10-angelogioacchino.delregno@collabora.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp2298844wrn; Mon, 6 Feb 2023 07:31:54 -0800 (PST) X-Google-Smtp-Source: AK7set/O7ag61aMkbonBEkPmJjCCp6B3xRAYToELgmaJ3V3XWKWNl5LRItKRfFZDn3nRkorV6Jq4 X-Received: by 2002:a17:902:e0d5:b0:196:3feb:1f1e with SMTP id e21-20020a170902e0d500b001963feb1f1emr16329421pla.47.1675697514580; Mon, 06 Feb 2023 07:31:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675697514; cv=none; d=google.com; s=arc-20160816; b=lGWCkSRC54CzkhzUof003zddArJHQDZAJF+fnvUPvDTbN0gKYinYzIhzozosaPzaMl unXkLSFLjTI2XTiZxvKFb0nc4rQp9sJeCYjoDBAcWD+nj0X+RhVNTkIuq+lbcxo/aQxo XlXtJA1QAGhvKdc+TAZRm7SgZS+aTQXzTBMozFSnWoiYx7Ybg4R4qjqUogdSQud3Fj8Y U4+PB4cRkko5fZ/tAqhIlXsQmlDbg+ANnmy/munGg24jOfVXlkkMNKQEdEZKeWCBTlVL ysQV8CUsLirrXPX2xSSzBhhN3a6QqE3qXddMQulQZez0fN5waClkiPfg09F3XbpeNbDH eyxw== 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=gtiPwkf0hiH+NqcK0zkPOXYiWJtq7nujdGs1XknR4aI=; b=mSyxJPX6vc1cR6LH7cxozkuVf9JZNaAeJmqfMTuMDreO9QEesdSHb+r6l+WQmWLvvk UT/xVf8jHe5j5mc5YPteHc8pbO+J+w7Ey0PjXTi2X+CAIGIh11FCkwBhJWG3ZxaI3twW YPVW8gKCqoKXMqziKQl7iZlktuqq8KgoHqTRXnBMc/iJwl6uSNoN7F2nl5Bjxuz1jKJ4 MVhQxW0ZfvHhAgZ1ISu127WzAGWTOX4hNz1UIiOWpwlGE8woDMBPrrklWpDyOP9mN+Fg wxt4SEQ7RLBlmxk59hEO7TihI4gk2GxusMCgEkRrkH2ud2l0ty7FAGYC5MPuKvNF5+Nw FSZA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=GkL4Axlf; 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 iw18-20020a170903045200b0019463a75b96si10891705plb.295.2023.02.06.07.31.42; Mon, 06 Feb 2023 07:31:54 -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=GkL4Axlf; 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 S231327AbjBFPab (ORCPT <rfc822;kmanaouilinux@gmail.com> + 99 others); Mon, 6 Feb 2023 10:30:31 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60530 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231197AbjBFPaL (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Mon, 6 Feb 2023 10:30:11 -0500 Received: from madras.collabora.co.uk (madras.collabora.co.uk [46.235.227.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 295D329E33; Mon, 6 Feb 2023 07:30:00 -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 C2CF46602EC7; Mon, 6 Feb 2023 15:29:57 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1675697399; bh=5Dp/IJ01q+sggFHscwN3Jk1mfKjZK08snEDtUhE6fwQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GkL4AxlfSNtdX//6EQOqDvqYFJG15dVPxKso18vfXyX0qFBchn8YSY3ZldqVnPKV3 NE4/ESp6wE7tJKZ6Ro1GH7GQYMaMOWTFrakehpw1lHCCoHk4P1vfbuvMHav8glw+Lx W6glmLHN+hxw4jjX0PkcnXnkyVs/KToR4xR2eJrCF++xK3JV592qSNjhP8m1iaMK0q yrQ2rH/Jij2y4p7TD7jKUiaOJ3bcPVhm0bZnSuym/DxRpi+JlcZ3z1uegUAYc0LaON v8hXDt3mP/+wAuVGLepwY2A+Lmy+LqiieyKz5wF6lI5uWLNWlhOkz8tKCmg/iytGUy XtAsmePHZpGlA== From: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com> To: mturquette@baylibre.com Cc: sboyd@kernel.org, matthias.bgg@gmail.com, angelogioacchino.delregno@collabora.com, wenst@chromium.org, johnson.wang@mediatek.com, miles.chen@mediatek.com, chun-jie.chen@mediatek.com, daniel@makrotopia.org, fparent@baylibre.com, msp@baylibre.com, nfraprado@collabora.com, rex-bc.chen@mediatek.com, zhaojh329@gmail.com, sam.shih@mediatek.com, edward-jw.yang@mediatek.com, yangyingliang@huawei.com, granquet@baylibre.com, pablo.sun@mediatek.com, sean.wang@mediatek.com, chen.zhong@mediatek.com, linux-kernel@vger.kernel.org, linux-clk@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org Subject: [PATCH v1 09/45] clk: mediatek: mt2712: Change to use module_platform_driver macro Date: Mon, 6 Feb 2023 16:28:52 +0100 Message-Id: <20230206152928.918562-10-angelogioacchino.delregno@collabora.com> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230206152928.918562-1-angelogioacchino.delregno@collabora.com> References: <20230206152928.918562-1-angelogioacchino.delregno@collabora.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1757096197104587793?= X-GMAIL-MSGID: =?utf-8?q?1757096197104587793?= |
Series |
MediaTek clocks: full module build and cleanups
|
|
Commit Message
AngeloGioacchino Del Regno
Feb. 6, 2023, 3:28 p.m. UTC
Now that all of the clocks in clk-mt2712.c are using the common
mtk_clk_simple_{probe,remove}() callbacks we can safely migrate
to module_platform_driver.
Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
---
drivers/clk/mediatek/clk-mt2712.c | 10 ++--------
1 file changed, 2 insertions(+), 8 deletions(-)
Comments
On Mon, Feb 6, 2023 at 11:29 PM AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com> wrote: > > Now that all of the clocks in clk-mt2712.c are using the common > mtk_clk_simple_{probe,remove}() callbacks we can safely migrate > to module_platform_driver. Instead of splitting the conversion into a module among many patches, I'd do it in one go. With one patch we get a working module instead of a half-baked one half way through the series. The subject could say "Convert X driver from builtin to module". And instead of "migrate to module_platform_driver", the body could say "convert to module by switching to module_platform_driver, and adding missing MODULE_* statements". I believe this constitutes one logical change. Maybe the accompanying Kconfig change should be included as well? > Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com> > --- > drivers/clk/mediatek/clk-mt2712.c | 10 ++-------- > 1 file changed, 2 insertions(+), 8 deletions(-) > > diff --git a/drivers/clk/mediatek/clk-mt2712.c b/drivers/clk/mediatek/clk-mt2712.c > index c5fd76d1b9df..65c1cbcbd54e 100644 > --- a/drivers/clk/mediatek/clk-mt2712.c > +++ b/drivers/clk/mediatek/clk-mt2712.c > @@ -1028,7 +1028,7 @@ static const struct of_device_id of_match_clk_mt2712_simple[] = { > { /* sentinel */ } > }; > > -static struct platform_driver clk_mt2712_simple_drv = { > +static struct platform_driver clk_mt2712_drv = { Why the name change? If you do change the name, could you also change the of match table's name as well to be consistent, and also mention the change in the commit log? I'd just leave it alone though. ChenYu > .probe = mtk_clk_simple_probe, > .remove = mtk_clk_simple_remove, > .driver = { > @@ -1036,10 +1036,4 @@ static struct platform_driver clk_mt2712_simple_drv = { > .of_match_table = of_match_clk_mt2712_simple, > }, > }; > - > -static int __init clk_mt2712_init(void) > -{ > - return platform_driver_register(&clk_mt2712_simple_drv); > -} > - > -arch_initcall(clk_mt2712_init); > +module_platform_driver(clk_mt2712_drv); > -- > 2.39.1 >
Il 07/02/23 07:33, Chen-Yu Tsai ha scritto: > On Mon, Feb 6, 2023 at 11:29 PM AngeloGioacchino Del Regno > <angelogioacchino.delregno@collabora.com> wrote: >> >> Now that all of the clocks in clk-mt2712.c are using the common >> mtk_clk_simple_{probe,remove}() callbacks we can safely migrate >> to module_platform_driver. > > Instead of splitting the conversion into a module among many patches, > I'd do it in one go. With one patch we get a working module instead > of a half-baked one half way through the series. > If you really want I can eventually do that in one go - in any case, the sense of having this split in multiple commits is: - Bisectability: topckgen/mcucfg migration being faulty would point at one commit doing just that, making it easier for whoever is trying to debug that to find what could've gone wrong; - Slow changes: A driver being a platform_driver doesn't mean that it *has* to be compiled as a module: infact, we can use the .remove() callback even with built-in drivers (as you can remove one and re-add it during runtime from sysfs) - Signaling completion: Saying "this is complete" in this case is performed in the last patches of the series, where only the Kconfig is being changed to allow the module build for (most)all. > The subject could say "Convert X driver from builtin to module". And > instead of "migrate to module_platform_driver", the body could say > "convert to module by switching to module_platform_driver, and adding > missing MODULE_* statements". I believe this constitutes one logical > change. Maybe the accompanying Kconfig change should be included as > well? > But again, I don't have *really strong* opinions on this, if not preferences for how I'd like to see the changes getting in: this series brings big changes that would be done in many more commits if they were scattered in more series. Another point about having this conversion performed in multiple commits is showing how it was done and how to replicate it for a different driver... >> Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com> >> --- >> drivers/clk/mediatek/clk-mt2712.c | 10 ++-------- >> 1 file changed, 2 insertions(+), 8 deletions(-) >> >> diff --git a/drivers/clk/mediatek/clk-mt2712.c b/drivers/clk/mediatek/clk-mt2712.c >> index c5fd76d1b9df..65c1cbcbd54e 100644 >> --- a/drivers/clk/mediatek/clk-mt2712.c >> +++ b/drivers/clk/mediatek/clk-mt2712.c >> @@ -1028,7 +1028,7 @@ static const struct of_device_id of_match_clk_mt2712_simple[] = { >> { /* sentinel */ } >> }; >> >> -static struct platform_driver clk_mt2712_simple_drv = { >> +static struct platform_driver clk_mt2712_drv = { > > Why the name change? If you do change the name, could you also change > the of match table's name as well to be consistent, and also mention > the change in the commit log? It simply looked like being a good idea, as "simple" made sense when we had two platform_driver in one file, one using simple_probe, one using a custom probe function. The latter going away forever means that there's no more distinction to do between the two, hence my rename here... Regarding the of_match_table name change... I'm sorry, I genuinely forgot to change it, my intention was infact to actually be consistent... :-) > > I'd just leave it alone though. I had to explain my reasoning about all of the above, so I'll just wait for your opinion again before going for a v2! :-) Cheers, Angelo
On Tue, Feb 7, 2023 at 5:00 PM AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com> wrote: > > Il 07/02/23 07:33, Chen-Yu Tsai ha scritto: > > On Mon, Feb 6, 2023 at 11:29 PM AngeloGioacchino Del Regno > > <angelogioacchino.delregno@collabora.com> wrote: > >> > >> Now that all of the clocks in clk-mt2712.c are using the common > >> mtk_clk_simple_{probe,remove}() callbacks we can safely migrate > >> to module_platform_driver. > > > > Instead of splitting the conversion into a module among many patches, > > I'd do it in one go. With one patch we get a working module instead > > of a half-baked one half way through the series. > > > > If you really want I can eventually do that in one go - in any case, the > sense of having this split in multiple commits is: > - Bisectability: topckgen/mcucfg migration being faulty would point at > one commit doing just that, making it easier for whoever > is trying to debug that to find what could've gone wrong; This part I agree with. > - Slow changes: A driver being a platform_driver doesn't mean that it *has* > to be compiled as a module: infact, we can use the .remove() > callback even with built-in drivers (as you can remove one > and re-add it during runtime from sysfs) I think the part that tripped me up was that in this patch's case it was already a platform driver, just a builtin one (without the builtin_platform_driver sugar). > - Signaling completion: > Saying "this is complete" in this case is performed in the > last patches of the series, where only the Kconfig is being > changed to allow the module build for (most)all. I'm concerned about people randomly cherry-picking patches. Unfortunately not everyone lives on mainline, us included. (I'm sure Android has it worse.) Many won't see the complete patch series, doubly so if we merge it in stages. Better we give one complete patch that converts the boilerplate code from "can't work as module" to "can work as module". I do agree we should keep all the other cleanups and migration to simple/pdev_probe separate for bisectability. > > The subject could say "Convert X driver from builtin to module". And > > instead of "migrate to module_platform_driver", the body could say > > "convert to module by switching to module_platform_driver, and adding > > missing MODULE_* statements". I believe this constitutes one logical > > change. Maybe the accompanying Kconfig change should be included as > > well? > > > > But again, I don't have *really strong* opinions on this, if not preferences > for how I'd like to see the changes getting in: this series brings big changes > that would be done in many more commits if they were scattered in more series. > Another point about having this conversion performed in multiple commits is > showing how it was done and how to replicate it for a different driver... In the past I've seen some comments from other maintainers about keeping (module|builtin)_X_driver consistent with its Kconfig entry. That sort of plays into my argument that this bit should be kept atomic. There are a couple patches where you convert directly from CLK_OF_DECLARE to module_platform_driver. We could work those out case by case? > >> Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com> > >> --- > >> drivers/clk/mediatek/clk-mt2712.c | 10 ++-------- > >> 1 file changed, 2 insertions(+), 8 deletions(-) > >> > >> diff --git a/drivers/clk/mediatek/clk-mt2712.c b/drivers/clk/mediatek/clk-mt2712.c > >> index c5fd76d1b9df..65c1cbcbd54e 100644 > >> --- a/drivers/clk/mediatek/clk-mt2712.c > >> +++ b/drivers/clk/mediatek/clk-mt2712.c > >> @@ -1028,7 +1028,7 @@ static const struct of_device_id of_match_clk_mt2712_simple[] = { > >> { /* sentinel */ } > >> }; > >> > >> -static struct platform_driver clk_mt2712_simple_drv = { > >> +static struct platform_driver clk_mt2712_drv = { > > > > Why the name change? If you do change the name, could you also change > > the of match table's name as well to be consistent, and also mention > > the change in the commit log? > > It simply looked like being a good idea, as "simple" made sense when we had two > platform_driver in one file, one using simple_probe, one using a custom probe > function. > The latter going away forever means that there's no more distinction to do > between the two, hence my rename here... > > Regarding the of_match_table name change... I'm sorry, I genuinely forgot to > change it, my intention was infact to actually be consistent... :-) > > > > > I'd just leave it alone though. > > I had to explain my reasoning about all of the above, so I'll just wait for > your opinion again before going for a v2! :-) Thanks again for working on this. ChenYu
Il 07/02/23 10:30, Chen-Yu Tsai ha scritto: > On Tue, Feb 7, 2023 at 5:00 PM AngeloGioacchino Del Regno > <angelogioacchino.delregno@collabora.com> wrote: >> >> Il 07/02/23 07:33, Chen-Yu Tsai ha scritto: >>> On Mon, Feb 6, 2023 at 11:29 PM AngeloGioacchino Del Regno >>> <angelogioacchino.delregno@collabora.com> wrote: >>>> >>>> Now that all of the clocks in clk-mt2712.c are using the common >>>> mtk_clk_simple_{probe,remove}() callbacks we can safely migrate >>>> to module_platform_driver. >>> >>> Instead of splitting the conversion into a module among many patches, >>> I'd do it in one go. With one patch we get a working module instead >>> of a half-baked one half way through the series. >>> >> >> If you really want I can eventually do that in one go - in any case, the >> sense of having this split in multiple commits is: >> - Bisectability: topckgen/mcucfg migration being faulty would point at >> one commit doing just that, making it easier for whoever >> is trying to debug that to find what could've gone wrong; > > This part I agree with. > >> - Slow changes: A driver being a platform_driver doesn't mean that it *has* >> to be compiled as a module: infact, we can use the .remove() >> callback even with built-in drivers (as you can remove one >> and re-add it during runtime from sysfs) > > I think the part that tripped me up was that in this patch's case it > was already a platform driver, just a builtin one (without the > builtin_platform_driver sugar). > >> - Signaling completion: >> Saying "this is complete" in this case is performed in the >> last patches of the series, where only the Kconfig is being >> changed to allow the module build for (most)all. > > I'm concerned about people randomly cherry-picking patches. Unfortunately > not everyone lives on mainline, us included. (I'm sure Android has it > worse.) Many won't see the complete patch series, doubly so if we merge > it in stages. Better we give one complete patch that converts the > boilerplate code from "can't work as module" to "can work as module". > I do agree we should keep all the other cleanups and migration to > simple/pdev_probe separate for bisectability. > One complete patch meaning that migrating to mtk_clk_simple_probe() should be squashed with moving apmixedsys away? So one patch doing the *big* change, and then one changing the driver to use the module_platform_driver() macro and tristate in Kconfig? I would be more comfortable changing the order of commits at this point, apmixedsys error handling Fixes -> apmixedsys moved in its own file -> migrate others to mtk_clk_simple_probe() *and* Kconfig changes What do you think? Thing is, apmixedsys is not a simple_probe driver and will never be, so it feels wrong to move that inside of a commit that converts to simple_probe()... >>> The subject could say "Convert X driver from builtin to module". And >>> instead of "migrate to module_platform_driver", the body could say >>> "convert to module by switching to module_platform_driver, and adding >>> missing MODULE_* statements". I believe this constitutes one logical >>> change. Maybe the accompanying Kconfig change should be included as >>> well? >>> >> >> But again, I don't have *really strong* opinions on this, if not preferences >> for how I'd like to see the changes getting in: this series brings big changes >> that would be done in many more commits if they were scattered in more series. >> Another point about having this conversion performed in multiple commits is >> showing how it was done and how to replicate it for a different driver... > > In the past I've seen some comments from other maintainers about keeping > (module|builtin)_X_driver consistent with its Kconfig entry. That sort of > plays into my argument that this bit should be kept atomic. > > There are a couple patches where you convert directly from CLK_OF_DECLARE > to module_platform_driver. We could work those out case by case? > >>>> Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com> >>>> --- >>>> drivers/clk/mediatek/clk-mt2712.c | 10 ++-------- >>>> 1 file changed, 2 insertions(+), 8 deletions(-) >>>> >>>> diff --git a/drivers/clk/mediatek/clk-mt2712.c b/drivers/clk/mediatek/clk-mt2712.c >>>> index c5fd76d1b9df..65c1cbcbd54e 100644 >>>> --- a/drivers/clk/mediatek/clk-mt2712.c >>>> +++ b/drivers/clk/mediatek/clk-mt2712.c >>>> @@ -1028,7 +1028,7 @@ static const struct of_device_id of_match_clk_mt2712_simple[] = { >>>> { /* sentinel */ } >>>> }; >>>> >>>> -static struct platform_driver clk_mt2712_simple_drv = { >>>> +static struct platform_driver clk_mt2712_drv = { >>> >>> Why the name change? If you do change the name, could you also change >>> the of match table's name as well to be consistent, and also mention >>> the change in the commit log? >> >> It simply looked like being a good idea, as "simple" made sense when we had two >> platform_driver in one file, one using simple_probe, one using a custom probe >> function. >> The latter going away forever means that there's no more distinction to do >> between the two, hence my rename here... >> >> Regarding the of_match_table name change... I'm sorry, I genuinely forgot to >> change it, my intention was infact to actually be consistent... :-) >> >>> >>> I'd just leave it alone though. >> >> I had to explain my reasoning about all of the above, so I'll just wait for >> your opinion again before going for a v2! :-) > > Thanks again for working on this. > > ChenYu
On Tue, Feb 7, 2023 at 6:50 PM AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com> wrote: > > Il 07/02/23 10:30, Chen-Yu Tsai ha scritto: > > On Tue, Feb 7, 2023 at 5:00 PM AngeloGioacchino Del Regno > > <angelogioacchino.delregno@collabora.com> wrote: > >> > >> Il 07/02/23 07:33, Chen-Yu Tsai ha scritto: > >>> On Mon, Feb 6, 2023 at 11:29 PM AngeloGioacchino Del Regno > >>> <angelogioacchino.delregno@collabora.com> wrote: > >>>> > >>>> Now that all of the clocks in clk-mt2712.c are using the common > >>>> mtk_clk_simple_{probe,remove}() callbacks we can safely migrate > >>>> to module_platform_driver. > >>> > >>> Instead of splitting the conversion into a module among many patches, > >>> I'd do it in one go. With one patch we get a working module instead > >>> of a half-baked one half way through the series. > >>> > >> > >> If you really want I can eventually do that in one go - in any case, the > >> sense of having this split in multiple commits is: > >> - Bisectability: topckgen/mcucfg migration being faulty would point at > >> one commit doing just that, making it easier for whoever > >> is trying to debug that to find what could've gone wrong; > > > > This part I agree with. > > > >> - Slow changes: A driver being a platform_driver doesn't mean that it *has* > >> to be compiled as a module: infact, we can use the .remove() > >> callback even with built-in drivers (as you can remove one > >> and re-add it during runtime from sysfs) > > > > I think the part that tripped me up was that in this patch's case it > > was already a platform driver, just a builtin one (without the > > builtin_platform_driver sugar). > > > >> - Signaling completion: > >> Saying "this is complete" in this case is performed in the > >> last patches of the series, where only the Kconfig is being > >> changed to allow the module build for (most)all. > > > > I'm concerned about people randomly cherry-picking patches. Unfortunately > > not everyone lives on mainline, us included. (I'm sure Android has it > > worse.) Many won't see the complete patch series, doubly so if we merge > > it in stages. Better we give one complete patch that converts the > > boilerplate code from "can't work as module" to "can work as module". > > I do agree we should keep all the other cleanups and migration to > > simple/pdev_probe separate for bisectability. > > > > One complete patch meaning that migrating to mtk_clk_simple_probe() should be > squashed with moving apmixedsys away? > > So one patch doing the *big* change, and then one changing the driver to use > the module_platform_driver() macro and tristate in Kconfig? I'd also add MOD_DEVICE_TABLE. Module autoloading doesn't work otherwise. The rest of the MODULE_INFO stuff I don't really have a preference on, but I don't know if there would be any issues with loading a module that doesn't have MODULE_LICENSE. Maybe the default is "GPL"? > I would be more comfortable changing the order of commits at this point, > apmixedsys error handling Fixes -> apmixedsys moved in its own file -> > migrate others to mtk_clk_simple_probe() *and* Kconfig changes > > What do you think? Sounds good. That way a) apmixed sys error handling could be cleanly backported if anyone cares, and b) code movement is contained in one patch. > Thing is, apmixedsys is not a simple_probe driver and will never be, so > it feels wrong to move that inside of a commit that converts to simple_probe()... Agreed. Thanks ChenYu > >>> The subject could say "Convert X driver from builtin to module". And > >>> instead of "migrate to module_platform_driver", the body could say > >>> "convert to module by switching to module_platform_driver, and adding > >>> missing MODULE_* statements". I believe this constitutes one logical > >>> change. Maybe the accompanying Kconfig change should be included as > >>> well? > >>> > >> > >> But again, I don't have *really strong* opinions on this, if not preferences > >> for how I'd like to see the changes getting in: this series brings big changes > >> that would be done in many more commits if they were scattered in more series. > >> Another point about having this conversion performed in multiple commits is > >> showing how it was done and how to replicate it for a different driver... > > > > In the past I've seen some comments from other maintainers about keeping > > (module|builtin)_X_driver consistent with its Kconfig entry. That sort of > > plays into my argument that this bit should be kept atomic. > > > > There are a couple patches where you convert directly from CLK_OF_DECLARE > > to module_platform_driver. We could work those out case by case? > > > >>>> Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com> > >>>> --- > >>>> drivers/clk/mediatek/clk-mt2712.c | 10 ++-------- > >>>> 1 file changed, 2 insertions(+), 8 deletions(-) > >>>> > >>>> diff --git a/drivers/clk/mediatek/clk-mt2712.c b/drivers/clk/mediatek/clk-mt2712.c > >>>> index c5fd76d1b9df..65c1cbcbd54e 100644 > >>>> --- a/drivers/clk/mediatek/clk-mt2712.c > >>>> +++ b/drivers/clk/mediatek/clk-mt2712.c > >>>> @@ -1028,7 +1028,7 @@ static const struct of_device_id of_match_clk_mt2712_simple[] = { > >>>> { /* sentinel */ } > >>>> }; > >>>> > >>>> -static struct platform_driver clk_mt2712_simple_drv = { > >>>> +static struct platform_driver clk_mt2712_drv = { > >>> > >>> Why the name change? If you do change the name, could you also change > >>> the of match table's name as well to be consistent, and also mention > >>> the change in the commit log? > >> > >> It simply looked like being a good idea, as "simple" made sense when we had two > >> platform_driver in one file, one using simple_probe, one using a custom probe > >> function. > >> The latter going away forever means that there's no more distinction to do > >> between the two, hence my rename here... > >> > >> Regarding the of_match_table name change... I'm sorry, I genuinely forgot to > >> change it, my intention was infact to actually be consistent... :-) > >> > >>> > >>> I'd just leave it alone though. > >> > >> I had to explain my reasoning about all of the above, so I'll just wait for > >> your opinion again before going for a v2! :-) > > > > Thanks again for working on this. > > > > ChenYu > > >
diff --git a/drivers/clk/mediatek/clk-mt2712.c b/drivers/clk/mediatek/clk-mt2712.c index c5fd76d1b9df..65c1cbcbd54e 100644 --- a/drivers/clk/mediatek/clk-mt2712.c +++ b/drivers/clk/mediatek/clk-mt2712.c @@ -1028,7 +1028,7 @@ static const struct of_device_id of_match_clk_mt2712_simple[] = { { /* sentinel */ } }; -static struct platform_driver clk_mt2712_simple_drv = { +static struct platform_driver clk_mt2712_drv = { .probe = mtk_clk_simple_probe, .remove = mtk_clk_simple_remove, .driver = { @@ -1036,10 +1036,4 @@ static struct platform_driver clk_mt2712_simple_drv = { .of_match_table = of_match_clk_mt2712_simple, }, }; - -static int __init clk_mt2712_init(void) -{ - return platform_driver_register(&clk_mt2712_simple_drv); -} - -arch_initcall(clk_mt2712_init); +module_platform_driver(clk_mt2712_drv);