Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge tag 'media/v4.5-5' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media

Pull media fix from Mauro Carvalho Chehab:
"One last time fix: It adds a code that prevents some media tools like
media-ctl to hide some entities that have their IDs out of the range
expected by those apps"

* tag 'media/v4.5-5' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media:
[media] media-device: map new functions into old types for legacy API

+28 -1
+23
drivers/media/media-device.c
··· 20 20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 21 */ 22 22 23 + /* We need to access legacy defines from linux/media.h */ 24 + #define __NEED_MEDIA_LEGACY_API 25 + 23 26 #include <linux/compat.h> 24 27 #include <linux/export.h> 25 28 #include <linux/idr.h> ··· 118 115 u_ent.group_id = 0; /* Unused */ 119 116 u_ent.pads = ent->num_pads; 120 117 u_ent.links = ent->num_links - ent->num_backlinks; 118 + 119 + /* 120 + * Workaround for a bug at media-ctl <= v1.10 that makes it to 121 + * do the wrong thing if the entity function doesn't belong to 122 + * either MEDIA_ENT_F_OLD_BASE or MEDIA_ENT_F_OLD_SUBDEV_BASE 123 + * Ranges. 124 + * 125 + * Non-subdevices are expected to be at the MEDIA_ENT_F_OLD_BASE, 126 + * or, otherwise, will be silently ignored by media-ctl when 127 + * printing the graphviz diagram. So, map them into the devnode 128 + * old range. 129 + */ 130 + if (ent->function < MEDIA_ENT_F_OLD_BASE || 131 + ent->function > MEDIA_ENT_T_DEVNODE_UNKNOWN) { 132 + if (is_media_entity_v4l2_subdev(ent)) 133 + u_ent.type = MEDIA_ENT_F_V4L2_SUBDEV_UNKNOWN; 134 + else if (ent->function != MEDIA_ENT_F_IO_V4L) 135 + u_ent.type = MEDIA_ENT_T_DEVNODE_UNKNOWN; 136 + } 137 + 121 138 memcpy(&u_ent.raw, &ent->info, sizeof(ent->info)); 122 139 if (copy_to_user(uent, &u_ent, sizeof(u_ent))) 123 140 return -EFAULT;
+5 -1
include/uapi/linux/media.h
··· 120 120 121 121 #define MEDIA_ENT_F_V4L2_SUBDEV_UNKNOWN MEDIA_ENT_F_OLD_SUBDEV_BASE 122 122 123 - #ifndef __KERNEL__ 123 + #if !defined(__KERNEL__) || defined(__NEED_MEDIA_LEGACY_API) 124 124 125 125 /* 126 126 * Legacy symbols used to avoid userspace compilation breakages ··· 132 132 #define MEDIA_ENT_TYPE_SHIFT 16 133 133 #define MEDIA_ENT_TYPE_MASK 0x00ff0000 134 134 #define MEDIA_ENT_SUBTYPE_MASK 0x0000ffff 135 + 136 + /* End of the old subdev reserved numberspace */ 137 + #define MEDIA_ENT_T_DEVNODE_UNKNOWN (MEDIA_ENT_T_DEVNODE | \ 138 + MEDIA_ENT_SUBTYPE_MASK) 135 139 136 140 #define MEDIA_ENT_T_DEVNODE MEDIA_ENT_F_OLD_BASE 137 141 #define MEDIA_ENT_T_DEVNODE_V4L MEDIA_ENT_F_IO_V4L