From patchwork Fri Aug 30 09:50:27 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gianluca Gennari X-Patchwork-Id: 19988 Received: from mail.tu-berlin.de ([130.149.7.33]) by www.linuxtv.org with esmtp (Exim 4.72) (envelope-from ) id 1VFLLu-0004Ds-9v; Fri, 30 Aug 2013 11:50:50 +0200 X-tubIT-Incoming-IP: 209.132.180.67 Received: from vger.kernel.org ([209.132.180.67]) by mail.tu-berlin.de (exim-4.72/mailfrontend-8) with esmtp id 1VFLLs-0008AF-jZ; Fri, 30 Aug 2013 11:50:49 +0200 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754280Ab3H3Juq (ORCPT + 1 other); Fri, 30 Aug 2013 05:50:46 -0400 Received: from mail-ee0-f51.google.com ([74.125.83.51]:42167 "EHLO mail-ee0-f51.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753696Ab3H3Jup (ORCPT ); Fri, 30 Aug 2013 05:50:45 -0400 Received: by mail-ee0-f51.google.com with SMTP id c1so797358eek.10 for ; Fri, 30 Aug 2013 02:50:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=eyB2npIjr2QfW4zwSsKyublgo1ESQ0gfOllL8S5L2Sc=; b=QQTfvdoG7SUsAszFUjPJ7J9ZND2pnAvLKBAL50aZVPcAMKQfz7SlTlfZ0EycMsbx4h R4KVEVjVZanx8BWENdMTkXbdPWNw0Of/cBdcWDRiCTj+XqtTWGtSLsPjKwRrks1P5TGT 6H9OF3Yih9pdydJYs8PqLfPE7kY2hn/D9VZhMUGIuK0VggY376joBshKITciFCsYPeRv VnWdmb91OjqOO5D8ywEBEZKf9RSo1FFINo7QF41ufo5Mo1ZPsnWdVvP3p/iOpfrPTVKh /sOw3M+d2bwzP6qd7pS6CdExiSVEGhnnSlL8Eq/5GY69Wue0kp7P1k7BzCT9GoJMphmf onhA== X-Received: by 10.15.48.197 with SMTP id h45mr11452975eew.0.1377856244424; Fri, 30 Aug 2013 02:50:44 -0700 (PDT) Received: from precision.spark.local (host84-170-static.92-94-b.business.telecomitalia.it. [94.92.170.84]) by mx.google.com with ESMTPSA id d8sm53227587eeh.8.1969.12.31.16.00.00 (version=TLSv1 cipher=RC4-SHA bits=128/128); Fri, 30 Aug 2013 02:50:43 -0700 (PDT) From: Gianluca Gennari To: linux-media@vger.kernel.org, m.chehab@samsung.com, hans.verkuil@cisco.com Cc: Gianluca Gennari Subject: [RFC PATCH] adv7842: fix compilation with GCC < 4.4.6 Date: Fri, 30 Aug 2013 11:50:27 +0200 Message-Id: <1377856227-22601-1-git-send-email-gennarone@gmail.com> X-Mailer: git-send-email 1.8.4 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-PMX-Version: 6.0.0.2142326, Antispam-Engine: 2.7.2.2107409, Antispam-Data: 2013.8.30.94237 X-PMX-Spam: Gauge=IIIIIIIII, Probability=9%, Report=' FORGED_FROM_GMAIL 0.1, HTML_00_01 0.05, HTML_00_10 0.05, LINES_OF_YELLING_3 0.05, BODY_SIZE_3000_3999 0, BODY_SIZE_5000_LESS 0, BODY_SIZE_7000_LESS 0, DKIM_SIGNATURE 0, URI_ENDS_IN_HTML 0, __ANY_URI 0, __CP_URI_IN_BODY 0, __FRAUD_BODY_WEBMAIL 0, __FRAUD_WEBMAIL 0, __FRAUD_WEBMAIL_FROM 0, __FROM_GMAIL 0, __HAS_FROM 0, __HAS_MSGID 0, __HAS_X_MAILER 0, __HAS_X_MAILING_LIST 0, __LINES_OF_YELLING 0, __MIME_TEXT_ONLY 0, __PHISH_SPEAR_STRUCTURE_1 0, __SANE_MSGID 0, __TO_MALFORMED_2 0, __TO_NO_NAME 0, __URI_NO_WWW 0, __URI_NS , __YOUTUBE_RCVD 0' 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 I have also to init the reserved space as otherwise GCC fails with this 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]') ... Maybe the reserved space in struct v4l2_dv_timings_cap could be moved after the 'bt' field to avoid this? The same issue applies to other drivers too: ths8200, adv7511 and ad9389b. If the fix is approved, I can post a patch serie fixing all of them. Signed-off-by: Gianluca Gennari --- drivers/media/i2c/adv7842.c | 28 ++++++++++------------------ 1 file changed, 10 insertions(+), 18 deletions(-) diff --git a/drivers/media/i2c/adv7842.c b/drivers/media/i2c/adv7842.c index d174890..c21621b 100644 --- a/drivers/media/i2c/adv7842.c +++ b/drivers/media/i2c/adv7842.c @@ -546,30 +546,22 @@ 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 | + .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 | + .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 *