From patchwork Sat Nov 5 21:42:01 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Clemens Ladisch X-Patchwork-Id: 8315 Received: from mail.tu-berlin.de ([130.149.7.33]) by www.linuxtv.org with esmtp (Exim 4.72) (envelope-from ) id 1RMo1Z-0005LW-57; Sat, 05 Nov 2011 22:43:37 +0100 X-tubIT-Incoming-IP: 209.132.180.67 Received: from vger.kernel.org ([209.132.180.67]) by mail.tu-berlin.de (exim-4.75/mailfrontend-2) with esmtp id 1RMo1U-0000WX-J8; Sat, 05 Nov 2011 22:43:33 +0100 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752002Ab1KEVmL (ORCPT + 3 others); Sat, 5 Nov 2011 17:42:11 -0400 Received: from out5.smtp.messagingengine.com ([66.111.4.29]:60889 "EHLO out5.smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751293Ab1KEVmK (ORCPT ); Sat, 5 Nov 2011 17:42:10 -0400 Received: from compute3.internal (compute3.nyi.mail.srv.osa [10.202.2.43]) by gateway1.nyi.mail.srv.osa (Postfix) with ESMTP id 4F1452011A; Sat, 5 Nov 2011 17:42:09 -0400 (EDT) Received: from frontend1.nyi.mail.srv.osa ([10.202.2.160]) by compute3.internal (MEProxy); Sat, 05 Nov 2011 17:42:09 -0400 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=message-id:date:from:mime-version:to:cc :subject:content-type:content-transfer-encoding; s=smtpout; bh=i NS02gY5WDpg0hifQFFMtrqjyvM=; b=oENXlrTb7caXNFmbKBwvXEZUqrWX8hvKd aeSpQU+xNWZhp8pd6+msJFj90CeRGVnr57aJlrDZ8ZRa30JAFKWlwRjwh8g5WBaT FPgaK0F00S1fWNIiVJMlmZzLTgn9cw+6R2o+PwUcziAA5MO/wV+AQzDnphxlrWxS w4XHfG3gLY= X-Sasl-enc: 86R29aYHa/dt1jZc18qKaY+BIYEiuEZWIJn4dtYqYT67 1320529328 Received: from [192.168.42.188] (unknown [2.211.191.124]) by mail.messagingengine.com (Postfix) with ESMTPSA id 1769A8E105B; Sat, 5 Nov 2011 17:42:06 -0400 (EDT) Message-ID: <4EB5ADA9.6010104@ladisch.de> Date: Sat, 05 Nov 2011 22:42:01 +0100 From: Clemens Ladisch User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.15) Gecko/20110323 Thunderbird/3.1.9 MIME-Version: 1.0 To: Mauro Carvalho Chehab CC: linux-media@vger.kernel.org, alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org Subject: [PATCH] media: fix truncated entity specification Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-PMX-Version: 5.6.1.2065439, Antispam-Engine: 2.7.2.376379, Antispam-Data: 2011.11.5.213314 X-PMX-Spam: Gauge=IIIIIIII, Probability=8%, Report=' MULTIPLE_RCPTS 0.1, MSGID_ADDED_BY_MTA 0.05, BODYTEXTP_SIZE_3000_LESS 0, BODY_SIZE_2000_2999 0, BODY_SIZE_5000_LESS 0, BODY_SIZE_7000_LESS 0, __ANY_URI 0, __CP_MEDIA_BODY 0, __CP_URI_IN_BODY 0, __CT 0, __CTE 0, __CT_TEXT_PLAIN 0, __HAS_MSGID 0, __HAS_X_MAILING_LIST 0, __MIME_TEXT_ONLY 0, __MIME_VERSION 0, __MOZILLA_MSGID 0, __MULTIPLE_RCPTS_CC_X2 0, __SANE_MSGID 0, __TO_MALFORMED_2 0, __URI_NO_WWW 0, __URI_NS , __USER_AGENT 0' X-LSpam-Score: -4.2 (----) X-LSpam-Report: No, score=-4.2 required=5.0 tests=BAYES_00=-1.9, RCVD_IN_DNSWL_MED=-2.3, T_DKIM_INVALID=0.01 autolearn=ham When enumerating an entity, assign the entire entity specification instead of only the first two words. (This requires giving the specification union a name.) So far, no driver actually uses more than two words, but this will be needed for ALSA entities. Signed-off-by: Clemens Ladisch --- include/media/media-entity.h | 2 +- drivers/media/media-device.c | 3 +-- drivers/media/video/v4l2-dev.c | 4 ++-- drivers/media/video/v4l2-device.c | 4 ++-- 4 files changed, 6 insertions(+), 7 deletions(-) -- 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/include/media/media-entity.h b/include/media/media-entity.h index cd8bca6..d13de27 100644 --- a/include/media/media-entity.h +++ b/include/media/media-entity.h @@ -98,7 +98,7 @@ struct media_entity { /* Sub-device specifications */ /* Nothing needed yet */ - }; + } specification; }; static inline u32 media_entity_type(struct media_entity *entity) diff --git a/drivers/media/media-device.c b/drivers/media/media-device.c index 16b70b4..bfb4e0b 100644 --- a/drivers/media/media-device.c +++ b/drivers/media/media-device.c @@ -107,8 +107,7 @@ static long media_device_enum_entities(struct media_device *mdev, u_ent.group_id = ent->group_id; u_ent.pads = ent->num_pads; u_ent.links = ent->num_links - ent->num_backlinks; - u_ent.v4l.major = ent->v4l.major; - u_ent.v4l.minor = ent->v4l.minor; + memcpy(&u_ent.v4l, &ent->specification, sizeof(ent->specification)); if (copy_to_user(uent, &u_ent, sizeof(u_ent))) return -EFAULT; return 0; diff --git a/drivers/media/video/v4l2-dev.c b/drivers/media/video/v4l2-dev.c index a5c9ed1..1eb9ba1 100644 --- a/drivers/media/video/v4l2-dev.c +++ b/drivers/media/video/v4l2-dev.c @@ -703,8 +703,8 @@ int __video_register_device(struct video_device *vdev, int type, int nr, vdev->vfl_type != VFL_TYPE_SUBDEV) { vdev->entity.type = MEDIA_ENT_T_DEVNODE_V4L; vdev->entity.name = vdev->name; - vdev->entity.v4l.major = VIDEO_MAJOR; - vdev->entity.v4l.minor = vdev->minor; + vdev->entity.specification.v4l.major = VIDEO_MAJOR; + vdev->entity.specification.v4l.minor = vdev->minor; ret = media_device_register_entity(vdev->v4l2_dev->mdev, &vdev->entity); if (ret < 0) diff --git a/drivers/media/video/v4l2-device.c b/drivers/media/video/v4l2-device.c index e6a2c3b..d8f58d8 100644 --- a/drivers/media/video/v4l2-device.c +++ b/drivers/media/video/v4l2-device.c @@ -217,8 +217,8 @@ int v4l2_device_register_subdev_nodes(struct v4l2_device *v4l2_dev) if (err < 0) return err; #if defined(CONFIG_MEDIA_CONTROLLER) - sd->entity.v4l.major = VIDEO_MAJOR; - sd->entity.v4l.minor = vdev->minor; + sd->entity.specification.v4l.major = VIDEO_MAJOR; + sd->entity.specification.v4l.minor = vdev->minor; #endif } return 0;