diff mbox

clk: sunxi-ng: Move all clock types to a library

Message ID CAK8P3a1Qvt4nvM5HeK-n87tsi2D5GBOmZo0rZv_Lp==CC=34Uw@mail.gmail.com (mailing list archive)
State Superseded
Headers show

Commit Message

Arnd Bergmann June 6, 2017, 10:04 a.m. UTC
On Mon, Jun 5, 2017 at 4:45 PM, Maxime Ripard
<maxime.ripard@free-electrons.com> wrote:
> Hi,
>
> On Sat, Jun 03, 2017 at 12:22:32PM +0800, kbuild test robot wrote:
>> Hi Stephen,
>>
>> [auto build test ERROR on sunxi/sunxi/for-next]
>> [also build test ERROR on next-20170602]
>> [cannot apply to clk/clk-next v4.12-rc3]
>> [if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
>>
>>    sunxi_sid.c:(.data+0x1da8c): undefined reference to `ccu_gate_ops'
>>    sunxi_sid.c:(.data+0x1dac8): undefined reference to `ccu_gate_ops'
>>    sunxi_sid.c:(.data+0x1db20): undefined reference to `ccu_mux_ops'
>>    sunxi_sid.c:(.data+0x1db74): undefined reference to `ccu_mux_ops'
>>    sunxi_sid.c:(.data+0x1dbec): undefined reference to `ccu_mp_ops'
>>    sunxi_sid.c:(.data+0x1dc64): undefined reference to `ccu_mp_ops'
>
> It seems like even though the lib.a file is compiled properly, it is
> never linked in. It looks like we would be supposed to add
> drivers/clk/sunxi-ng/ to libs-y, but that doesn't seem to work for
> Makefiles in drivers/*

Ah, too bad. I see that only one directory under drivers/ uses something
with lib.a, in drivers/firmware/efi/libstub/Makefile, but that seems to
rely on being special-cased as well.

However, this patch seems to fix it:


It's not documented behavior, but I think it's still good enough,
and improves the current version, unless there is another bug
after we add this to your patch.

        Arnd
--
To unsubscribe from this list: send the line "unsubscribe linux-clk" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

Stephen Boyd June 6, 2017, 10:08 p.m. UTC | #1
On 06/06, Arnd Bergmann wrote:
> On Mon, Jun 5, 2017 at 4:45 PM, Maxime Ripard
> <maxime.ripard@free-electrons.com> wrote:
> > Hi,
> >
> > On Sat, Jun 03, 2017 at 12:22:32PM +0800, kbuild test robot wrote:
> >> Hi Stephen,
> >>
> >> [auto build test ERROR on sunxi/sunxi/for-next]
> >> [also build test ERROR on next-20170602]
> >> [cannot apply to clk/clk-next v4.12-rc3]
> >> [if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
> >>
> >>    sunxi_sid.c:(.data+0x1da8c): undefined reference to `ccu_gate_ops'
> >>    sunxi_sid.c:(.data+0x1dac8): undefined reference to `ccu_gate_ops'
> >>    sunxi_sid.c:(.data+0x1db20): undefined reference to `ccu_mux_ops'
> >>    sunxi_sid.c:(.data+0x1db74): undefined reference to `ccu_mux_ops'
> >>    sunxi_sid.c:(.data+0x1dbec): undefined reference to `ccu_mp_ops'
> >>    sunxi_sid.c:(.data+0x1dc64): undefined reference to `ccu_mp_ops'
> >
> > It seems like even though the lib.a file is compiled properly, it is
> > never linked in. It looks like we would be supposed to add
> > drivers/clk/sunxi-ng/ to libs-y, but that doesn't seem to work for
> > Makefiles in drivers/*
> 
> Ah, too bad. I see that only one directory under drivers/ uses something
> with lib.a, in drivers/firmware/efi/libstub/Makefile, but that seems to
> rely on being special-cased as well.
> 
> However, this patch seems to fix it:
> 
> diff --git a/drivers/clk/sunxi-ng/Makefile b/drivers/clk/sunxi-ng/Makefile
> index cbc8cb4f70e3..321d3da7cc6a 100644
> --- a/drivers/clk/sunxi-ng/Makefile
> +++ b/drivers/clk/sunxi-ng/Makefile
> @@ -18,16 +18,16 @@ lib-$(CONFIG_SUNXI_CCU) += ccu_nm.o
>  lib-$(CONFIG_SUNXI_CCU) += ccu_mp.o
> 
>  # SoC support
> -obj-$(CONFIG_SUN50I_A64_CCU) += ccu-sun50i-a64.o
> -obj-$(CONFIG_SUN5I_CCU) += ccu-sun5i.o
> -obj-$(CONFIG_SUN6I_A31_CCU) += ccu-sun6i-a31.o
> -obj-$(CONFIG_SUN8I_A23_CCU) += ccu-sun8i-a23.o
> -obj-$(CONFIG_SUN8I_A33_CCU) += ccu-sun8i-a33.o
> -obj-$(CONFIG_SUN8I_A83T_CCU) += ccu-sun8i-a83t.o
> -obj-$(CONFIG_SUN8I_H3_CCU) += ccu-sun8i-h3.o
> -obj-$(CONFIG_SUN8I_V3S_CCU) += ccu-sun8i-v3s.o
> -obj-$(CONFIG_SUN8I_DE2_CCU) += ccu-sun8i-de2.o
> -obj-$(CONFIG_SUN8I_R_CCU) += ccu-sun8i-r.o
> -obj-$(CONFIG_SUN9I_A80_CCU) += ccu-sun9i-a80.o
> -obj-$(CONFIG_SUN9I_A80_CCU) += ccu-sun9i-a80-de.o
> -obj-$(CONFIG_SUN9I_A80_CCU) += ccu-sun9i-a80-usb.o
> +obj-$(CONFIG_SUN50I_A64_CCU) += ccu-sun50i-a64.o lib.a
> +obj-$(CONFIG_SUN5I_CCU) += ccu-sun5i.o lib.a
> +obj-$(CONFIG_SUN6I_A31_CCU) += ccu-sun6i-a31.o lib.a
> +obj-$(CONFIG_SUN8I_A23_CCU) += ccu-sun8i-a23.o lib.a
> +obj-$(CONFIG_SUN8I_A33_CCU) += ccu-sun8i-a33.o lib.a
> +obj-$(CONFIG_SUN8I_A83T_CCU) += ccu-sun8i-a83t.o lib.a
> +obj-$(CONFIG_SUN8I_H3_CCU) += ccu-sun8i-h3.o lib.a
> +obj-$(CONFIG_SUN8I_V3S_CCU) += ccu-sun8i-v3s.o lib.a
> +obj-$(CONFIG_SUN8I_DE2_CCU) += ccu-sun8i-de2.o lib.a
> +obj-$(CONFIG_SUN8I_R_CCU) += ccu-sun8i-r.o lib.a
> +obj-$(CONFIG_SUN9I_A80_CCU) += ccu-sun9i-a80.o lib.a
> +obj-$(CONFIG_SUN9I_A80_CCU) += ccu-sun9i-a80-de.o lib.a
> +obj-$(CONFIG_SUN9I_A80_CCU) += ccu-sun9i-a80-usb.o lib.a
> 
> It's not documented behavior, but I think it's still good enough,
> and improves the current version, unless there is another bug
> after we add this to your patch.

We should add a comment above this so we know what the lib.a is
all about. As you say, it's not documented.
Chen-Yu Tsai June 7, 2017, 5:45 a.m. UTC | #2
On Tue, Jun 6, 2017 at 6:04 PM, Arnd Bergmann <arnd@arndb.de> wrote:
> On Mon, Jun 5, 2017 at 4:45 PM, Maxime Ripard
> <maxime.ripard@free-electrons.com> wrote:
>> Hi,
>>
>> On Sat, Jun 03, 2017 at 12:22:32PM +0800, kbuild test robot wrote:
>>> Hi Stephen,
>>>
>>> [auto build test ERROR on sunxi/sunxi/for-next]
>>> [also build test ERROR on next-20170602]
>>> [cannot apply to clk/clk-next v4.12-rc3]
>>> [if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
>>>
>>>    sunxi_sid.c:(.data+0x1da8c): undefined reference to `ccu_gate_ops'
>>>    sunxi_sid.c:(.data+0x1dac8): undefined reference to `ccu_gate_ops'
>>>    sunxi_sid.c:(.data+0x1db20): undefined reference to `ccu_mux_ops'
>>>    sunxi_sid.c:(.data+0x1db74): undefined reference to `ccu_mux_ops'
>>>    sunxi_sid.c:(.data+0x1dbec): undefined reference to `ccu_mp_ops'
>>>    sunxi_sid.c:(.data+0x1dc64): undefined reference to `ccu_mp_ops'
>>
>> It seems like even though the lib.a file is compiled properly, it is
>> never linked in. It looks like we would be supposed to add
>> drivers/clk/sunxi-ng/ to libs-y, but that doesn't seem to work for
>> Makefiles in drivers/*
>
> Ah, too bad. I see that only one directory under drivers/ uses something
> with lib.a, in drivers/firmware/efi/libstub/Makefile, but that seems to
> rely on being special-cased as well.
>
> However, this patch seems to fix it:
>
> diff --git a/drivers/clk/sunxi-ng/Makefile b/drivers/clk/sunxi-ng/Makefile
> index cbc8cb4f70e3..321d3da7cc6a 100644
> --- a/drivers/clk/sunxi-ng/Makefile
> +++ b/drivers/clk/sunxi-ng/Makefile
> @@ -18,16 +18,16 @@ lib-$(CONFIG_SUNXI_CCU) += ccu_nm.o
>  lib-$(CONFIG_SUNXI_CCU) += ccu_mp.o
>
>  # SoC support
> -obj-$(CONFIG_SUN50I_A64_CCU) += ccu-sun50i-a64.o
> -obj-$(CONFIG_SUN5I_CCU) += ccu-sun5i.o
> -obj-$(CONFIG_SUN6I_A31_CCU) += ccu-sun6i-a31.o
> -obj-$(CONFIG_SUN8I_A23_CCU) += ccu-sun8i-a23.o
> -obj-$(CONFIG_SUN8I_A33_CCU) += ccu-sun8i-a33.o
> -obj-$(CONFIG_SUN8I_A83T_CCU) += ccu-sun8i-a83t.o
> -obj-$(CONFIG_SUN8I_H3_CCU) += ccu-sun8i-h3.o
> -obj-$(CONFIG_SUN8I_V3S_CCU) += ccu-sun8i-v3s.o
> -obj-$(CONFIG_SUN8I_DE2_CCU) += ccu-sun8i-de2.o
> -obj-$(CONFIG_SUN8I_R_CCU) += ccu-sun8i-r.o
> -obj-$(CONFIG_SUN9I_A80_CCU) += ccu-sun9i-a80.o
> -obj-$(CONFIG_SUN9I_A80_CCU) += ccu-sun9i-a80-de.o
> -obj-$(CONFIG_SUN9I_A80_CCU) += ccu-sun9i-a80-usb.o
> +obj-$(CONFIG_SUN50I_A64_CCU) += ccu-sun50i-a64.o lib.a
> +obj-$(CONFIG_SUN5I_CCU) += ccu-sun5i.o lib.a
> +obj-$(CONFIG_SUN6I_A31_CCU) += ccu-sun6i-a31.o lib.a
> +obj-$(CONFIG_SUN8I_A23_CCU) += ccu-sun8i-a23.o lib.a
> +obj-$(CONFIG_SUN8I_A33_CCU) += ccu-sun8i-a33.o lib.a
> +obj-$(CONFIG_SUN8I_A83T_CCU) += ccu-sun8i-a83t.o lib.a
> +obj-$(CONFIG_SUN8I_H3_CCU) += ccu-sun8i-h3.o lib.a
> +obj-$(CONFIG_SUN8I_V3S_CCU) += ccu-sun8i-v3s.o lib.a
> +obj-$(CONFIG_SUN8I_DE2_CCU) += ccu-sun8i-de2.o lib.a
> +obj-$(CONFIG_SUN8I_R_CCU) += ccu-sun8i-r.o lib.a
> +obj-$(CONFIG_SUN9I_A80_CCU) += ccu-sun9i-a80.o lib.a
> +obj-$(CONFIG_SUN9I_A80_CCU) += ccu-sun9i-a80-de.o lib.a
> +obj-$(CONFIG_SUN9I_A80_CCU) += ccu-sun9i-a80-usb.o lib.a
>
> It's not documented behavior, but I think it's still good enough,
> and improves the current version, unless there is another bug
> after we add this to your patch.

I think having just

obj-$(CONFIG_SUNXI_CCU) += lib.a

at the bottom (with a comment) would be cleaner, and
we wouldn't need to modify all the existing lines.
AFAIK about Makefiles, that should work?

ChenYu

>
>         Arnd
--
To unsubscribe from this list: send the line "unsubscribe linux-clk" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Arnd Bergmann June 7, 2017, 7:36 a.m. UTC | #3
On Wed, Jun 7, 2017 at 7:45 AM, Chen-Yu Tsai <wens@csie.org> wrote:
> at the bottom (with a comment) would be cleaner, and
> we wouldn't need to modify all the existing lines.
> AFAIK about Makefiles, that should work?

Ah, yes. That's much better.

      Arnd
--
To unsubscribe from this list: send the line "unsubscribe linux-clk" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Maxime Ripard June 7, 2017, 8:17 a.m. UTC | #4
On Wed, Jun 07, 2017 at 09:36:34AM +0200, Arnd Bergmann wrote:
> On Wed, Jun 7, 2017 at 7:45 AM, Chen-Yu Tsai <wens@csie.org> wrote:
> > at the bottom (with a comment) would be cleaner, and
> > we wouldn't need to modify all the existing lines.
> > AFAIK about Makefiles, that should work?
> 
> Ah, yes. That's much better.
> 
>       Arnd

I just applied the original patch, with that addition, and a comment
as suggested by Stephen.

thanks!
Maxime
Masahiro Yamada June 8, 2017, 1:46 a.m. UTC | #5
2017-06-07 17:17 GMT+09:00 Maxime Ripard <maxime.ripard@free-electrons.com>:
> On Wed, Jun 07, 2017 at 09:36:34AM +0200, Arnd Bergmann wrote:
>> On Wed, Jun 7, 2017 at 7:45 AM, Chen-Yu Tsai <wens@csie.org> wrote:
>> > at the bottom (with a comment) would be cleaner, and
>> > we wouldn't need to modify all the existing lines.
>> > AFAIK about Makefiles, that should work?
>>
>> Ah, yes. That's much better.
>>
>>       Arnd
>
> I just applied the original patch, with that addition, and a comment
> as suggested by Stephen.
>


Hmm, I think Kbuild expects lib.a only for the final link
(at least in official level)
Is it a problem to compile common files all the time?

# Common objects
obj-y += ccu_common.o
obj-y += ccu_reset.o


We may end up with some unused functions in vmlinux,
but it will not be a big impact on the image size in this case.

CONFIG_LD_DEAD_CODE_DATA_ELIMINATION may
take care of unused symbols.  I have not tested this CONFIG, though.
diff mbox

Patch

diff --git a/drivers/clk/sunxi-ng/Makefile b/drivers/clk/sunxi-ng/Makefile
index cbc8cb4f70e3..321d3da7cc6a 100644
--- a/drivers/clk/sunxi-ng/Makefile
+++ b/drivers/clk/sunxi-ng/Makefile
@@ -18,16 +18,16 @@  lib-$(CONFIG_SUNXI_CCU) += ccu_nm.o
 lib-$(CONFIG_SUNXI_CCU) += ccu_mp.o

 # SoC support
-obj-$(CONFIG_SUN50I_A64_CCU) += ccu-sun50i-a64.o
-obj-$(CONFIG_SUN5I_CCU) += ccu-sun5i.o
-obj-$(CONFIG_SUN6I_A31_CCU) += ccu-sun6i-a31.o
-obj-$(CONFIG_SUN8I_A23_CCU) += ccu-sun8i-a23.o
-obj-$(CONFIG_SUN8I_A33_CCU) += ccu-sun8i-a33.o
-obj-$(CONFIG_SUN8I_A83T_CCU) += ccu-sun8i-a83t.o
-obj-$(CONFIG_SUN8I_H3_CCU) += ccu-sun8i-h3.o
-obj-$(CONFIG_SUN8I_V3S_CCU) += ccu-sun8i-v3s.o
-obj-$(CONFIG_SUN8I_DE2_CCU) += ccu-sun8i-de2.o
-obj-$(CONFIG_SUN8I_R_CCU) += ccu-sun8i-r.o
-obj-$(CONFIG_SUN9I_A80_CCU) += ccu-sun9i-a80.o
-obj-$(CONFIG_SUN9I_A80_CCU) += ccu-sun9i-a80-de.o
-obj-$(CONFIG_SUN9I_A80_CCU) += ccu-sun9i-a80-usb.o
+obj-$(CONFIG_SUN50I_A64_CCU) += ccu-sun50i-a64.o lib.a
+obj-$(CONFIG_SUN5I_CCU) += ccu-sun5i.o lib.a
+obj-$(CONFIG_SUN6I_A31_CCU) += ccu-sun6i-a31.o lib.a
+obj-$(CONFIG_SUN8I_A23_CCU) += ccu-sun8i-a23.o lib.a
+obj-$(CONFIG_SUN8I_A33_CCU) += ccu-sun8i-a33.o lib.a
+obj-$(CONFIG_SUN8I_A83T_CCU) += ccu-sun8i-a83t.o lib.a
+obj-$(CONFIG_SUN8I_H3_CCU) += ccu-sun8i-h3.o lib.a
+obj-$(CONFIG_SUN8I_V3S_CCU) += ccu-sun8i-v3s.o lib.a
+obj-$(CONFIG_SUN8I_DE2_CCU) += ccu-sun8i-de2.o lib.a
+obj-$(CONFIG_SUN8I_R_CCU) += ccu-sun8i-r.o lib.a
+obj-$(CONFIG_SUN9I_A80_CCU) += ccu-sun9i-a80.o lib.a
+obj-$(CONFIG_SUN9I_A80_CCU) += ccu-sun9i-a80-de.o lib.a
+obj-$(CONFIG_SUN9I_A80_CCU) += ccu-sun9i-a80-usb.o lib.a