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: 2851851 Return-Path: X-Original-To: patchwork-linux-media@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 074DA9F2F4 for ; Fri, 30 Aug 2013 09:50:51 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id CD70A20257 for ; Fri, 30 Aug 2013 09:50:49 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id A289120253 for ; Fri, 30 Aug 2013 09:50:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754280Ab3H3Juq (ORCPT ); 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-Spam-Status: No, score=-8.9 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 *