[PATCH 15/18] [media] uapi/media.h: Rename entities types to functions
Mauro Carvalho Chehab
mchehab at osg.samsung.com
Sun Sep 6 10:30:58 PDT 2015
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
@@
@@
-MEDIA_ENT_T_V4L2_VBI
+MEDIA_ENT_F_V4L2_VBI
@@
@@
-MEDIA_ENT_T_V4L2_SWRADIO
+MEDIA_ENT_F_V4L2_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_MPEG_TS_DEMUX
@@
@@
-MEDIA_ENT_T_DVB_TSOUT
+MEDIA_ENT_F_DTV_TSOUT
@@
@@
-MEDIA_ENT_T_DVB_CA
+MEDIA_ENT_F_DTV_CA
@@
@@
-MEDIA_ENT_T_DVB_NET_DECAP
+MEDIA_ENT_F_DTV_NET_DECAP
Signed-off-by: Mauro Carvalho Chehab <mchehab at osg.samsung.com>
diff --git a/drivers/media/dvb-core/dvbdev.c b/drivers/media/dvb-core/dvbdev.c
index e925909bc99e..8527fc40e6a0 100644
--- a/drivers/media/dvb-core/dvbdev.c
+++ b/drivers/media/dvb-core/dvbdev.c
@@ -229,7 +229,7 @@ static int dvb_create_tsout_entity(struct dvb_device *dvbdev,
if (!entity->name)
return ret;
- entity->function = MEDIA_ENT_T_DVB_TSOUT;
+ entity->function = MEDIA_ENT_F_IO;
pads->flags = MEDIA_PAD_FL_SINK;
ret = media_entity_init(entity, 1, pads);
@@ -302,18 +302,18 @@ static int dvb_create_media_entity(struct dvb_device *dvbdev,
switch (type) {
case DVB_DEVICE_FRONTEND:
- dvbdev->entity->function = MEDIA_ENT_T_DVB_DEMOD;
+ dvbdev->entity->function = MEDIA_ENT_F_DTV_DEMOD;
dvbdev->pads[0].flags = MEDIA_PAD_FL_SINK;
dvbdev->pads[1].flags = MEDIA_PAD_FL_SOURCE;
break;
case DVB_DEVICE_DEMUX:
- dvbdev->entity->function = MEDIA_ENT_T_DVB_DEMUX;
+ dvbdev->entity->function = MEDIA_ENT_F_MPEG_TS_DEMUX;
dvbdev->pads[0].flags = MEDIA_PAD_FL_SINK;
for (i = 1; i < npads; i++)
dvbdev->pads[i].flags = MEDIA_PAD_FL_SOURCE;
break;
case DVB_DEVICE_CA:
- dvbdev->entity->function = MEDIA_ENT_T_DVB_CA;
+ dvbdev->entity->function = MEDIA_ENT_F_DTV_CA;
dvbdev->pads[0].flags = MEDIA_PAD_FL_SINK;
dvbdev->pads[1].flags = MEDIA_PAD_FL_SOURCE;
break;
@@ -538,16 +538,16 @@ int dvb_create_media_graph(struct dvb_adapter *adap)
media_device_for_each_entity(entity, mdev) {
switch (entity->function) {
- case MEDIA_ENT_T_V4L2_SUBDEV_TUNER:
+ case MEDIA_ENT_F_TUNER:
tuner = entity;
break;
- case MEDIA_ENT_T_DVB_DEMOD:
+ case MEDIA_ENT_F_DTV_DEMOD:
demod = entity;
break;
- case MEDIA_ENT_T_DVB_DEMUX:
+ case MEDIA_ENT_F_MPEG_TS_DEMUX:
demux = entity;
break;
- case MEDIA_ENT_T_DVB_CA:
+ case MEDIA_ENT_F_DTV_CA:
ca = entity;
break;
}
@@ -576,7 +576,7 @@ int dvb_create_media_graph(struct dvb_adapter *adap)
/* Create demux links for each ringbuffer/pad */
if (demux) {
media_device_for_each_entity(entity, mdev) {
- if (entity->function == MEDIA_ENT_T_DVB_TSOUT) {
+ if (entity->function == MEDIA_ENT_F_IO) {
if (!strncmp(entity->name, DVR_TSOUT,
strlen(DVR_TSOUT))) {
ret = media_create_pad_link(demux,
@@ -621,7 +621,7 @@ int dvb_create_media_graph(struct dvb_adapter *adap)
}
media_device_for_each_entity(entity, mdev) {
- if (entity->function == MEDIA_ENT_T_DVB_TSOUT) {
+ if (entity->function == MEDIA_ENT_F_IO) {
if (!strcmp(entity->name, DVR_TSOUT)) {
link = media_create_intf_link(entity,
intf,
diff --git a/drivers/media/dvb-frontends/au8522_decoder.c b/drivers/media/dvb-frontends/au8522_decoder.c
index a6fbe78a70e3..39fab1ab921c 100644
--- a/drivers/media/dvb-frontends/au8522_decoder.c
+++ b/drivers/media/dvb-frontends/au8522_decoder.c
@@ -775,7 +775,7 @@ static int au8522_probe(struct i2c_client *client,
state->pads[AU8522_PAD_INPUT].flags = MEDIA_PAD_FL_SINK;
state->pads[AU8522_PAD_VID_OUT].flags = MEDIA_PAD_FL_SOURCE;
state->pads[AU8522_PAD_VBI_OUT].flags = MEDIA_PAD_FL_SOURCE;
- sd->entity.function = MEDIA_ENT_T_V4L2_SUBDEV_DECODER;
+ sd->entity.function = MEDIA_ENT_F_ATV_DECODER;
ret = media_entity_init(&sd->entity, ARRAY_SIZE(state->pads),
state->pads);
diff --git a/drivers/media/i2c/adp1653.c b/drivers/media/i2c/adp1653.c
index 2b8f72ac0f7d..0ce7a8426d59 100644
--- a/drivers/media/i2c/adp1653.c
+++ b/drivers/media/i2c/adp1653.c
@@ -516,7 +516,7 @@ static int adp1653_probe(struct i2c_client *client,
if (ret < 0)
goto free_and_quit;
- flash->subdev.entity.function = MEDIA_ENT_T_V4L2_SUBDEV_FLASH;
+ flash->subdev.entity.function = MEDIA_ENT_F_FLASH;
return 0;
diff --git a/drivers/media/i2c/adv7180.c b/drivers/media/i2c/adv7180.c
index bab91a1e1525..af888f6c1de0 100644
--- a/drivers/media/i2c/adv7180.c
+++ b/drivers/media/i2c/adv7180.c
@@ -1213,7 +1213,7 @@ static int adv7180_probe(struct i2c_client *client,
goto err_unregister_vpp_client;
state->pad.flags = MEDIA_PAD_FL_SOURCE;
- sd->entity.flags |= MEDIA_ENT_T_V4L2_SUBDEV_DECODER;
+ sd->entity.flags |= MEDIA_ENT_F_ATV_DECODER;
ret = media_entity_init(&sd->entity, 1, &state->pad);
if (ret)
goto err_free_ctrl;
diff --git a/drivers/media/i2c/as3645a.c b/drivers/media/i2c/as3645a.c
index a49ef7d6df18..c5462fd9c0fb 100644
--- a/drivers/media/i2c/as3645a.c
+++ b/drivers/media/i2c/as3645a.c
@@ -831,7 +831,7 @@ static int as3645a_probe(struct i2c_client *client,
if (ret < 0)
goto done;
- flash->subdev.entity.function = MEDIA_ENT_T_V4L2_SUBDEV_FLASH;
+ flash->subdev.entity.function = MEDIA_ENT_F_FLASH;
mutex_init(&flash->power_lock);
diff --git a/drivers/media/i2c/cx25840/cx25840-core.c b/drivers/media/i2c/cx25840/cx25840-core.c
index d48a3a4df96b..479b3efc3f3d 100644
--- a/drivers/media/i2c/cx25840/cx25840-core.c
+++ b/drivers/media/i2c/cx25840/cx25840-core.c
@@ -5208,7 +5208,7 @@ static int cx25840_probe(struct i2c_client *client,
state->pads[CX25840_PAD_INPUT].flags = MEDIA_PAD_FL_SINK;
state->pads[CX25840_PAD_VID_OUT].flags = MEDIA_PAD_FL_SOURCE;
state->pads[CX25840_PAD_VBI_OUT].flags = MEDIA_PAD_FL_SOURCE;
- sd->entity.function = MEDIA_ENT_T_V4L2_SUBDEV_DECODER;
+ sd->entity.function = MEDIA_ENT_F_ATV_DECODER;
ret = media_entity_init(&sd->entity, ARRAY_SIZE(state->pads),
state->pads);
diff --git a/drivers/media/i2c/lm3560.c b/drivers/media/i2c/lm3560.c
index 7c1abdca39d0..8c7b4a2d465e 100644
--- a/drivers/media/i2c/lm3560.c
+++ b/drivers/media/i2c/lm3560.c
@@ -368,7 +368,7 @@ static int lm3560_subdev_init(struct lm3560_flash *flash,
rval = media_entity_init(&flash->subdev_led[led_no].entity, 0, NULL);
if (rval < 0)
goto err_out;
- flash->subdev_led[led_no].entity.function = MEDIA_ENT_T_V4L2_SUBDEV_FLASH;
+ flash->subdev_led[led_no].entity.function = MEDIA_ENT_F_FLASH;
return rval;
diff --git a/drivers/media/i2c/lm3646.c b/drivers/media/i2c/lm3646.c
index d609f2fa8e6c..71344c6596a3 100644
--- a/drivers/media/i2c/lm3646.c
+++ b/drivers/media/i2c/lm3646.c
@@ -285,7 +285,7 @@ static int lm3646_subdev_init(struct lm3646_flash *flash)
rval = media_entity_init(&flash->subdev_led.entity, 0, NULL);
if (rval < 0)
goto err_out;
- flash->subdev_led.entity.function = MEDIA_ENT_T_V4L2_SUBDEV_FLASH;
+ flash->subdev_led.entity.function = MEDIA_ENT_F_FLASH;
return rval;
err_out:
diff --git a/drivers/media/i2c/m5mols/m5mols_core.c b/drivers/media/i2c/m5mols/m5mols_core.c
index 206319b88d7a..08dad1140a07 100644
--- a/drivers/media/i2c/m5mols/m5mols_core.c
+++ b/drivers/media/i2c/m5mols/m5mols_core.c
@@ -978,7 +978,7 @@ static int m5mols_probe(struct i2c_client *client,
ret = media_entity_init(&sd->entity, 1, &info->pad);
if (ret < 0)
return ret;
- sd->entity.function = MEDIA_ENT_T_V4L2_SUBDEV_SENSOR;
+ sd->entity.function = MEDIA_ENT_F_CAM_SENSOR;
init_waitqueue_head(&info->irq_waitq);
mutex_init(&info->lock);
diff --git a/drivers/media/i2c/noon010pc30.c b/drivers/media/i2c/noon010pc30.c
index 6cd407bcfddf..aff081324d76 100644
--- a/drivers/media/i2c/noon010pc30.c
+++ b/drivers/media/i2c/noon010pc30.c
@@ -779,7 +779,7 @@ static int noon010_probe(struct i2c_client *client,
goto np_err;
info->pad.flags = MEDIA_PAD_FL_SOURCE;
- sd->entity.function = MEDIA_ENT_T_V4L2_SUBDEV_SENSOR;
+ sd->entity.function = MEDIA_ENT_F_CAM_SENSOR;
ret = media_entity_init(&sd->entity, 1, &info->pad);
if (ret < 0)
goto np_err;
diff --git a/drivers/media/i2c/ov2659.c b/drivers/media/i2c/ov2659.c
index c085dec69201..e49254f4341d 100644
--- a/drivers/media/i2c/ov2659.c
+++ b/drivers/media/i2c/ov2659.c
@@ -1445,7 +1445,7 @@ static int ov2659_probe(struct i2c_client *client,
#if defined(CONFIG_MEDIA_CONTROLLER)
ov2659->pad.flags = MEDIA_PAD_FL_SOURCE;
- sd->entity.function = MEDIA_ENT_T_V4L2_SUBDEV_SENSOR;
+ sd->entity.function = MEDIA_ENT_F_CAM_SENSOR;
ret = media_entity_init(&sd->entity, 1, &ov2659->pad);
if (ret < 0) {
v4l2_ctrl_handler_free(&ov2659->ctrls);
diff --git a/drivers/media/i2c/ov9650.c b/drivers/media/i2c/ov9650.c
index 2862244a6488..b133464f3b73 100644
--- a/drivers/media/i2c/ov9650.c
+++ b/drivers/media/i2c/ov9650.c
@@ -1500,7 +1500,7 @@ static int ov965x_probe(struct i2c_client *client,
return ret;
ov965x->pad.flags = MEDIA_PAD_FL_SOURCE;
- sd->entity.function = MEDIA_ENT_T_V4L2_SUBDEV_SENSOR;
+ sd->entity.function = MEDIA_ENT_F_CAM_SENSOR;
ret = media_entity_init(&sd->entity, 1, &ov965x->pad);
if (ret < 0)
return ret;
diff --git a/drivers/media/i2c/s5c73m3/s5c73m3-core.c b/drivers/media/i2c/s5c73m3/s5c73m3-core.c
index 3f55168cce47..456899fe9cb0 100644
--- a/drivers/media/i2c/s5c73m3/s5c73m3-core.c
+++ b/drivers/media/i2c/s5c73m3/s5c73m3-core.c
@@ -1688,7 +1688,7 @@ static int s5c73m3_probe(struct i2c_client *client,
state->sensor_pads[S5C73M3_JPEG_PAD].flags = MEDIA_PAD_FL_SOURCE;
state->sensor_pads[S5C73M3_ISP_PAD].flags = MEDIA_PAD_FL_SOURCE;
- sd->entity.function = MEDIA_ENT_T_V4L2_SUBDEV_SENSOR;
+ sd->entity.function = MEDIA_ENT_F_CAM_SENSOR;
ret = media_entity_init(&sd->entity, S5C73M3_NUM_PADS,
state->sensor_pads);
@@ -1704,7 +1704,7 @@ static int s5c73m3_probe(struct i2c_client *client,
state->oif_pads[OIF_ISP_PAD].flags = MEDIA_PAD_FL_SINK;
state->oif_pads[OIF_JPEG_PAD].flags = MEDIA_PAD_FL_SINK;
state->oif_pads[OIF_SOURCE_PAD].flags = MEDIA_PAD_FL_SOURCE;
- oif_sd->entity.function = MEDIA_ENT_T_V4L2_SUBDEV_SENSOR;
+ oif_sd->entity.function = MEDIA_ENT_F_CAM_SENSOR;
ret = media_entity_init(&oif_sd->entity, OIF_NUM_PADS,
state->oif_pads);
diff --git a/drivers/media/i2c/s5k4ecgx.c b/drivers/media/i2c/s5k4ecgx.c
index 45f6e6f2585a..c5001d5ab4ca 100644
--- a/drivers/media/i2c/s5k4ecgx.c
+++ b/drivers/media/i2c/s5k4ecgx.c
@@ -961,7 +961,7 @@ static int s5k4ecgx_probe(struct i2c_client *client,
sd->flags |= V4L2_SUBDEV_FL_HAS_DEVNODE;
priv->pad.flags = MEDIA_PAD_FL_SOURCE;
- sd->entity.function = MEDIA_ENT_T_V4L2_SUBDEV_SENSOR;
+ sd->entity.function = MEDIA_ENT_F_CAM_SENSOR;
ret = media_entity_init(&sd->entity, 1, &priv->pad);
if (ret)
return ret;
diff --git a/drivers/media/i2c/s5k5baf.c b/drivers/media/i2c/s5k5baf.c
index 22dfeadf7672..3a10e50b3620 100644
--- a/drivers/media/i2c/s5k5baf.c
+++ b/drivers/media/i2c/s5k5baf.c
@@ -408,7 +408,7 @@ static inline struct v4l2_subdev *ctrl_to_sd(struct v4l2_ctrl *ctrl)
static inline bool s5k5baf_is_cis_subdev(struct v4l2_subdev *sd)
{
- return sd->entity.function == MEDIA_ENT_T_V4L2_SUBDEV_SENSOR;
+ return sd->entity.function == MEDIA_ENT_F_CAM_SENSOR;
}
static inline struct s5k5baf *to_s5k5baf(struct v4l2_subdev *sd)
@@ -1904,7 +1904,7 @@ static int s5k5baf_configure_subdevs(struct s5k5baf *state,
sd->flags |= V4L2_SUBDEV_FL_HAS_DEVNODE;
state->cis_pad.flags = MEDIA_PAD_FL_SOURCE;
- sd->entity.function = MEDIA_ENT_T_V4L2_SUBDEV_SENSOR;
+ sd->entity.function = MEDIA_ENT_F_CAM_SENSOR;
ret = media_entity_init(&sd->entity, NUM_CIS_PADS, &state->cis_pad);
if (ret < 0)
goto err;
@@ -1919,7 +1919,7 @@ static int s5k5baf_configure_subdevs(struct s5k5baf *state,
state->pads[PAD_CIS].flags = MEDIA_PAD_FL_SINK;
state->pads[PAD_OUT].flags = MEDIA_PAD_FL_SOURCE;
- sd->entity.function = MEDIA_ENT_T_V4L2_SUBDEV_SENSOR;
+ sd->entity.function = MEDIA_ENT_F_CAM_SENSOR;
ret = media_entity_init(&sd->entity, NUM_ISP_PADS, state->pads);
if (!ret)
diff --git a/drivers/media/i2c/s5k6aa.c b/drivers/media/i2c/s5k6aa.c
index 71162c02d6d7..95c1951bc9df 100644
--- a/drivers/media/i2c/s5k6aa.c
+++ b/drivers/media/i2c/s5k6aa.c
@@ -1577,7 +1577,7 @@ static int s5k6aa_probe(struct i2c_client *client,
sd->flags |= V4L2_SUBDEV_FL_HAS_DEVNODE;
s5k6aa->pad.flags = MEDIA_PAD_FL_SOURCE;
- sd->entity.function = MEDIA_ENT_T_V4L2_SUBDEV_SENSOR;
+ sd->entity.function = MEDIA_ENT_F_CAM_SENSOR;
ret = media_entity_init(&sd->entity, 1, &s5k6aa->pad);
if (ret)
return ret;
diff --git a/drivers/media/i2c/smiapp/smiapp-core.c b/drivers/media/i2c/smiapp/smiapp-core.c
index bb1f891a1eb6..2911ac2746c1 100644
--- a/drivers/media/i2c/smiapp/smiapp-core.c
+++ b/drivers/media/i2c/smiapp/smiapp-core.c
@@ -2763,7 +2763,7 @@ static int smiapp_init(struct smiapp_sensor *sensor)
dev_dbg(&client->dev, "profile %d\n", sensor->minfo.smiapp_profile);
- sensor->pixel_array->sd.entity.function = MEDIA_ENT_T_V4L2_SUBDEV_SENSOR;
+ sensor->pixel_array->sd.entity.function = MEDIA_ENT_F_CAM_SENSOR;
/* final steps */
smiapp_read_frame_fmt(sensor);
diff --git a/drivers/media/i2c/tvp514x.c b/drivers/media/i2c/tvp514x.c
index 11801636d901..fad7fcb49e9c 100644
--- a/drivers/media/i2c/tvp514x.c
+++ b/drivers/media/i2c/tvp514x.c
@@ -1095,7 +1095,7 @@ tvp514x_probe(struct i2c_client *client, const struct i2c_device_id *id)
#if defined(CONFIG_MEDIA_CONTROLLER)
decoder->pad.flags = MEDIA_PAD_FL_SOURCE;
decoder->sd.flags |= V4L2_SUBDEV_FL_HAS_DEVNODE;
- decoder->sd.entity.flags |= MEDIA_ENT_T_V4L2_SUBDEV_DECODER;
+ decoder->sd.entity.flags |= MEDIA_ENT_F_ATV_DECODER;
ret = media_entity_init(&decoder->sd.entity, 1, &decoder->pad);
if (ret < 0) {
diff --git a/drivers/media/i2c/tvp7002.c b/drivers/media/i2c/tvp7002.c
index 3630f3e2a4c7..765781ae8613 100644
--- a/drivers/media/i2c/tvp7002.c
+++ b/drivers/media/i2c/tvp7002.c
@@ -1012,7 +1012,7 @@ static int tvp7002_probe(struct i2c_client *c, const struct i2c_device_id *id)
#if defined(CONFIG_MEDIA_CONTROLLER)
device->pad.flags = MEDIA_PAD_FL_SOURCE;
device->sd.flags |= V4L2_SUBDEV_FL_HAS_DEVNODE;
- device->sd.entity.flags |= MEDIA_ENT_T_V4L2_SUBDEV_DECODER;
+ device->sd.entity.flags |= MEDIA_ENT_F_ATV_DECODER;
error = media_entity_init(&device->sd.entity, 1, &device->pad);
if (error < 0)
diff --git a/drivers/media/media-device.c b/drivers/media/media-device.c
index 32090030c342..13987710e5bc 100644
--- a/drivers/media/media-device.c
+++ b/drivers/media/media-device.c
@@ -615,8 +615,8 @@ int __must_check media_device_register_entity(struct media_device *mdev,
{
int i;
- if (entity->function == MEDIA_ENT_T_V4L2_SUBDEV_UNKNOWN ||
- entity->function == MEDIA_ENT_T_UNKNOWN)
+ if (entity->function == MEDIA_ENT_F_V4L2_SUBDEV_UNKNOWN ||
+ entity->function == MEDIA_ENT_F_UNKNOWN)
dev_warn(mdev->dev,
"Entity type for entity %s was not initialized!\n",
entity->name);
diff --git a/drivers/media/platform/xilinx/xilinx-dma.c b/drivers/media/platform/xilinx/xilinx-dma.c
index 8bee7313a497..bc244a0049bd 100644
--- a/drivers/media/platform/xilinx/xilinx-dma.c
+++ b/drivers/media/platform/xilinx/xilinx-dma.c
@@ -191,7 +191,7 @@ static int xvip_pipeline_validate(struct xvip_pipeline *pipe,
while ((entity = media_entity_graph_walk_next(&graph))) {
struct xvip_dma *dma;
- if (entity->function != MEDIA_ENT_T_V4L2_VIDEO)
+ if (entity->function != MEDIA_ENT_F_IO)
continue;
dma = to_xvip_dma(media_entity_to_video_device(entity));
diff --git a/drivers/media/usb/au0828/au0828-core.c b/drivers/media/usb/au0828/au0828-core.c
index 44a2ab3c85ab..1c12285428fe 100644
--- a/drivers/media/usb/au0828/au0828-core.c
+++ b/drivers/media/usb/au0828/au0828-core.c
@@ -264,10 +264,10 @@ static int au0828_create_media_graph(struct au0828_dev *dev)
media_device_for_each_entity(entity, mdev) {
switch (entity->function) {
- case MEDIA_ENT_T_V4L2_SUBDEV_TUNER:
+ case MEDIA_ENT_F_TUNER:
tuner = entity;
break;
- case MEDIA_ENT_T_V4L2_SUBDEV_DECODER:
+ case MEDIA_ENT_F_ATV_DECODER:
decoder = entity;
break;
}
diff --git a/drivers/media/usb/au0828/au0828-video.c b/drivers/media/usb/au0828/au0828-video.c
index 5c01f37cd0b8..f041433f2334 100644
--- a/drivers/media/usb/au0828/au0828-video.c
+++ b/drivers/media/usb/au0828/au0828-video.c
@@ -1830,18 +1830,18 @@ static void au0828_analog_create_entities(struct au0828_dev *dev)
switch(AUVI_INPUT(i).type) {
case AU0828_VMUX_COMPOSITE:
- ent->function = MEDIA_ENT_T_CONN_COMPOSITE;
+ ent->function = MEDIA_ENT_F_CONN_COMPOSITE;
break;
case AU0828_VMUX_SVIDEO:
- ent->function = MEDIA_ENT_T_CONN_SVIDEO;
+ ent->function = MEDIA_ENT_F_CONN_SVIDEO;
break;
case AU0828_VMUX_CABLE:
case AU0828_VMUX_TELEVISION:
case AU0828_VMUX_DVB:
- ent->function = MEDIA_ENT_T_CONN_RF;
+ ent->function = MEDIA_ENT_F_CONN_RF;
break;
default: /* AU0828_VMUX_DEBUG */
- ent->function = MEDIA_ENT_T_CONN_TEST;
+ ent->function = MEDIA_ENT_F_CONN_TEST;
break;
}
diff --git a/drivers/media/usb/cx231xx/cx231xx-cards.c b/drivers/media/usb/cx231xx/cx231xx-cards.c
index b01d6bce3cf6..022b30099a89 100644
--- a/drivers/media/usb/cx231xx/cx231xx-cards.c
+++ b/drivers/media/usb/cx231xx/cx231xx-cards.c
@@ -1250,10 +1250,10 @@ static int cx231xx_create_media_graph(struct cx231xx *dev)
media_device_for_each_entity(entity, mdev) {
switch (entity->function) {
- case MEDIA_ENT_T_V4L2_SUBDEV_TUNER:
+ case MEDIA_ENT_F_TUNER:
tuner = entity;
break;
- case MEDIA_ENT_T_V4L2_SUBDEV_DECODER:
+ case MEDIA_ENT_F_ATV_DECODER:
decoder = entity;
break;
}
diff --git a/drivers/media/usb/cx231xx/cx231xx-video.c b/drivers/media/usb/cx231xx/cx231xx-video.c
index ed4a49c850c7..7e67b1096012 100644
--- a/drivers/media/usb/cx231xx/cx231xx-video.c
+++ b/drivers/media/usb/cx231xx/cx231xx-video.c
@@ -119,7 +119,7 @@ static int cx231xx_enable_analog_tuner(struct cx231xx *dev)
* this should be enough for the actual needs.
*/
media_device_for_each_entity(entity, mdev) {
- if (entity->function == MEDIA_ENT_T_V4L2_SUBDEV_DECODER) {
+ if (entity->function == MEDIA_ENT_F_ATV_DECODER) {
decoder = entity;
break;
}
diff --git a/drivers/media/v4l2-core/tuner-core.c b/drivers/media/v4l2-core/tuner-core.c
index e8fc5ec8fc35..05fc4df61b85 100644
--- a/drivers/media/v4l2-core/tuner-core.c
+++ b/drivers/media/v4l2-core/tuner-core.c
@@ -698,7 +698,7 @@ register_client:
#if defined(CONFIG_MEDIA_CONTROLLER)
t->pad[TUNER_PAD_RF_INPUT].flags = MEDIA_PAD_FL_SINK;
t->pad[TUNER_PAD_IF_OUTPUT].flags = MEDIA_PAD_FL_SOURCE;
- t->sd.entity.function = MEDIA_ENT_T_V4L2_SUBDEV_TUNER;
+ t->sd.entity.function = MEDIA_ENT_F_TUNER;
t->sd.entity.name = t->name;
ret = media_entity_init(&t->sd.entity, TUNER_NUM_PADS, &t->pad[0]);
diff --git a/drivers/media/v4l2-core/v4l2-dev.c b/drivers/media/v4l2-core/v4l2-dev.c
index 2446b2d8fe66..430aa2330d07 100644
--- a/drivers/media/v4l2-core/v4l2-dev.c
+++ b/drivers/media/v4l2-core/v4l2-dev.c
@@ -197,7 +197,7 @@ static void v4l2_device_release(struct device *cd)
if (v4l2_dev->mdev) {
/* Remove interfaces and interface links */
media_devnode_remove(vdev->intf_devnode);
- if (vdev->entity.function != MEDIA_ENT_T_UNKNOWN)
+ if (vdev->entity.function != MEDIA_ENT_F_UNKNOWN)
media_device_unregister_entity(&vdev->entity);
}
#endif
@@ -726,20 +726,20 @@ static int video_register_media_controller(struct video_device *vdev, int type)
if (!vdev->v4l2_dev->mdev)
return 0;
- vdev->entity.function = MEDIA_ENT_T_UNKNOWN;
+ vdev->entity.function = MEDIA_ENT_F_UNKNOWN;
switch (type) {
case VFL_TYPE_GRABBER:
intf_type = MEDIA_INTF_T_V4L_VIDEO;
- vdev->entity.function = MEDIA_ENT_T_V4L2_VIDEO;
+ vdev->entity.function = MEDIA_ENT_F_IO;
break;
case VFL_TYPE_VBI:
intf_type = MEDIA_INTF_T_V4L_VBI;
- vdev->entity.function = MEDIA_ENT_T_V4L2_VBI;
+ vdev->entity.function = MEDIA_ENT_F_IO;
break;
case VFL_TYPE_SDR:
intf_type = MEDIA_INTF_T_V4L_SWRADIO;
- vdev->entity.function = MEDIA_ENT_T_V4L2_SWRADIO;
+ vdev->entity.function = MEDIA_ENT_F_IO;
break;
case VFL_TYPE_RADIO:
intf_type = MEDIA_INTF_T_V4L_RADIO;
@@ -757,7 +757,7 @@ static int video_register_media_controller(struct video_device *vdev, int type)
return 0;
}
- if (vdev->entity.function != MEDIA_ENT_T_UNKNOWN) {
+ if (vdev->entity.function != MEDIA_ENT_F_UNKNOWN) {
vdev->entity.name = vdev->name;
/* Needed just for backward compatibility with legacy MC API */
@@ -784,7 +784,7 @@ static int video_register_media_controller(struct video_device *vdev, int type)
return -ENOMEM;
}
- if (vdev->entity.function != MEDIA_ENT_T_UNKNOWN) {
+ if (vdev->entity.function != MEDIA_ENT_F_UNKNOWN) {
struct media_link *link;
link = media_create_intf_link(&vdev->entity,
diff --git a/drivers/media/v4l2-core/v4l2-flash-led-class.c b/drivers/media/v4l2-core/v4l2-flash-led-class.c
index cf7b3cb9a373..5c686a24712b 100644
--- a/drivers/media/v4l2-core/v4l2-flash-led-class.c
+++ b/drivers/media/v4l2-core/v4l2-flash-led-class.c
@@ -655,7 +655,7 @@ struct v4l2_flash *v4l2_flash_init(
if (ret < 0)
return ERR_PTR(ret);
- sd->entity.function = MEDIA_ENT_T_V4L2_SUBDEV_FLASH;
+ sd->entity.function = MEDIA_ENT_F_FLASH;
ret = v4l2_flash_init_controls(v4l2_flash, config);
if (ret < 0)
diff --git a/drivers/media/v4l2-core/v4l2-subdev.c b/drivers/media/v4l2-core/v4l2-subdev.c
index b440cb66669c..d70aedc75998 100644
--- a/drivers/media/v4l2-core/v4l2-subdev.c
+++ b/drivers/media/v4l2-core/v4l2-subdev.c
@@ -535,7 +535,7 @@ v4l2_subdev_link_validate_get_format(struct media_pad *pad,
return v4l2_subdev_call(sd, pad, get_fmt, NULL, fmt);
}
- WARN(pad->entity->function != MEDIA_ENT_T_V4L2_VIDEO,
+ WARN(pad->entity->function != MEDIA_ENT_F_IO,
"Driver bug! Wrong media entity type 0x%08x, entity %s\n",
pad->entity->function, pad->entity->name);
@@ -584,7 +584,7 @@ void v4l2_subdev_init(struct v4l2_subdev *sd, const struct v4l2_subdev_ops *ops)
sd->host_priv = NULL;
#if defined(CONFIG_MEDIA_CONTROLLER)
sd->entity.name = sd->name;
- sd->entity.function = MEDIA_ENT_T_V4L2_SUBDEV_UNKNOWN;
+ sd->entity.function = MEDIA_ENT_F_V4L2_SUBDEV_UNKNOWN;
#endif
}
EXPORT_SYMBOL(v4l2_subdev_init);
diff --git a/include/media/media-entity.h b/include/media/media-entity.h
index 10f7d5f0eb66..9cbb10079024 100644
--- a/include/media/media-entity.h
+++ b/include/media/media-entity.h
@@ -279,9 +279,7 @@ static inline bool is_media_entity_v4l2_io(struct media_entity *entity)
return false;
switch (entity->function) {
- case MEDIA_ENT_T_V4L2_VIDEO:
- case MEDIA_ENT_T_V4L2_VBI:
- case MEDIA_ENT_T_V4L2_SWRADIO:
+ case MEDIA_ENT_F_IO:
return true;
default:
return false;
@@ -294,11 +292,11 @@ static inline bool is_media_entity_v4l2_subdev(struct media_entity *entity)
return false;
switch (entity->function) {
- case MEDIA_ENT_T_V4L2_SUBDEV_SENSOR:
- case MEDIA_ENT_T_V4L2_SUBDEV_FLASH:
- case MEDIA_ENT_T_V4L2_SUBDEV_LENS:
- case MEDIA_ENT_T_V4L2_SUBDEV_DECODER:
- case MEDIA_ENT_T_V4L2_SUBDEV_TUNER:
+ case MEDIA_ENT_F_CAM_SENSOR:
+ case MEDIA_ENT_F_FLASH:
+ case MEDIA_ENT_F_LENS:
+ case MEDIA_ENT_F_ATV_DECODER:
+ case MEDIA_ENT_F_TUNER:
return true;
default:
diff --git a/include/uapi/linux/media.h b/include/uapi/linux/media.h
index d232cc680c67..90e90a6e62bf 100644
--- a/include/uapi/linux/media.h
+++ b/include/uapi/linux/media.h
@@ -46,87 +46,86 @@ struct media_device_info {
* Initial value to be used when a new entity is created
* Drivers should change it to something useful
*/
-#define MEDIA_ENT_T_UNKNOWN 0x00000000
+#define MEDIA_ENT_F_UNKNOWN 0x00000000
/*
- * Base numbers for entity types
+ * Base number ranges for entity functions
*
- * Please notice that the huge gap of 16 bits for each base is overkill!
- * 8 bits is more than enough to avoid starving entity types for each
- * subsystem.
- *
- * However, It is kept this way just to avoid binary breakages with the
- * namespace provided on legacy versions of this header.
+ * NOTE: those ranges and entity function number are spased just to
+ * make easier to maintain this file. Userspace should not rely on
+ * the ranges to identify a group of function types, as newer
+ * functions can be added with any name within the full u32 range.
*/
-#define MEDIA_ENT_T_DVB_BASE 0x00000000
-#define MEDIA_ENT_T_V4L2_BASE 0x00010000
-#define MEDIA_ENT_T_V4L2_SUBDEV_BASE 0x00020000
-#define MEDIA_ENT_T_CONNECTOR_BASE 0x00030000
+#define MEDIA_ENT_F_BASE 0x00000000
+#define MEDIA_ENT_F_OLD_BASE 0x00010000
+#define MEDIA_ENT_F_OLD_SUBDEV_BASE 0x00020000
/*
- * V4L2 entities - Those are used for DMA (mmap/DMABUF) and
- * read()/write() data I/O associated with the V4L2 devnodes.
+ * DVB entities
*/
-#define MEDIA_ENT_T_V4L2_VIDEO (MEDIA_ENT_T_V4L2_BASE + 1)
- /*
- * Please notice that numbers between MEDIA_ENT_T_V4L2_BASE + 2 and
- * MEDIA_ENT_T_V4L2_BASE + 4 can't be used, as those values used
- * to be declared for FB, ALSA and DVB entities.
- * As those values were never actually used in practice, we're just
- * adding them as backward compatibility macros and keeping the
- * numberspace clean here. This way, we avoid breaking compilation,
- * in the case of having some userspace application using the old
- * symbols.
- */
-#define MEDIA_ENT_T_V4L2_VBI (MEDIA_ENT_T_V4L2_BASE + 5)
-#define MEDIA_ENT_T_V4L2_SWRADIO (MEDIA_ENT_T_V4L2_BASE + 6)
-
-/* V4L2 Sub-device entities */
-
- /*
- * Subdevs are initialized with MEDIA_ENT_T_V4L2_SUBDEV_UNKNOWN,
- * in order to preserve backward compatibility.
- * Drivers should change to the proper subdev type before
- * registering the entity.
- */
-#define MEDIA_ENT_T_V4L2_SUBDEV_UNKNOWN MEDIA_ENT_T_V4L2_SUBDEV_BASE
-
-#define MEDIA_ENT_T_V4L2_SUBDEV_SENSOR (MEDIA_ENT_T_V4L2_SUBDEV_BASE + 1)
-#define MEDIA_ENT_T_V4L2_SUBDEV_FLASH (MEDIA_ENT_T_V4L2_SUBDEV_BASE + 2)
-#define MEDIA_ENT_T_V4L2_SUBDEV_LENS (MEDIA_ENT_T_V4L2_SUBDEV_BASE + 3)
- /* A converter of analogue video to its digital representation. */
-#define MEDIA_ENT_T_V4L2_SUBDEV_DECODER (MEDIA_ENT_T_V4L2_SUBDEV_BASE + 4)
- /* Tuner entity is actually both V4L2 and DVB subdev */
-#define MEDIA_ENT_T_V4L2_SUBDEV_TUNER (MEDIA_ENT_T_V4L2_SUBDEV_BASE + 5)
+#define MEDIA_ENT_F_DTV_DEMOD (MEDIA_ENT_F_BASE + 1)
+#define MEDIA_ENT_F_MPEG_TS_DEMUX (MEDIA_ENT_F_BASE + 2)
+#define MEDIA_ENT_F_DTV_CA (MEDIA_ENT_F_BASE + 3)
+#define MEDIA_ENT_F_DTV_NET_DECAP (MEDIA_ENT_F_BASE + 4)
-/* DVB entities */
-#define MEDIA_ENT_T_DVB_DEMOD (MEDIA_ENT_T_DVB_BASE + 1)
-#define MEDIA_ENT_T_DVB_DEMUX (MEDIA_ENT_T_DVB_BASE + 2)
-#define MEDIA_ENT_T_DVB_TSOUT (MEDIA_ENT_T_DVB_BASE + 3)
-#define MEDIA_ENT_T_DVB_CA (MEDIA_ENT_T_DVB_BASE + 4)
-#define MEDIA_ENT_T_DVB_NET_DECAP (MEDIA_ENT_T_DVB_BASE + 5)
-
-/* Connectors */
-#define MEDIA_ENT_T_CONN_RF (MEDIA_ENT_T_CONNECTOR_BASE)
-#define MEDIA_ENT_T_CONN_SVIDEO (MEDIA_ENT_T_CONNECTOR_BASE + 1)
-#define MEDIA_ENT_T_CONN_COMPOSITE (MEDIA_ENT_T_CONNECTOR_BASE + 2)
+/*
+ * Connectors
+ */
+#define MEDIA_ENT_F_CONN_RF (MEDIA_ENT_F_BASE + 21)
+#define MEDIA_ENT_F_CONN_SVIDEO (MEDIA_ENT_F_BASE + 22)
+#define MEDIA_ENT_F_CONN_COMPOSITE (MEDIA_ENT_F_BASE + 23)
/* For internal test signal generators and other debug connectors */
-#define MEDIA_ENT_T_CONN_TEST (MEDIA_ENT_T_CONNECTOR_BASE + 3)
+#define MEDIA_ENT_F_CONN_TEST (MEDIA_ENT_F_BASE + 24)
+
+/*
+ * Don't touch on those. The ranges MEDIA_ENT_F_OLD_BASE and
+ * MEDIA_ENT_F_OLD_SUBDEV_BASE are kept to keep backward compatibility
+ * with the legacy v1 API.The number range is out of range by purpose:
+ * several previously reserved numbers got excluded from this range.
+ *
+ * Subdevs are initialized with MEDIA_ENT_T_V4L2_SUBDEV_UNKNOWN,
+ * in order to preserve backward compatibility.
+ * Drivers should change to the proper subdev type before
+ * registering the entity.
+ */
+
+#define MEDIA_ENT_F_IO (MEDIA_ENT_F_OLD_BASE + 1)
+
+#define MEDIA_ENT_F_CAM_SENSOR (MEDIA_ENT_F_OLD_SUBDEV_BASE + 1)
+#define MEDIA_ENT_F_FLASH (MEDIA_ENT_F_OLD_SUBDEV_BASE + 2)
+#define MEDIA_ENT_F_LENS (MEDIA_ENT_F_OLD_SUBDEV_BASE + 3)
+#define MEDIA_ENT_F_ATV_DECODER (MEDIA_ENT_F_OLD_SUBDEV_BASE + 4)
+#define MEDIA_ENT_F_TUNER (MEDIA_ENT_F_OLD_SUBDEV_BASE + 5)
+
+#define MEDIA_ENT_F_V4L2_SUBDEV_UNKNOWN MEDIA_ENT_F_OLD_SUBDEV_BASE
#ifndef __KERNEL__
-/* Legacy symbols used to avoid userspace compilation breakages */
+
+/*
+ * Legacy symbols used to avoid userspace compilation breakages
+ *
+ * Those symbols map the entity function into types and should be
+ * used only on legacy programs for legacy hardware. Don't rely
+ * on those for MEDIA_IOC_G_TOPOLOGY.
+ */
#define MEDIA_ENT_TYPE_SHIFT 16
#define MEDIA_ENT_TYPE_MASK 0x00ff0000
#define MEDIA_ENT_SUBTYPE_MASK 0x0000ffff
-#define MEDIA_ENT_T_DEVNODE MEDIA_ENT_T_V4L2_BASE
-#define MEDIA_ENT_T_V4L2_SUBDEV MEDIA_ENT_T_V4L2_SUBDEV_BASE
-
-#define MEDIA_ENT_T_DEVNODE_V4L MEDIA_ENT_T_V4L2_VIDEO
-
+#define MEDIA_ENT_T_DEVNODE MEDIA_ENT_F_OLD_BASE
+#define MEDIA_ENT_T_DEVNODE_V4L MEDIA_ENT_F_IO
#define MEDIA_ENT_T_DEVNODE_FB (MEDIA_ENT_T_DEVNODE + 2)
#define MEDIA_ENT_T_DEVNODE_ALSA (MEDIA_ENT_T_DEVNODE + 3)
#define MEDIA_ENT_T_DEVNODE_DVB (MEDIA_ENT_T_DEVNODE + 4)
+
+#define MEDIA_ENT_T_UNKNOWN MEDIA_ENT_F_UNKNOWN
+#define MEDIA_ENT_T_V4L2_VIDEO MEDIA_ENT_F_IO
+#define MEDIA_ENT_T_V4L2_SUBDEV MEDIA_ENT_F_V4L2_SUBDEV_UNKNOWN
+#define MEDIA_ENT_T_V4L2_SUBDEV_SENSOR MEDIA_ENT_F_CAM_SENSOR
+#define MEDIA_ENT_T_V4L2_SUBDEV_FLASH MEDIA_ENT_F_FLASH
+#define MEDIA_ENT_T_V4L2_SUBDEV_LENS MEDIA_ENT_F_LENS
+#define MEDIA_ENT_T_V4L2_SUBDEV_DECODER MEDIA_ENT_F_ATV_DECODER
+#define MEDIA_ENT_T_V4L2_SUBDEV_TUNER MEDIA_ENT_F_TUNER
#endif
/* Entity flags */
--
2.4.3
More information about the linux-arm-kernel
mailing list