From patchwork Thu Jul 12 16:06:24 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hans Verkuil X-Patchwork-Id: 1189791 Return-Path: X-Original-To: patchwork-linux-media@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id 320163FDAE for ; Thu, 12 Jul 2012 16:07:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1161289Ab2GLQHh (ORCPT ); Thu, 12 Jul 2012 12:07:37 -0400 Received: from smtp-vbr11.xs4all.nl ([194.109.24.31]:3561 "EHLO smtp-vbr11.xs4all.nl" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1161293Ab2GLQHg (ORCPT ); Thu, 12 Jul 2012 12:07:36 -0400 Received: from alastor.dyndns.org (166.80-203-20.nextgentel.com [80.203.20.166] (may be forged)) (authenticated bits=0) by smtp-vbr11.xs4all.nl (8.13.8/8.13.8) with ESMTP id q6CG6QHZ048545 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=FAIL); Thu, 12 Jul 2012 18:06:27 +0200 (CEST) (envelope-from hverkuil@xs4all.nl) Received: from tschai.localnet (tschai.lan [192.168.1.10]) (Authenticated sender: hans) by alastor.dyndns.org (Postfix) with ESMTPSA id 388F180037; Thu, 12 Jul 2012 18:06:25 +0200 (CEST) From: Hans Verkuil To: "linux-media" Subject: [PATCH] Use a named union in struct v4l2_ioctl_info Date: Thu, 12 Jul 2012 18:06:24 +0200 User-Agent: KMail/1.13.7 (Linux/3.4.0-rc7-tschai; KDE/4.8.4; x86_64; ; ) Cc: Randy Dunlap , Stephen Rothwell MIME-Version: 1.0 Message-Id: <201207121806.24955.hverkuil@xs4all.nl> X-Virus-Scanned: by XS4ALL Virus Scanner Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org Hi Mauro, struct v4l2_ioctl_info uses an anonymous union, which is initialized in the v4l2_ioctls table. Unfortunately gcc < 4.6 uses a non-standard syntax for that, so trying to compile v4l2-ioctl.c with an older gcc will fail. It is possible to work around this by testing the gcc version, but in this case it is easier to make the union named since it is used in only a few places. Randy, Stephen, this patch should solve the v4l2-ioctl.c compilation problem in linux-next. Since Mauro is still on holiday you'll have to apply it manually. Regards, Hans Signed-off-by: Hans Verkuil Reported-by: Randy Dunlap Acked-by: Randy Dunlap --- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/media/video/v4l2-ioctl.c b/drivers/media/video/v4l2-ioctl.c index 70e0efb..812beb0 100644 --- a/drivers/media/video/v4l2-ioctl.c +++ b/drivers/media/video/v4l2-ioctl.c @@ -1806,7 +1806,7 @@ struct v4l2_ioctl_info { u32 offset; int (*func)(const struct v4l2_ioctl_ops *ops, struct file *file, void *fh, void *p); - }; + } u; void (*debug)(const void *arg, bool write_only); }; @@ -1831,7 +1831,7 @@ struct v4l2_ioctl_info { .ioctl = _ioctl, \ .flags = _flags | INFO_FL_STD, \ .name = #_ioctl, \ - .offset = offsetof(struct v4l2_ioctl_ops, _vidioc), \ + .u.offset = offsetof(struct v4l2_ioctl_ops, _vidioc), \ .debug = _debug, \ } @@ -1840,7 +1840,7 @@ struct v4l2_ioctl_info { .ioctl = _ioctl, \ .flags = _flags | INFO_FL_FUNC, \ .name = #_ioctl, \ - .func = _func, \ + .u.func = _func, \ .debug = _debug, \ } @@ -2038,11 +2038,11 @@ static long __video_do_ioctl(struct file *file, if (info->flags & INFO_FL_STD) { typedef int (*vidioc_op)(struct file *file, void *fh, void *p); const void *p = vfd->ioctl_ops; - const vidioc_op *vidioc = p + info->offset; + const vidioc_op *vidioc = p + info->u.offset; ret = (*vidioc)(file, fh, arg); } else if (info->flags & INFO_FL_FUNC) { - ret = info->func(ops, file, fh, arg); + ret = info->u.func(ops, file, fh, arg); } else if (!ops->vidioc_default) { ret = -ENOTTY; } else {