diff mbox series

[v2,36/47] clk: mediatek: mt2712: Change Kconfig options to allow module build

Message ID 20230214134127.59273-37-angelogioacchino.delregno@collabora.com (mailing list archive)
State Superseded, archived
Headers show
Series MediaTek clocks: full module build and cleanups | expand

Commit Message

AngeloGioacchino Del Regno Feb. 14, 2023, 1:41 p.m. UTC
All of the mt2712 drivers have been converted to platform drivers!
Change the Kconfig options for all MT2712 clocks to tristate to allow
building all clock drivers as modules.

Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
---
 drivers/clk/mediatek/Kconfig | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

Comments

Chen-Yu Tsai Feb. 17, 2023, 4:24 a.m. UTC | #1
On Tue, Feb 14, 2023 at 9:42 PM AngeloGioacchino Del Regno
<angelogioacchino.delregno@collabora.com> wrote:
>
> All of the mt2712 drivers have been converted to platform drivers!
> Change the Kconfig options for all MT2712 clocks to tristate to allow
> building all clock drivers as modules.
>
> Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
> ---
>  drivers/clk/mediatek/Kconfig | 16 ++++++++--------
>  1 file changed, 8 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/clk/mediatek/Kconfig b/drivers/clk/mediatek/Kconfig
> index b9c0a9e21cf1..45b7aea7648d 100644
> --- a/drivers/clk/mediatek/Kconfig
> +++ b/drivers/clk/mediatek/Kconfig
> @@ -75,7 +75,7 @@ config COMMON_CLK_MT2701_G3DSYS
>           This driver supports MediaTek MT2701 g3dsys clocks.
>
>  config COMMON_CLK_MT2712
> -       bool "Clock driver for MediaTek MT2712"
> +       tristate "Clock driver for MediaTek MT2712"

Hmm... How does that work out if mt2712-apmixedsys is a
builtin_platform_driver?

ChenYu
Chen-Yu Tsai Feb. 17, 2023, 5:01 a.m. UTC | #2
On Fri, Feb 17, 2023 at 12:24 PM Chen-Yu Tsai <wenst@chromium.org> wrote:
>
> On Tue, Feb 14, 2023 at 9:42 PM AngeloGioacchino Del Regno
> <angelogioacchino.delregno@collabora.com> wrote:
> >
> > All of the mt2712 drivers have been converted to platform drivers!
> > Change the Kconfig options for all MT2712 clocks to tristate to allow
> > building all clock drivers as modules.
> >
> > Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
> > ---
> >  drivers/clk/mediatek/Kconfig | 16 ++++++++--------
> >  1 file changed, 8 insertions(+), 8 deletions(-)
> >
> > diff --git a/drivers/clk/mediatek/Kconfig b/drivers/clk/mediatek/Kconfig
> > index b9c0a9e21cf1..45b7aea7648d 100644
> > --- a/drivers/clk/mediatek/Kconfig
> > +++ b/drivers/clk/mediatek/Kconfig
> > @@ -75,7 +75,7 @@ config COMMON_CLK_MT2701_G3DSYS
> >           This driver supports MediaTek MT2701 g3dsys clocks.
> >
> >  config COMMON_CLK_MT2712
> > -       bool "Clock driver for MediaTek MT2712"
> > +       tristate "Clock driver for MediaTek MT2712"
>
> Hmm... How does that work out if mt2712-apmixedsys is a
> builtin_platform_driver?

Nevermind. I figured it out.

Reviewed-by: Chen-Yu Tsai <wenst@chromium.org>
AngeloGioacchino Del Regno Feb. 17, 2023, 11:25 a.m. UTC | #3
Il 17/02/23 05:24, Chen-Yu Tsai ha scritto:
> On Tue, Feb 14, 2023 at 9:42 PM AngeloGioacchino Del Regno
> <angelogioacchino.delregno@collabora.com> wrote:
>>
>> All of the mt2712 drivers have been converted to platform drivers!
>> Change the Kconfig options for all MT2712 clocks to tristate to allow
>> building all clock drivers as modules.
>>
>> Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
>> ---
>>   drivers/clk/mediatek/Kconfig | 16 ++++++++--------
>>   1 file changed, 8 insertions(+), 8 deletions(-)
>>
>> diff --git a/drivers/clk/mediatek/Kconfig b/drivers/clk/mediatek/Kconfig
>> index b9c0a9e21cf1..45b7aea7648d 100644
>> --- a/drivers/clk/mediatek/Kconfig
>> +++ b/drivers/clk/mediatek/Kconfig
>> @@ -75,7 +75,7 @@ config COMMON_CLK_MT2701_G3DSYS
>>            This driver supports MediaTek MT2701 g3dsys clocks.
>>
>>   config COMMON_CLK_MT2712
>> -       bool "Clock driver for MediaTek MT2712"
>> +       tristate "Clock driver for MediaTek MT2712"
> 
> Hmm... How does that work out if mt2712-apmixedsys is a
> builtin_platform_driver?
> 
> ChenYu

