diff mbox

clk: uniphier: Fix build with gcc-4.4.

Message ID 1480725436-9628-1-git-send-email-vlee@freedesktop.org (mailing list archive)
State Rejected, archived
Delegated to: Stephen Boyd
Headers show

Commit Message

Vinson Lee Dec. 3, 2016, 12:37 a.m. UTC
gcc-4.4 has issues with anonymous unions in initializers.

  CC      drivers/clk/uniphier/clk-uniphier-sys.o
drivers/clk/uniphier/clk-uniphier-sys.c:45: error: unknown field ‘factor’ specified in initializer

Fixes: 1574d5722636 ("clk: uniphier: remove unneeded member name for union")
Signed-off-by: Vinson Lee <vlee@freedesktop.org>
---
 drivers/clk/uniphier/clk-uniphier-mio.c |  4 ++--
 drivers/clk/uniphier/clk-uniphier.h     | 12 ++++++------
 2 files changed, 8 insertions(+), 8 deletions(-)

Comments

Masahiro Yamada Dec. 3, 2016, 1:24 a.m. UTC | #1
Hi Vinson,

2016-12-03 9:37 GMT+09:00 Vinson Lee <vlee@freedesktop.org>:
> gcc-4.4 has issues with anonymous unions in initializers.
>
>   CC      drivers/clk/uniphier/clk-uniphier-sys.o
> drivers/clk/uniphier/clk-uniphier-sys.c:45: error: unknown field ‘factor’ specified in initializer
>
> Fixes: 1574d5722636 ("clk: uniphier: remove unneeded member name for union")
> Signed-off-by: Vinson Lee <vlee@freedesktop.org>


This driver has COMPILE_TEST option, but kbuild test robot
did not mention about this.



This is a bad way of fixing, I think.
(what if a new member is inserted before the union in the future?)

Rather, please revert the bad commit.


>                 .name = "sd" #ch "-sel",                                \
>                 .type = UNIPHIER_CLK_TYPE_MUX,                          \
>                 .idx = -1,                                              \
> -               .mux = {                                                \
> +               { .mux = {                                              \
>                         .parent_names = {                               \
>                                 "sd-44m",                               \
>                                 "sd-33m",                               \
> @@ -63,7 +63,7 @@
>                                 0x00001200,                             \
>                                 0x00001300,                             \
>                         },                                              \
> -               },                                                      \
> +               } },                                                    \
>         },                                                              \


No, please do not do this.
Stephen Boyd Dec. 6, 2016, 11:16 p.m. UTC | #2
On 12/03, Masahiro Yamada wrote:
> Hi Vinson,
> 
> 2016-12-03 9:37 GMT+09:00 Vinson Lee <vlee@freedesktop.org>:
> > gcc-4.4 has issues with anonymous unions in initializers.
> >
> >   CC      drivers/clk/uniphier/clk-uniphier-sys.o
> > drivers/clk/uniphier/clk-uniphier-sys.c:45: error: unknown field ‘factor’ specified in initializer
> >
> > Fixes: 1574d5722636 ("clk: uniphier: remove unneeded member name for union")
> > Signed-off-by: Vinson Lee <vlee@freedesktop.org>
> 
> 
> This driver has COMPILE_TEST option, but kbuild test robot
> did not mention about this.
> 
> 
> 
> This is a bad way of fixing, I think.
> (what if a new member is inserted before the union in the future?)
> 
> Rather, please revert the bad commit.
> 

Reverting on top of clk-next will cause build failures though.
Can you resend the patch series without this first patch please?
I'll apply them then.

I'll go drop all three patches and wreck Andrew's merge of this
patch to -mm.
Masahiro Yamada Dec. 7, 2016, 1:34 a.m. UTC | #3
Hi Stephen,


2016-12-07 8:16 GMT+09:00 Stephen Boyd <sboyd@codeaurora.org>:
> On 12/03, Masahiro Yamada wrote:
>> Hi Vinson,
>>
>> 2016-12-03 9:37 GMT+09:00 Vinson Lee <vlee@freedesktop.org>:
>> > gcc-4.4 has issues with anonymous unions in initializers.
>> >
>> >   CC      drivers/clk/uniphier/clk-uniphier-sys.o
>> > drivers/clk/uniphier/clk-uniphier-sys.c:45: error: unknown field ‘factor’ specified in initializer
>> >
>> > Fixes: 1574d5722636 ("clk: uniphier: remove unneeded member name for union")
>> > Signed-off-by: Vinson Lee <vlee@freedesktop.org>
>>
>>
>> This driver has COMPILE_TEST option, but kbuild test robot
>> did not mention about this.
>>
>>
>>
>> This is a bad way of fixing, I think.
>> (what if a new member is inserted before the union in the future?)
>>
>> Rather, please revert the bad commit.
>>
>
> Reverting on top of clk-next will cause build failures though.
> Can you resend the patch series without this first patch please?
> I'll apply them then.
>
> I'll go drop all three patches and wreck Andrew's merge of this
> patch to -mm.


