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
4646 * Initial value to be used when a new entity is created
4747 * Drivers should change it to something useful
4848 */
49−#define MEDIA_ENT_T_UNKNOWN 0x00000000
49+#define MEDIA_ENT_F_UNKNOWN 0x00000000
5050
5151 /*
52− * Base numbers for entity types
52+ * Base number ranges for entity functions
5353 *
54− * Please notice that the huge gap of 16 bits for each base is overkill!
55− * 8 bits is more than enough to avoid starving entity types for each
56− * subsystem.
57− *
58− * However, It is kept this way just to avoid binary breakages with the
59− * namespace provided on legacy versions of this header.
54+ * NOTE: those ranges and entity function number are phased just to
55+ * make it easier to maintain this file. Userspace should not rely on
56+ * the ranges to identify a group of function types, as newer
57+ * functions can be added with any name within the full u32 range.
6058 */
61−#define MEDIA_ENT_T_DVB_BASE 0x00000000
62−#define MEDIA_ENT_T_V4L2_BASE 0x00010000
63−#define MEDIA_ENT_T_V4L2_SUBDEV_BASE 0x00020000
64−#define MEDIA_ENT_T_CONNECTOR_BASE 0x00030000
59+#define MEDIA_ENT_F_BASE 0x00000000
60+#define MEDIA_ENT_F_OLD_BASE 0x00010000
61+#define MEDIA_ENT_F_OLD_SUBDEV_BASE 0x00020000
6562
6663 /*
67− * V4L2 entities - Those are used for DMA (mmap/DMABUF) and
68− * read()/write() data I/O associated with the V4L2 devnodes.
64+ * DVB entities
6965 */
70−#define MEDIA_ENT_T_V4L2_VIDEO (MEDIA_ENT_T_V4L2_BASE + 1)
71− /*
72− * Please notice that numbers between MEDIA_ENT_T_V4L2_BASE + 2 and
73− * MEDIA_ENT_T_V4L2_BASE + 4 can't be used, as those values used
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 */
66+#define MEDIA_ENT_F_DTV_DEMOD (MEDIA_ENT_F_BASE + 1)
67+#define MEDIA_ENT_F_TS_DEMUX (MEDIA_ENT_F_BASE + 2)
68+#define MEDIA_ENT_F_DTV_CA (MEDIA_ENT_F_BASE + 3)
69+#define MEDIA_ENT_F_DTV_NET_DECAP (MEDIA_ENT_F_BASE + 4)
8570
8671 /*
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+ *
8793 * Subdevs are initialized with MEDIA_ENT_T_V4L2_SUBDEV_UNKNOWN,
8894 * in order to preserve backward compatibility.
8995 * Drivers should change to the proper subdev type before
9096 * registering the entity.
9197 */
92−#define MEDIA_ENT_T_V4L2_SUBDEV_UNKNOWN MEDIA_ENT_T_V4L2_SUBDEV_BASE
93−
94−#define MEDIA_ENT_T_V4L2_SUBDEV_SENSOR (MEDIA_ENT_T_V4L2_SUBDEV_BASE + 1)
95−#define MEDIA_ENT_T_V4L2_SUBDEV_FLASH (MEDIA_ENT_T_V4L2_SUBDEV_BASE + 2)
96−#define MEDIA_ENT_T_V4L2_SUBDEV_LENS (MEDIA_ENT_T_V4L2_SUBDEV_BASE + 3)
97− /* A converter of analogue video to its digital representation. */
98−#define MEDIA_ENT_T_V4L2_SUBDEV_DECODER (MEDIA_ENT_T_V4L2_SUBDEV_BASE + 4)
99− /* Tuner entity is actually both V4L2 and DVB subdev */
100−#define MEDIA_ENT_T_V4L2_SUBDEV_TUNER (MEDIA_ENT_T_V4L2_SUBDEV_BASE + 5)
101−
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)
98+
99+#define MEDIA_ENT_F_IO_V4L (MEDIA_ENT_F_OLD_BASE + 1)
100+
101+#define MEDIA_ENT_F_CAM_SENSOR (MEDIA_ENT_F_OLD_SUBDEV_BASE + 1)
102+#define MEDIA_ENT_F_FLASH (MEDIA_ENT_F_OLD_SUBDEV_BASE + 2)
103+#define MEDIA_ENT_F_LENS (MEDIA_ENT_F_OLD_SUBDEV_BASE + 3)
104+#define MEDIA_ENT_F_ATV_DECODER (MEDIA_ENT_F_OLD_SUBDEV_BASE + 4)
105+#define MEDIA_ENT_F_TUNER (MEDIA_ENT_F_OLD_SUBDEV_BASE + 5)
106+
107+#define MEDIA_ENT_F_V4L2_SUBDEV_UNKNOWN MEDIA_ENT_F_OLD_SUBDEV_BASE
115108
116109 #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+ */
118118 #define MEDIA_ENT_TYPE_SHIFT 16
119119 #define MEDIA_ENT_TYPE_MASK 0x00ff0000
120120 #define MEDIA_ENT_SUBTYPE_MASK 0x0000ffff
121121
122−#define MEDIA_ENT_T_DEVNODE MEDIA_ENT_T_V4L2_BASE
123−#define MEDIA_ENT_T_V4L2_SUBDEV MEDIA_ENT_T_V4L2_SUBDEV_BASE
124−
125−#define MEDIA_ENT_T_DEVNODE_V4L MEDIA_ENT_T_V4L2_VIDEO
126−
122+#define MEDIA_ENT_T_DEVNODE MEDIA_ENT_F_OLD_BASE
123+#define MEDIA_ENT_T_DEVNODE_V4L MEDIA_ENT_F_IO_V4L
127124 #define MEDIA_ENT_T_DEVNODE_FB (MEDIA_ENT_T_DEVNODE + 2)
128125 #define MEDIA_ENT_T_DEVNODE_ALSA (MEDIA_ENT_T_DEVNODE + 3)
129126 #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
130136 #endif
131137
132138 /* 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