That doesn't. Thanks for catching that, I've added a .remove() callback
and changed it to module_platform_driver() for v3!

Cheers,
Angelo
Chen-Yu Tsai Feb. 17, 2023, 3:19 p.m. UTC | #4
On Fri, Feb 17, 2023 at 7:25 PM AngeloGioacchino Del Regno
<angelogioacchino.delregno@collabora.com> wrote:
>
> Il 17/02/23 05:24, Chen-Yu Tsai ha scritto:
> > On Tue, Feb 14, 2023 at 9:42 PM AngeloGioacchino Del Regno
> > <angelogioacchino.delregno@collabora.com> wrote:
> >>
> >> All of the mt2712 drivers have been converted to platform drivers!
> >> Change the Kconfig options for all MT2712 clocks to tristate to allow
> >> building all clock drivers as modules.
> >>
> >> Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
> >> ---
> >>   drivers/clk/mediatek/Kconfig | 16 ++++++++--------
> >>   1 file changed, 8 insertions(+), 8 deletions(-)
> >>
> >> diff --git a/drivers/clk/mediatek/Kconfig b/drivers/clk/mediatek/Kconfig
> >> index b9c0a9e21cf1..45b7aea7648d 100644
> >> --- a/drivers/clk/mediatek/Kconfig
> >> +++ b/drivers/clk/mediatek/Kconfig
> >> @@ -75,7 +75,7 @@ config COMMON_CLK_MT2701_G3DSYS
> >>            This driver supports MediaTek MT2701 g3dsys clocks.
> >>
> >>   config COMMON_CLK_MT2712
> >> -       bool "Clock driver for MediaTek MT2712"
> >> +       tristate "Clock driver for MediaTek MT2712"
> >
> > Hmm... How does that work out if mt2712-apmixedsys is a
> > builtin_platform_driver?
> >
> > ChenYu
>
> That doesn't. Thanks for catching that, I've added a .remove() callback
> and changed it to module_platform_driver() for v3!

Actually, I thought that if it were built as a module, then the
builtin_platform_driver would then expand to a module_init() without
module_exit(). So it would become a loadable module that cannot be
unloaded.

That was just looking at the header files, so I could be mistaken.

Side note: IIRC a missing .remove() driver callback doesn't actually
block driver removal or unbinding.

ChenYu
AngeloGioacchino Del Regno Feb. 20, 2023, 9:01 a.m. UTC | #5
Il 17/02/23 16:19, Chen-Yu Tsai ha scritto:
> On Fri, Feb 17, 2023 at 7:25 PM AngeloGioacchino Del Regno
> <angelogioacchino.delregno@collabora.com> wrote:
>>
>> Il 17/02/23 05:24, Chen-Yu Tsai ha scritto:
>>> On Tue, Feb 14, 2023 at 9:42 PM AngeloGioacchino Del Regno
>>> <angelogioacchino.delregno@collabora.com> wrote:
>>>>
>>>> All of the mt2712 drivers have been converted to platform drivers!
>>>> Change the Kconfig options for all MT2712 clocks to tristate to allow
>>>> building all clock drivers as modules.
>>>>
>>>> Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
>>>> ---
>>>>    drivers/clk/mediatek/Kconfig | 16 ++++++++--------
>>>>    1 file changed, 8 insertions(+), 8 deletions(-)
>>>>
>>>> diff --git a/drivers/clk/mediatek/Kconfig b/drivers/clk/mediatek/Kconfig
>>>> index b9c0a9e21cf1..45b7aea7648d 100644
>>>> --- a/drivers/clk/mediatek/Kconfig
>>>> +++ b/drivers/clk/mediatek/Kconfig
>>>> @@ -75,7 +75,7 @@ config COMMON_CLK_MT2701_G3DSYS
>>>>             This driver supports MediaTek MT2701 g3dsys clocks.
>>>>
>>>>    config COMMON_CLK_MT2712
>>>> -       bool "Clock driver for MediaTek MT2712"
>>>> +       tristate "Clock driver for MediaTek MT2712"
>>>
>>> Hmm... How does that work out if mt2712-apmixedsys is a
>>> builtin_platform_driver?
>>>
>>> ChenYu
>>
>> That doesn't. Thanks for catching that, I've added a .remove() callback
>> and changed it to module_platform_driver() for v3!
> 
> Actually, I thought that if it were built as a module, then the
> builtin_platform_driver would then expand to a module_init() without
> module_exit(). So it would become a loadable module that cannot be
> unloaded.
> 
> That was just looking at the header files, so I could be mistaken.
> 
> Side note: IIRC a missing .remove() driver callback doesn't actually
> block driver removal or unbinding.
> 