I dropped the first one
and v3 (for the last two) is on the ML now.

Thanks a lot for taking care of this!
Arnd Bergmann Dec. 7, 2016, 10:48 p.m. UTC | #4
On Tuesday, December 6, 2016 3:16:42 PM CET Stephen Boyd wrote:
> On 12/03, Masahiro Yamada wrote:
> > 2016-12-03 9:37 GMT+09:00 Vinson Lee <vlee@freedesktop.org>:
> > > gcc-4.4 has issues with anonymous unions in initializers.
> > >
> > >   CC      drivers/clk/uniphier/clk-uniphier-sys.o
> > > drivers/clk/uniphier/clk-uniphier-sys.c:45: error: unknown field ‘factor’ specified in initializer
> > > 
> I'll go drop all three patches and wreck Andrew's merge of this
> patch to -mm.

While the specific bug is resolved now, I'm curious about the
motivation for the first fix: Vinson, are you actually using
a seven year old compiler to build modern kernels in order
to run them on real systems, or is this for the purpose of
build testing only?

It would be good to know if there are actual requirements
for using compilers this old (or even older, as according
to the README file, we theoretically support building even
with gcc-3.2 from 2002), in case we ever want to officially
raise the minimum required versions.

I see that gcc-4.3 builds an ARM defconfig kernel 17% faster than
gcc-7.0, which may be nice for build testing, but it also produces
thousands of false-positive warnings, which makes it rather
useless for actually finding bugs in build testing.

	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
diff mbox

Patch

diff --git a/drivers/clk/uniphier/clk-uniphier-mio.c b/drivers/clk/uniphier/clk-uniphier-mio.c
index 4974d38..7441eeb 100644
--- a/drivers/clk/uniphier/clk-uniphier-mio.c
+++ b/drivers/clk/uniphier/clk-uniphier-mio.c
@@ -30,7 +30,7 @@ 
 		.name = "sd" #ch "-sel",				\
 		.type = UNIPHIER_CLK_TYPE_MUX,				\
 		.idx = -1,						\
-		.mux = {						\
+		{ .mux = {						\
 			.parent_names = {				\
 				"sd-44m",				\
 				"sd-33m",				\
@@ -63,7 +63,7 @@ 
 				0x00001200,				\
 				0x00001300,				\
 			},						\
-		},							\
+		} },							\
 	},								\
 	UNIPHIER_CLK_GATE("sd" #ch, (_idx), "sd" #ch "-sel", 0x20 + 0x200 * (ch), 8)
 
diff --git a/drivers/clk/uniphier/clk-uniphier.h b/drivers/clk/uniphier/clk-uniphier.h
index 81d7e5c..8735a7d 100644
--- a/drivers/clk/uniphier/clk-uniphier.h
+++ b/drivers/clk/uniphier/clk-uniphier.h
@@ -81,12 +81,12 @@  struct uniphier_clk_data {
 		.name = (_name),				\
 		.type = UNIPHIER_CLK_TYPE_CPUGEAR,		\
 		.idx = (_idx),					\
-		.cpugear = {					\
+		{ .cpugear = {					\
 			.parent_names = { __VA_ARGS__ },	\
 			.num_parents = (_num_parents),		\
 			.regbase = (_regbase),			\
 			.mask = (_mask)				\
-		 },						\
+		 } },						\
 	}
 
 #define UNIPHIER_CLK_FACTOR(_name, _idx, _parent, _mult, _div)	\
@@ -94,11 +94,11 @@  struct uniphier_clk_data {
 		.name = (_name),				\
 		.type = UNIPHIER_CLK_TYPE_FIXED_FACTOR,		\
 		.idx = (_idx),					\
-		.factor = {					\
+		{ .factor = {					\
 			.parent_name = (_parent),		\
 			.mult = (_mult),			\
 			.div = (_div),				\
-		},						\
+		} },						\
 	}
 
 #define UNIPHIER_CLK_GATE(_name, _idx, _parent, _reg, _bit)	\
@@ -106,11 +106,11 @@  struct uniphier_clk_data {
 		.name = (_name),				\
 		.type = UNIPHIER_CLK_TYPE_GATE,			\
 		.idx = (_idx),					\
-		.gate = {					\
+		{ .gate = {					\
 			.parent_name = (_parent),		\
 			.reg = (_reg),				\
 			.bit = (_bit),				\
-		},						\
+		} },						\
 	}
 
 #define UNIPHIER_CLK_DIV(parent, div)				\