History

[media] uapi/media.h: Rename entities types to functions

Rename the userspace types from MEDIA_ENT_T_ to MEDIA_ENT_F_ and add the backward compatibility bits. The changes at the .c files was generated by the following coccinelle script: @@ @@ -MEDIA_ENT_T_UNKNOWN +MEDIA_ENT_F_UNKNOWN @@ @@ -MEDIA_ENT_T_DVB_BASE +MEDIA_ENT_F_DVB_BASE @@ @@ -MEDIA_ENT_T_V4L2_BASE +MEDIA_ENT_F_V4L2_BASE @@ @@ -MEDIA_ENT_T_V4L2_SUBDEV_BASE +MEDIA_ENT_F_V4L2_SUBDEV_BASE @@ @@ -MEDIA_ENT_T_CONNECTOR_BASE +MEDIA_ENT_F_CONNECTOR_BASE @@ @@ -MEDIA_ENT_T_V4L2_VIDEO +MEDIA_ENT_F_IO_V4L @@ @@ -MEDIA_ENT_T_V4L2_VBI +MEDIA_ENT_F_IO_VBI @@ @@ -MEDIA_ENT_T_V4L2_SWRADIO +MEDIA_ENT_F_IO_SWRADIO @@ @@ -MEDIA_ENT_T_V4L2_SUBDEV_UNKNOWN +MEDIA_ENT_F_V4L2_SUBDEV_UNKNOWN @@ @@ -MEDIA_ENT_T_CONN_RF +MEDIA_ENT_F_CONN_RF @@ @@ -MEDIA_ENT_T_CONN_SVIDEO +MEDIA_ENT_F_CONN_SVIDEO @@ @@ -MEDIA_ENT_T_CONN_COMPOSITE +MEDIA_ENT_F_CONN_COMPOSITE @@ @@ -MEDIA_ENT_T_CONN_TEST +MEDIA_ENT_F_CONN_TEST @@ @@ -MEDIA_ENT_T_V4L2_SUBDEV_SENSOR +MEDIA_ENT_F_CAM_SENSOR @@ @@ -MEDIA_ENT_T_V4L2_SUBDEV_FLASH +MEDIA_ENT_F_FLASH @@ @@ -MEDIA_ENT_T_V4L2_SUBDEV_LENS +MEDIA_ENT_F_LENS @@ @@ -MEDIA_ENT_T_V4L2_SUBDEV_DECODER +MEDIA_ENT_F_ATV_DECODER @@ @@ -MEDIA_ENT_T_V4L2_SUBDEV_TUNER +MEDIA_ENT_F_TUNER @@ @@ -MEDIA_ENT_T_DVB_DEMOD +MEDIA_ENT_F_DTV_DEMOD @@ @@ -MEDIA_ENT_T_DVB_DEMUX +MEDIA_ENT_F_TS_DEMUX @@ @@ -MEDIA_ENT_T_DVB_TSOUT +MEDIA_ENT_F_IO_DTV @@ @@ -MEDIA_ENT_T_DVB_CA +MEDIA_ENT_F_DTV_CA @@ @@ -MEDIA_ENT_T_DVB_NET_DECAP +MEDIA_ENT_F_DTV_NET_DECAP

Mauro Carvalho Chehab committed 10 years ago

Commit 4ca72ef1 parent d87cdb831 files · +127 −121Browse files

Showing the changes to include/uapi (1 of 31 files). Show all

Unified · Split