It doesn't, but we'd leak memory because of the kzalloc() that happened
at the beginning of the probe function... so adding the .remove() callback
was pretty much necessary :-)

Thanks,
Angelo

> ChenYu
>
diff mbox series

Patch

diff --git a/drivers/clk/mediatek/Kconfig b/drivers/clk/mediatek/Kconfig
index b9c0a9e21cf1..45b7aea7648d 100644
--- a/drivers/clk/mediatek/Kconfig
+++ b/drivers/clk/mediatek/Kconfig
@@ -75,7 +75,7 @@  config COMMON_CLK_MT2701_G3DSYS
 	  This driver supports MediaTek MT2701 g3dsys clocks.
 
 config COMMON_CLK_MT2712
-	bool "Clock driver for MediaTek MT2712"
+	tristate "Clock driver for MediaTek MT2712"
 	depends on (ARCH_MEDIATEK && ARM64) || COMPILE_TEST
 	select COMMON_CLK_MEDIATEK
 	default ARCH_MEDIATEK && ARM64
@@ -83,43 +83,43 @@  config COMMON_CLK_MT2712
 	  This driver supports MediaTek MT2712 basic clocks.
 
 config COMMON_CLK_MT2712_BDPSYS
-	bool "Clock driver for MediaTek MT2712 bdpsys"
+	tristate "Clock driver for MediaTek MT2712 bdpsys"
 	depends on COMMON_CLK_MT2712
 	help
 	  This driver supports MediaTek MT2712 bdpsys clocks.
 
 config COMMON_CLK_MT2712_IMGSYS
-	bool "Clock driver for MediaTek MT2712 imgsys"
+	tristate "Clock driver for MediaTek MT2712 imgsys"
 	depends on COMMON_CLK_MT2712
 	help
 	  This driver supports MediaTek MT2712 imgsys clocks.
 
 config COMMON_CLK_MT2712_JPGDECSYS
-	bool "Clock driver for MediaTek MT2712 jpgdecsys"
+	tristate "Clock driver for MediaTek MT2712 jpgdecsys"
 	depends on COMMON_CLK_MT2712
 	help
 	  This driver supports MediaTek MT2712 jpgdecsys clocks.
 
 config COMMON_CLK_MT2712_MFGCFG
-	bool "Clock driver for MediaTek MT2712 mfgcfg"
+	tristate "Clock driver for MediaTek MT2712 mfgcfg"
 	depends on COMMON_CLK_MT2712
 	help
 	  This driver supports MediaTek MT2712 mfgcfg clocks.
 
 config COMMON_CLK_MT2712_MMSYS
-	bool "Clock driver for MediaTek MT2712 mmsys"
+	tristate "Clock driver for MediaTek MT2712 mmsys"
 	depends on COMMON_CLK_MT2712
 	help
 	  This driver supports MediaTek MT2712 mmsys clocks.
 
 config COMMON_CLK_MT2712_VDECSYS
-	bool "Clock driver for MediaTek MT2712 vdecsys"
+	tristate "Clock driver for MediaTek MT2712 vdecsys"
 	depends on COMMON_CLK_MT2712
 	help
 	  This driver supports MediaTek MT2712 vdecsys clocks.
 
 config COMMON_CLK_MT2712_VENCSYS
-	bool "Clock driver for MediaTek MT2712 vencsys"
+	tristate "Clock driver for MediaTek MT2712 vencsys"
 	depends on COMMON_CLK_MT2712
 	help
 	  This driver supports MediaTek MT2712 vencsys clocks.