fix compilation issues with GCC < 4.4.6
cover fix compilation issues with GCC < 4.4.6
With GCC 4.4.3 (Ubuntu 10.04) the compilation of the new adv7842 driver fails with this error:
CC [M] adv7842.o
adv7842.c:549: error: unknown field 'bt' specified in initializer adv7842.c:550: error: field name not in record or union initializer adv7842.c:550: error: (near initialization for 'adv7842_timings_cap_analog.reserved') adv7842.c:551: error: field name not in record or union initializer adv7842.c:551: error: (near initialization for 'adv7842_timings_cap_analog.reserved') adv7842.c:552: error: field name not in record or union initializer adv7842.c:552: error: (near initialization for 'adv7842_timings_cap_analog.reserved') adv7842.c:553: error: field name not in record or union initializer adv7842.c:553: error: (near initialization for 'adv7842_timings_cap_analog.reserved') adv7842.c:553: warning: excess elements in array initializer
...
This is caused by the old GCC version (as explained in file v4l2-dv-timings.h). The proposed fix uses the V4L2_INIT_BT_TIMINGS macro defined there. Please note that we need to init the reserved space as well, as otherwise GCC will fail with another error:
CC [M] adv7842.o
adv7842.c:549: error: field name not in record or union initializer adv7842.c:549: error: (near initialization for 'adv7842_timings_cap_analog.reserved') adv7842.c:549: warning: braces around scalar initializer
adv7842.c:549: warning: (near initialization for 'adv7842_timings_cap_analog.reserved[0]')
...
A proper comment was added as a remainder.
The same issue applies to other drivers too: ths8200, adv7511, ad9389b. The present patch series fixes all of them.
Best regards,
Gianluca
Gianluca Gennari (4):
adv7842: fix compilation with GCC < 4.4.6
adv7511: fix compilation with GCC < 4.4.6
ad9389b: fix compilation with GCC < 4.4.6
ths8200: fix compilation with GCC < 4.4.6
drivers/media/i2c/ad9389b.c | 15 ++++++--------- drivers/media/i2c/adv7511.c | 16 +++++++--------- drivers/media/i2c/adv7842.c | 30 ++++++++++++------------------ drivers/media/i2c/ths8200.c | 12 ++++-------- 4 files changed, 29 insertions(+), 44 deletions(-)
Signature · 1 line
1.8.4
PATCH 1/4 adv7842: fix compilation with GCC < 4.4.6
--- drivers/media/i2c/adv7842.c | 30 ++++++++++++------------------ 1 file changed, 12 insertions(+), 18 deletions(-)
drivers/media/i2c/adv7842.c +12 -18
@@ -546,30 +546,24 @@ static inline bool is_digital_input(struct v4l2_subdev *sd)static const struct v4l2_dv_timings_cap adv7842_timings_cap_analog = { .type =V4L2_DV_BT_656_1120 , - .bt = { - .max_width =1920 , - .max_height =1200 , - .min_pixelclock =25000000 , - .max_pixelclock =170000000 , - .standards =V4L2_DV_BT_STD_CEA861 |V4L2_DV_BT_STD_DMT | +/* keep this initialization for compatibility with GCC < 4.4.6 */ + .reserved = {0 }, +V4L2_INIT_BT_TIMINGS (0 ,1920 ,0 ,1200 ,25000000 ,170000000 , +V4L2_DV_BT_STD_CEA861 |V4L2_DV_BT_STD_DMT |V4L2_DV_BT_STD_GTF |V4L2_DV_BT_STD_CVT , - .capabilities =V4L2_DV_BT_CAP_PROGRESSIVE | -V4L2_DV_BT_CAP_REDUCED_BLANKING |V4L2_DV_BT_CAP_CUSTOM , - }, +V4L2_DV_BT_CAP_PROGRESSIVE |V4L2_DV_BT_CAP_REDUCED_BLANKING | +V4L2_DV_BT_CAP_CUSTOM ) };static const struct v4l2_dv_timings_cap adv7842_timings_cap_digital = { .type =V4L2_DV_BT_656_1120 , - .bt = { - .max_width =1920 , - .max_height =1200 , - .min_pixelclock =25000000 , - .max_pixelclock =225000000 , - .standards =V4L2_DV_BT_STD_CEA861 |V4L2_DV_BT_STD_DMT | +/* keep this initialization for compatibility with GCC < 4.4.6 */ + .reserved = {0 }, +V4L2_INIT_BT_TIMINGS (0 ,1920 ,0 ,1200 ,25000000 ,225000000 , +V4L2_DV_BT_STD_CEA861 |V4L2_DV_BT_STD_DMT |V4L2_DV_BT_STD_GTF |V4L2_DV_BT_STD_CVT , - .capabilities =V4L2_DV_BT_CAP_PROGRESSIVE | -V4L2_DV_BT_CAP_REDUCED_BLANKING |V4L2_DV_BT_CAP_CUSTOM , - }, +V4L2_DV_BT_CAP_PROGRESSIVE |V4L2_DV_BT_CAP_REDUCED_BLANKING | +V4L2_DV_BT_CAP_CUSTOM ) }; static inline const struct v4l2_dv_timings_cap *
Signature · 1 line
1.8.4
PATCH 2/4 adv7511: fix compilation with GCC < 4.4.6
In reply to Gianluca Gennari--- drivers/media/i2c/adv7511.c | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-)
drivers/media/i2c/adv7511.c +7 -9
@@ -119,16 +119,14 @@ static int adv7511_s_clock_freq(struct v4l2_subdev *sd, u32 freq);static const struct v4l2_dv_timings_cap adv7511_timings_cap = { .type =V4L2_DV_BT_656_1120 , - .bt = { - .max_width =ADV7511_MAX_WIDTH , - .max_height =ADV7511_MAX_HEIGHT , - .min_pixelclock =ADV7511_MIN_PIXELCLOCK , - .max_pixelclock =ADV7511_MAX_PIXELCLOCK , - .standards =V4L2_DV_BT_STD_CEA861 |V4L2_DV_BT_STD_DMT | +/* keep this initialization for compatibility with GCC < 4.4.6 */ + .reserved = {0 }, +V4L2_INIT_BT_TIMINGS (0 ,ADV7511_MAX_WIDTH ,0 ,ADV7511_MAX_HEIGHT , +ADV7511_MIN_PIXELCLOCK ,ADV7511_MAX_PIXELCLOCK , +V4L2_DV_BT_STD_CEA861 |V4L2_DV_BT_STD_DMT |V4L2_DV_BT_STD_GTF |V4L2_DV_BT_STD_CVT , - .capabilities =V4L2_DV_BT_CAP_PROGRESSIVE | -V4L2_DV_BT_CAP_REDUCED_BLANKING |V4L2_DV_BT_CAP_CUSTOM , - }, +V4L2_DV_BT_CAP_PROGRESSIVE |V4L2_DV_BT_CAP_REDUCED_BLANKING | +V4L2_DV_BT_CAP_CUSTOM ) };static inline struct adv7511_state *get_adv7511_state (struct v4l2_subdev *sd)
Signature · 1 line
1.8.4
PATCH 3/4 ad9389b: fix compilation with GCC < 4.4.6
In reply to Gianluca Gennari--- drivers/media/i2c/ad9389b.c | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-)
drivers/media/i2c/ad9389b.c +6 -9
@@ -628,16 +628,13 @@ static int ad9389b_s_stream(struct v4l2_subdev *sd, int enable)static const struct v4l2_dv_timings_cap ad9389b_timings_cap = { .type =V4L2_DV_BT_656_1120 , - .bt = { - .max_width =1920 , - .max_height =1200 , - .min_pixelclock =25000000 , - .max_pixelclock =170000000 , - .standards =V4L2_DV_BT_STD_CEA861 |V4L2_DV_BT_STD_DMT | +/* keep this initialization for compatibility with GCC < 4.4.6 */ + .reserved = {0 }, +V4L2_INIT_BT_TIMINGS (0 ,1920 ,0 ,1200 ,25000000 ,170000000 , +V4L2_DV_BT_STD_CEA861 |V4L2_DV_BT_STD_DMT |V4L2_DV_BT_STD_GTF |V4L2_DV_BT_STD_CVT , - .capabilities =V4L2_DV_BT_CAP_PROGRESSIVE | -V4L2_DV_BT_CAP_REDUCED_BLANKING |V4L2_DV_BT_CAP_CUSTOM , - }, +V4L2_DV_BT_CAP_PROGRESSIVE |V4L2_DV_BT_CAP_REDUCED_BLANKING | +V4L2_DV_BT_CAP_CUSTOM ) }; static int ad9389b_s_dv_timings(struct v4l2_subdev *sd,
Signature · 1 line
1.8.4
PATCH 4/4 ths8200: fix compilation with GCC < 4.4.6
In reply to Gianluca Gennari--- drivers/media/i2c/ths8200.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-)
drivers/media/i2c/ths8200.c +4 -8
@@ -46,14 +46,10 @@ struct ths8200_state {static const struct v4l2_dv_timings_cap ths8200_timings_cap = { .type =V4L2_DV_BT_656_1120 , - .bt = { - .max_width =1920 , - .max_height =1080 , - .min_pixelclock =25000000 , - .max_pixelclock =148500000 , - .standards =V4L2_DV_BT_STD_CEA861 , - .capabilities =V4L2_DV_BT_CAP_PROGRESSIVE , - }, +/* keep this initialization for compatibility with GCC < 4.4.6 */ + .reserved = {0 }, +V4L2_INIT_BT_TIMINGS (0 ,1920 ,0 ,1080 ,25000000 ,148500000 , +V4L2_DV_BT_STD_CEA861 ,V4L2_DV_BT_CAP_PROGRESSIVE ) };static inline struct ths8200_state *to_state (struct v4l2_subdev *sd)
Signature · 1 line
1.8.4