include/uapi/linux/media.h+64−58
@@ -46,87 +46,93 @@ struct media_device_info { · 45 unmodified lines
46 * Initial value to be used when a new entity is created46 * Initial value to be used when a new entity is created
47 * Drivers should change it to something useful47 * Drivers should change it to something useful
48 */48 */
49#define MEDIA_ENT_T_UNKNOWN 0x0000000049#define MEDIA_ENT_F_UNKNOWN 0x00000000
50 50
51/*51/*
52 * Base numbers for entity types52 * Base number ranges for entity functions
53 *53 *
54 * Please notice that the huge gap of 16 bits for each base is overkill!54 * NOTE: those ranges and entity function number are phased just to
55 * 8 bits is more than enough to avoid starving entity types for each55 * make it easier to maintain this file. Userspace should not rely on
56 * subsystem.56 * the ranges to identify a group of function types, as newer
57 *57 * functions can be added with any name within the full u32 range.
58 * However, It is kept this way just to avoid binary breakages with the
59 * namespace provided on legacy versions of this header.
60 */58 */
61#define MEDIA_ENT_T_DVB_BASE 0x0000000059#define MEDIA_ENT_F_BASE 0x00000000
62#define MEDIA_ENT_T_V4L2_BASE 0x0001000060#define MEDIA_ENT_F_OLD_BASE 0x00010000
63#define MEDIA_ENT_T_V4L2_SUBDEV_BASE 0x0002000061#define MEDIA_ENT_F_OLD_SUBDEV_BASE 0x00020000
64#define MEDIA_ENT_T_CONNECTOR_BASE 0x00030000
65 62
66/*63/*
67 * V4L2 entities - Those are used for DMA (mmap/DMABUF) and64 * DVB entities
68 * read()/write() data I/O associated with the V4L2 devnodes.
69 */65 */
70#define MEDIA_ENT_T_V4L2_VIDEO (MEDIA_ENT_T_V4L2_BASE + 1)66#define MEDIA_ENT_F_DTV_DEMOD (MEDIA_ENT_F_BASE + 1)
71 /*67#define MEDIA_ENT_F_TS_DEMUX (MEDIA_ENT_F_BASE + 2)
72 * Please notice that numbers between MEDIA_ENT_T_V4L2_BASE + 2 and68#define MEDIA_ENT_F_DTV_CA (MEDIA_ENT_F_BASE + 3)
73 * MEDIA_ENT_T_V4L2_BASE + 4 can't be used, as those values used69#define MEDIA_ENT_F_DTV_NET_DECAP (MEDIA_ENT_F_BASE + 4)
74 * to be declared for FB, ALSA and DVB entities.
75 * As those values were never actually used in practice, we're just
76 * adding them as backward compatibility macros and keeping the
77 * numberspace clean here. This way, we avoid breaking compilation,
78 * in the case of having some userspace application using the old
79 * symbols.
80 */
81#define MEDIA_ENT_T_V4L2_VBI (MEDIA_ENT_T_V4L2_BASE + 5)
82#define MEDIA_ENT_T_V4L2_SWRADIO (MEDIA_ENT_T_V4L2_BASE + 6)
83
84/* V4L2 Sub-device entities */
85 70
86/*71/*
72 * Connectors
73 */
74#define MEDIA_ENT_F_CONN_RF (MEDIA_ENT_F_BASE + 21)
75#define MEDIA_ENT_F_CONN_SVIDEO (MEDIA_ENT_F_BASE + 22)
76#define MEDIA_ENT_F_CONN_COMPOSITE (MEDIA_ENT_F_BASE + 23)
77 /* For internal test signal generators and other debug connectors */
78#define MEDIA_ENT_F_CONN_TEST (MEDIA_ENT_F_BASE + 24)
79
80/*
81 * I/O entities
82 */
83#define MEDIA_ENT_F_IO_DTV (MEDIA_ENT_F_BASE + 31)
84#define MEDIA_ENT_F_IO_VBI (MEDIA_ENT_F_BASE + 32)
85#define MEDIA_ENT_F_IO_SWRADIO (MEDIA_ENT_F_BASE + 33)
86
87/*
88 * Don't touch on those. The ranges MEDIA_ENT_F_OLD_BASE and
89 * MEDIA_ENT_F_OLD_SUBDEV_BASE are kept to keep backward compatibility
90 * with the legacy v1 API.The number range is out of range by purpose:
91 * several previously reserved numbers got excluded from this range.
92 *
87 * Subdevs are initialized with MEDIA_ENT_T_V4L2_SUBDEV_UNKNOWN,93 * Subdevs are initialized with MEDIA_ENT_T_V4L2_SUBDEV_UNKNOWN,
88 * in order to preserve backward compatibility.94 * in order to preserve backward compatibility.
89 * Drivers should change to the proper subdev type before95 * Drivers should change to the proper subdev type before
90 * registering the entity.96 * registering the entity.
91 */97 */
92#define MEDIA_ENT_T_V4L2_SUBDEV_UNKNOWN MEDIA_ENT_T_V4L2_SUBDEV_BASE98
93 99#define MEDIA_ENT_F_IO_V4L (MEDIA_ENT_F_OLD_BASE + 1)
94#define MEDIA_ENT_T_V4L2_SUBDEV_SENSOR (MEDIA_ENT_T_V4L2_SUBDEV_BASE + 1)100
95#define MEDIA_ENT_T_V4L2_SUBDEV_FLASH (MEDIA_ENT_T_V4L2_SUBDEV_BASE + 2)101#define MEDIA_ENT_F_CAM_SENSOR (MEDIA_ENT_F_OLD_SUBDEV_BASE + 1)
96#define MEDIA_ENT_T_V4L2_SUBDEV_LENS (MEDIA_ENT_T_V4L2_SUBDEV_BASE + 3)102#define MEDIA_ENT_F_FLASH (MEDIA_ENT_F_OLD_SUBDEV_BASE + 2)
97 /* A converter of analogue video to its digital representation. */103#define MEDIA_ENT_F_LENS (MEDIA_ENT_F_OLD_SUBDEV_BASE + 3)
98#define MEDIA_ENT_T_V4L2_SUBDEV_DECODER (MEDIA_ENT_T_V4L2_SUBDEV_BASE + 4)104#define MEDIA_ENT_F_ATV_DECODER (MEDIA_ENT_F_OLD_SUBDEV_BASE + 4)
99 /* Tuner entity is actually both V4L2 and DVB subdev */105#define MEDIA_ENT_F_TUNER (MEDIA_ENT_F_OLD_SUBDEV_BASE + 5)
100#define MEDIA_ENT_T_V4L2_SUBDEV_TUNER (MEDIA_ENT_T_V4L2_SUBDEV_BASE + 5)106
101 107#define MEDIA_ENT_F_V4L2_SUBDEV_UNKNOWN MEDIA_ENT_F_OLD_SUBDEV_BASE
102/* DVB entities */
103#define MEDIA_ENT_T_DVB_DEMOD (MEDIA_ENT_T_DVB_BASE + 1)
104#define MEDIA_ENT_T_DVB_DEMUX (MEDIA_ENT_T_DVB_BASE + 2)
105#define MEDIA_ENT_T_DVB_TSOUT (MEDIA_ENT_T_DVB_BASE + 3)
106#define MEDIA_ENT_T_DVB_CA (MEDIA_ENT_T_DVB_BASE + 4)
107#define MEDIA_ENT_T_DVB_NET_DECAP (MEDIA_ENT_T_DVB_BASE + 5)
108
109/* Connectors */
110#define MEDIA_ENT_T_CONN_RF (MEDIA_ENT_T_CONNECTOR_BASE + 1)
111#define MEDIA_ENT_T_CONN_SVIDEO (MEDIA_ENT_T_CONNECTOR_BASE + 2)
112#define MEDIA_ENT_T_CONN_COMPOSITE (MEDIA_ENT_T_CONNECTOR_BASE + 3)
113/* For internal test signal generators and other debug connectors */
114#define MEDIA_ENT_T_CONN_TEST (MEDIA_ENT_T_CONNECTOR_BASE + 4)
115 108
116#ifndef __KERNEL__109#ifndef __KERNEL__
117/* Legacy symbols used to avoid userspace compilation breakages */110
111/*
112 * Legacy symbols used to avoid userspace compilation breakages
113 *
114 * Those symbols map the entity function into types and should be
115 * used only on legacy programs for legacy hardware. Don't rely
116 * on those for MEDIA_IOC_G_TOPOLOGY.
117 */
118#define MEDIA_ENT_TYPE_SHIFT 16118#define MEDIA_ENT_TYPE_SHIFT 16
119#define MEDIA_ENT_TYPE_MASK 0x00ff0000119#define MEDIA_ENT_TYPE_MASK 0x00ff0000
120#define MEDIA_ENT_SUBTYPE_MASK 0x0000ffff120#define MEDIA_ENT_SUBTYPE_MASK 0x0000ffff
121 121
122#define MEDIA_ENT_T_DEVNODE MEDIA_ENT_T_V4L2_BASE122#define MEDIA_ENT_T_DEVNODE MEDIA_ENT_F_OLD_BASE
123#define MEDIA_ENT_T_V4L2_SUBDEV MEDIA_ENT_T_V4L2_SUBDEV_BASE123#define MEDIA_ENT_T_DEVNODE_V4L MEDIA_ENT_F_IO_V4L
124
125#define MEDIA_ENT_T_DEVNODE_V4L MEDIA_ENT_T_V4L2_VIDEO
126
127#define MEDIA_ENT_T_DEVNODE_FB (MEDIA_ENT_T_DEVNODE + 2)124#define MEDIA_ENT_T_DEVNODE_FB (MEDIA_ENT_T_DEVNODE + 2)
128#define MEDIA_ENT_T_DEVNODE_ALSA (MEDIA_ENT_T_DEVNODE + 3)125#define MEDIA_ENT_T_DEVNODE_ALSA (MEDIA_ENT_T_DEVNODE + 3)
129#define MEDIA_ENT_T_DEVNODE_DVB (MEDIA_ENT_T_DEVNODE + 4)126#define MEDIA_ENT_T_DEVNODE_DVB (MEDIA_ENT_T_DEVNODE + 4)
127
128#define MEDIA_ENT_T_UNKNOWN MEDIA_ENT_F_UNKNOWN
129#define MEDIA_ENT_T_V4L2_VIDEO MEDIA_ENT_F_IO_V4L
130#define MEDIA_ENT_T_V4L2_SUBDEV MEDIA_ENT_F_V4L2_SUBDEV_UNKNOWN
131#define MEDIA_ENT_T_V4L2_SUBDEV_SENSOR MEDIA_ENT_F_CAM_SENSOR
132#define MEDIA_ENT_T_V4L2_SUBDEV_FLASH MEDIA_ENT_F_FLASH
133#define MEDIA_ENT_T_V4L2_SUBDEV_LENS MEDIA_ENT_F_LENS
134#define MEDIA_ENT_T_V4L2_SUBDEV_DECODER MEDIA_ENT_F_ATV_DECODER
135#define MEDIA_ENT_T_V4L2_SUBDEV_TUNER MEDIA_ENT_F_TUNER
130#endif136#endif
131 137
132/* Entity flags */138/* Entity flags */

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t