aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab@osg.samsung.com>2015-12-10 14:25:41 -0500
committerMauro Carvalho Chehab <mchehab@osg.samsung.com>2016-01-11 09:19:01 -0500
commit4ca72efaeffd0d244c44307abc9d4cb11f8ad475 (patch)
treeae953c05584fabbae89814a148410021160e0ab5
parentd87cdb884486bfa795be99c83a5b3ac4d428ca84 (diff)
[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 Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
-rw-r--r--drivers/media/dvb-core/dvbdev.c20
-rw-r--r--drivers/media/dvb-frontends/au8522_decoder.c2
-rw-r--r--drivers/media/i2c/adp1653.c2
-rw-r--r--drivers/media/i2c/adv7180.c2
-rw-r--r--drivers/media/i2c/as3645a.c2
-rw-r--r--drivers/media/i2c/cx25840/cx25840-core.c2
-rw-r--r--drivers/media/i2c/lm3560.c2
-rw-r--r--drivers/media/i2c/lm3646.c2
-rw-r--r--drivers/media/i2c/m5mols/m5mols_core.c2
-rw-r--r--drivers/media/i2c/noon010pc30.c2
-rw-r--r--drivers/media/i2c/ov2659.c2
-rw-r--r--drivers/media/i2c/ov9650.c2
-rw-r--r--drivers/media/i2c/s5c73m3/s5c73m3-core.c4
-rw-r--r--drivers/media/i2c/s5k4ecgx.c2
-rw-r--r--drivers/media/i2c/s5k5baf.c6
-rw-r--r--drivers/media/i2c/s5k6aa.c2
-rw-r--r--drivers/media/i2c/smiapp/smiapp-core.c2
-rw-r--r--drivers/media/i2c/tvp514x.c2
-rw-r--r--drivers/media/i2c/tvp7002.c2
-rw-r--r--drivers/media/media-device.c4
-rw-r--r--drivers/media/platform/xilinx/xilinx-dma.c2
-rw-r--r--drivers/media/usb/au0828/au0828-core.c4
-rw-r--r--drivers/media/usb/au0828/au0828-video.c8
-rw-r--r--drivers/media/usb/cx231xx/cx231xx-cards.c4
-rw-r--r--drivers/media/usb/cx231xx/cx231xx-video.c2
-rw-r--r--drivers/media/v4l2-core/tuner-core.c2
-rw-r--r--drivers/media/v4l2-core/v4l2-dev.c14
-rw-r--r--drivers/media/v4l2-core/v4l2-flash-led-class.c2
-rw-r--r--drivers/media/v4l2-core/v4l2-subdev.c4
-rw-r--r--include/media/media-entity.h18
-rw-r--r--include/uapi/linux/media.h122
31 files changed, 127 insertions, 121 deletions
diff --git a/drivers/media/dvb-core/dvbdev.c b/drivers/media/dvb-core/dvbdev.c
index f6fc95d1345b..f64e8b3fb687 100644
--- a/drivers/media/dvb-core/dvbdev.c
+++ b/drivers/media/dvb-core/dvbdev.c
@@ -242,7 +242,7 @@ static int dvb_create_tsout_entity(struct dvb_device *dvbdev,
242 if (!entity->name) 242 if (!entity->name)
243 return -ENOMEM; 243 return -ENOMEM;
244 244
245 entity->function = MEDIA_ENT_T_DVB_TSOUT; 245 entity->function = MEDIA_ENT_F_IO_DTV;
246 pads->flags = MEDIA_PAD_FL_SINK; 246 pads->flags = MEDIA_PAD_FL_SINK;
247 247
248 ret = media_entity_init(entity, 1, pads); 248 ret = media_entity_init(entity, 1, pads);
@@ -315,18 +315,18 @@ static int dvb_create_media_entity(struct dvb_device *dvbdev,
315 315
316 switch (type) { 316 switch (type) {
317 case DVB_DEVICE_FRONTEND: 317 case DVB_DEVICE_FRONTEND:
318 dvbdev->entity->function = MEDIA_ENT_T_DVB_DEMOD; 318 dvbdev->entity->function = MEDIA_ENT_F_DTV_DEMOD;
319 dvbdev->pads[0].flags = MEDIA_PAD_FL_SINK; 319 dvbdev->pads[0].flags = MEDIA_PAD_FL_SINK;
320 dvbdev->pads[1].flags = MEDIA_PAD_FL_SOURCE; 320 dvbdev->pads[1].flags = MEDIA_PAD_FL_SOURCE;
321 break; 321 break;
322 case DVB_DEVICE_DEMUX: 322 case DVB_DEVICE_DEMUX:
323 dvbdev->entity->function = MEDIA_ENT_T_DVB_DEMUX; 323 dvbdev->entity->function = MEDIA_ENT_F_TS_DEMUX;
324 dvbdev->pads[0].flags = MEDIA_PAD_FL_SINK; 324 dvbdev->pads[0].flags = MEDIA_PAD_FL_SINK;
325 for (i = 1; i < npads; i++) 325 for (i = 1; i < npads; i++)
326 dvbdev->pads[i].flags = MEDIA_PAD_FL_SOURCE; 326 dvbdev->pads[i].flags = MEDIA_PAD_FL_SOURCE;
327 break; 327 break;
328 case DVB_DEVICE_CA: 328 case DVB_DEVICE_CA:
329 dvbdev->entity->function = MEDIA_ENT_T_DVB_CA; 329 dvbdev->entity->function = MEDIA_ENT_F_DTV_CA;
330 dvbdev->pads[0].flags = MEDIA_PAD_FL_SINK; 330 dvbdev->pads[0].flags = MEDIA_PAD_FL_SINK;
331 dvbdev->pads[1].flags = MEDIA_PAD_FL_SOURCE; 331 dvbdev->pads[1].flags = MEDIA_PAD_FL_SOURCE;
332 break; 332 break;
@@ -556,16 +556,16 @@ int dvb_create_media_graph(struct dvb_adapter *adap)
556 556
557 media_device_for_each_entity(entity, mdev) { 557 media_device_for_each_entity(entity, mdev) {
558 switch (entity->function) { 558 switch (entity->function) {
559 case MEDIA_ENT_T_V4L2_SUBDEV_TUNER: 559 case MEDIA_ENT_F_TUNER:
560 tuner = entity; 560 tuner = entity;
561 break; 561 break;
562 case MEDIA_ENT_T_DVB_DEMOD: 562 case MEDIA_ENT_F_DTV_DEMOD:
563 demod = entity; 563 demod = entity;
564 break; 564 break;
565 case MEDIA_ENT_T_DVB_DEMUX: 565 case MEDIA_ENT_F_TS_DEMUX:
566 demux = entity; 566 demux = entity;
567 break; 567 break;
568 case MEDIA_ENT_T_DVB_CA: 568 case MEDIA_ENT_F_DTV_CA:
569 ca = entity; 569 ca = entity;
570 break; 570 break;
571 } 571 }
@@ -594,7 +594,7 @@ int dvb_create_media_graph(struct dvb_adapter *adap)
594 /* Create demux links for each ringbuffer/pad */ 594 /* Create demux links for each ringbuffer/pad */
595 if (demux) { 595 if (demux) {
596 media_device_for_each_entity(entity, mdev) { 596 media_device_for_each_entity(entity, mdev) {
597 if (entity->function == MEDIA_ENT_T_DVB_TSOUT) { 597 if (entity->function == MEDIA_ENT_F_IO_DTV) {
598 if (!strncmp(entity->name, DVR_TSOUT, 598 if (!strncmp(entity->name, DVR_TSOUT,
599 strlen(DVR_TSOUT))) { 599 strlen(DVR_TSOUT))) {
600 ret = media_create_pad_link(demux, 600 ret = media_create_pad_link(demux,
@@ -639,7 +639,7 @@ int dvb_create_media_graph(struct dvb_adapter *adap)
639 } 639 }
640 640
641 media_device_for_each_entity(entity, mdev) { 641 media_device_for_each_entity(entity, mdev) {
642 if (entity->function == MEDIA_ENT_T_DVB_TSOUT) { 642 if (entity->function == MEDIA_ENT_F_IO_DTV) {
643 if (!strcmp(entity->name, DVR_TSOUT)) { 643 if (!strcmp(entity->name, DVR_TSOUT)) {
644 link = media_create_intf_link(entity, 644 link = media_create_intf_link(entity,
645 intf, 645 intf,
diff --git a/drivers/media/dvb-frontends/au8522_decoder.c b/drivers/media/dvb-frontends/au8522_decoder.c
index 664ec0dcd02a..464a2beca30d 100644
--- a/drivers/media/dvb-frontends/au8522_decoder.c
+++ b/drivers/media/dvb-frontends/au8522_decoder.c
@@ -766,7 +766,7 @@ static int au8522_probe(struct i2c_client *client,
766 state->pads[AU8522_PAD_INPUT].flags = MEDIA_PAD_FL_SINK; 766 state->pads[AU8522_PAD_INPUT].flags = MEDIA_PAD_FL_SINK;
767 state->pads[AU8522_PAD_VID_OUT].flags = MEDIA_PAD_FL_SOURCE; 767 state->pads[AU8522_PAD_VID_OUT].flags = MEDIA_PAD_FL_SOURCE;
768 state->pads[AU8522_PAD_VBI_OUT].flags = MEDIA_PAD_FL_SOURCE; 768 state->pads[AU8522_PAD_VBI_OUT].flags = MEDIA_PAD_FL_SOURCE;
769 sd->entity.function = MEDIA_ENT_T_V4L2_SUBDEV_DECODER; 769 sd->entity.function = MEDIA_ENT_F_ATV_DECODER;
770 770
771 ret = media_entity_init(&sd->entity, ARRAY_SIZE(state->pads), 771 ret = media_entity_init(&sd->entity, ARRAY_SIZE(state->pads),
772 state->pads); 772 state->pads);
diff --git a/drivers/media/i2c/adp1653.c b/drivers/media/i2c/adp1653.c
index 9d99182cd165..7150f35d5935 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,
516 if (ret < 0) 516 if (ret < 0)
517 goto free_and_quit; 517 goto free_and_quit;
518 518
519 flash->subdev.entity.function = MEDIA_ENT_T_V4L2_SUBDEV_FLASH; 519 flash->subdev.entity.function = MEDIA_ENT_F_FLASH;
520 520
521 return 0; 521 return 0;
522 522
diff --git a/drivers/media/i2c/adv7180.c b/drivers/media/i2c/adv7180.c
index 0fca8677014c..2ebe9efdfc1b 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,
1213 goto err_unregister_vpp_client; 1213 goto err_unregister_vpp_client;
1214 1214
1215 state->pad.flags = MEDIA_PAD_FL_SOURCE; 1215 state->pad.flags = MEDIA_PAD_FL_SOURCE;
1216 sd->entity.flags |= MEDIA_ENT_T_V4L2_SUBDEV_DECODER; 1216 sd->entity.flags |= MEDIA_ENT_F_ATV_DECODER;
1217 ret = media_entity_init(&sd->entity, 1, &state->pad); 1217 ret = media_entity_init(&sd->entity, 1, &state->pad);
1218 if (ret) 1218 if (ret)
1219 goto err_free_ctrl; 1219 goto err_free_ctrl;
diff --git a/drivers/media/i2c/as3645a.c b/drivers/media/i2c/as3645a.c
index f45108c84f4d..b1bc4d0f76f2 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,
831 if (ret < 0) 831 if (ret < 0)
832 goto done; 832 goto done;
833 833
834 flash->subdev.entity.function = MEDIA_ENT_T_V4L2_SUBDEV_FLASH; 834 flash->subdev.entity.function = MEDIA_ENT_F_FLASH;
835 835
836 mutex_init(&flash->power_lock); 836 mutex_init(&flash->power_lock);
837 837
diff --git a/drivers/media/i2c/cx25840/cx25840-core.c b/drivers/media/i2c/cx25840/cx25840-core.c
index 73bd05ee2fee..4d975aa5be36 100644
--- a/drivers/media/i2c/cx25840/cx25840-core.c
+++ b/drivers/media/i2c/cx25840/cx25840-core.c
@@ -5211,7 +5211,7 @@ static int cx25840_probe(struct i2c_client *client,
5211 state->pads[CX25840_PAD_INPUT].flags = MEDIA_PAD_FL_SINK; 5211 state->pads[CX25840_PAD_INPUT].flags = MEDIA_PAD_FL_SINK;
5212 state->pads[CX25840_PAD_VID_OUT].flags = MEDIA_PAD_FL_SOURCE; 5212 state->pads[CX25840_PAD_VID_OUT].flags = MEDIA_PAD_FL_SOURCE;
5213 state->pads[CX25840_PAD_VBI_OUT].flags = MEDIA_PAD_FL_SOURCE; 5213 state->pads[CX25840_PAD_VBI_OUT].flags = MEDIA_PAD_FL_SOURCE;
5214 sd->entity.function = MEDIA_ENT_T_V4L2_SUBDEV_DECODER; 5214 sd->entity.function = MEDIA_ENT_F_ATV_DECODER;
5215 5215
5216 ret = media_entity_init(&sd->entity, ARRAY_SIZE(state->pads), 5216 ret = media_entity_init(&sd->entity, ARRAY_SIZE(state->pads),
5217 state->pads); 5217 state->pads);
diff --git a/drivers/media/i2c/lm3560.c b/drivers/media/i2c/lm3560.c
index aa8b4832a1bc..98266f707ea0 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,
368 rval = media_entity_init(&flash->subdev_led[led_no].entity, 0, NULL); 368 rval = media_entity_init(&flash->subdev_led[led_no].entity, 0, NULL);
369 if (rval < 0) 369 if (rval < 0)
370 goto err_out; 370 goto err_out;
371 flash->subdev_led[led_no].entity.function = MEDIA_ENT_T_V4L2_SUBDEV_FLASH; 371 flash->subdev_led[led_no].entity.function = MEDIA_ENT_F_FLASH;
372 372
373 return rval; 373 return rval;
374 374
diff --git a/drivers/media/i2c/lm3646.c b/drivers/media/i2c/lm3646.c
index a52cc3a6fb55..ba5ee0d7a78e 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)
285 rval = media_entity_init(&flash->subdev_led.entity, 0, NULL); 285 rval = media_entity_init(&flash->subdev_led.entity, 0, NULL);
286 if (rval < 0) 286 if (rval < 0)
287 goto err_out; 287 goto err_out;
288 flash->subdev_led.entity.function = MEDIA_ENT_T_V4L2_SUBDEV_FLASH; 288 flash->subdev_led.entity.function = MEDIA_ENT_F_FLASH;
289 return rval; 289 return rval;
290 290
291err_out: 291err_out:
diff --git a/drivers/media/i2c/m5mols/m5mols_core.c b/drivers/media/i2c/m5mols/m5mols_core.c
index ae5645fe3a6e..bec5cea23b65 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,
978 ret = media_entity_init(&sd->entity, 1, &info->pad); 978 ret = media_entity_init(&sd->entity, 1, &info->pad);
979 if (ret < 0) 979 if (ret < 0)
980 return ret; 980 return ret;
981 sd->entity.function = MEDIA_ENT_T_V4L2_SUBDEV_SENSOR; 981 sd->entity.function = MEDIA_ENT_F_CAM_SENSOR;
982 982
983 init_waitqueue_head(&info->irq_waitq); 983 init_waitqueue_head(&info->irq_waitq);
984 mutex_init(&info->lock); 984 mutex_init(&info->lock);
diff --git a/drivers/media/i2c/noon010pc30.c b/drivers/media/i2c/noon010pc30.c
index 0226fc668529..47ea3f79eacc 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,
779 goto np_err; 779 goto np_err;
780 780
781 info->pad.flags = MEDIA_PAD_FL_SOURCE; 781 info->pad.flags = MEDIA_PAD_FL_SOURCE;
782 sd->entity.function = MEDIA_ENT_T_V4L2_SUBDEV_SENSOR; 782 sd->entity.function = MEDIA_ENT_F_CAM_SENSOR;
783 ret = media_entity_init(&sd->entity, 1, &info->pad); 783 ret = media_entity_init(&sd->entity, 1, &info->pad);
784 if (ret < 0) 784 if (ret < 0)
785 goto np_err; 785 goto np_err;
diff --git a/drivers/media/i2c/ov2659.c b/drivers/media/i2c/ov2659.c
index 8a2efe2a24c4..cf8e71610248 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,
1445 1445
1446#if defined(CONFIG_MEDIA_CONTROLLER) 1446#if defined(CONFIG_MEDIA_CONTROLLER)
1447 ov2659->pad.flags = MEDIA_PAD_FL_SOURCE; 1447 ov2659->pad.flags = MEDIA_PAD_FL_SOURCE;
1448 sd->entity.function = MEDIA_ENT_T_V4L2_SUBDEV_SENSOR; 1448 sd->entity.function = MEDIA_ENT_F_CAM_SENSOR;
1449 ret = media_entity_init(&sd->entity, 1, &ov2659->pad); 1449 ret = media_entity_init(&sd->entity, 1, &ov2659->pad);
1450 if (ret < 0) { 1450 if (ret < 0) {
1451 v4l2_ctrl_handler_free(&ov2659->ctrls); 1451 v4l2_ctrl_handler_free(&ov2659->ctrls);
diff --git a/drivers/media/i2c/ov9650.c b/drivers/media/i2c/ov9650.c
index 27c4def7e4fc..adb4aab45c10 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,
1500 return ret; 1500 return ret;
1501 1501
1502 ov965x->pad.flags = MEDIA_PAD_FL_SOURCE; 1502 ov965x->pad.flags = MEDIA_PAD_FL_SOURCE;
1503 sd->entity.function = MEDIA_ENT_T_V4L2_SUBDEV_SENSOR; 1503 sd->entity.function = MEDIA_ENT_F_CAM_SENSOR;
1504 ret = media_entity_init(&sd->entity, 1, &ov965x->pad); 1504 ret = media_entity_init(&sd->entity, 1, &ov965x->pad);
1505 if (ret < 0) 1505 if (ret < 0)
1506 return ret; 1506 return ret;
diff --git a/drivers/media/i2c/s5c73m3/s5c73m3-core.c b/drivers/media/i2c/s5c73m3/s5c73m3-core.c
index dd48e35ede28..3d578f2ce7b2 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,
1688 1688
1689 state->sensor_pads[S5C73M3_JPEG_PAD].flags = MEDIA_PAD_FL_SOURCE; 1689 state->sensor_pads[S5C73M3_JPEG_PAD].flags = MEDIA_PAD_FL_SOURCE;
1690 state->sensor_pads[S5C73M3_ISP_PAD].flags = MEDIA_PAD_FL_SOURCE; 1690 state->sensor_pads[S5C73M3_ISP_PAD].flags = MEDIA_PAD_FL_SOURCE;
1691 sd->entity.function = MEDIA_ENT_T_V4L2_SUBDEV_SENSOR; 1691 sd->entity.function = MEDIA_ENT_F_CAM_SENSOR;
1692 1692
1693 ret = media_entity_init(&sd->entity, S5C73M3_NUM_PADS, 1693 ret = media_entity_init(&sd->entity, S5C73M3_NUM_PADS,
1694 state->sensor_pads); 1694 state->sensor_pads);
@@ -1704,7 +1704,7 @@ static int s5c73m3_probe(struct i2c_client *client,
1704 state->oif_pads[OIF_ISP_PAD].flags = MEDIA_PAD_FL_SINK; 1704 state->oif_pads[OIF_ISP_PAD].flags = MEDIA_PAD_FL_SINK;
1705 state->oif_pads[OIF_JPEG_PAD].flags = MEDIA_PAD_FL_SINK; 1705 state->oif_pads[OIF_JPEG_PAD].flags = MEDIA_PAD_FL_SINK;
1706 state->oif_pads[OIF_SOURCE_PAD].flags = MEDIA_PAD_FL_SOURCE; 1706 state->oif_pads[OIF_SOURCE_PAD].flags = MEDIA_PAD_FL_SOURCE;
1707 oif_sd->entity.function = MEDIA_ENT_T_V4L2_SUBDEV_UNKNOWN; 1707 oif_sd->entity.function = MEDIA_ENT_F_V4L2_SUBDEV_UNKNOWN;
1708 1708
1709 ret = media_entity_init(&oif_sd->entity, OIF_NUM_PADS, 1709 ret = media_entity_init(&oif_sd->entity, OIF_NUM_PADS,
1710 state->oif_pads); 1710 state->oif_pads);
diff --git a/drivers/media/i2c/s5k4ecgx.c b/drivers/media/i2c/s5k4ecgx.c
index 026d08740537..bacec84e773f 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,
961 sd->flags |= V4L2_SUBDEV_FL_HAS_DEVNODE; 961 sd->flags |= V4L2_SUBDEV_FL_HAS_DEVNODE;
962 962
963 priv->pad.flags = MEDIA_PAD_FL_SOURCE; 963 priv->pad.flags = MEDIA_PAD_FL_SOURCE;
964 sd->entity.function = MEDIA_ENT_T_V4L2_SUBDEV_SENSOR; 964 sd->entity.function = MEDIA_ENT_F_CAM_SENSOR;
965 ret = media_entity_init(&sd->entity, 1, &priv->pad); 965 ret = media_entity_init(&sd->entity, 1, &priv->pad);
966 if (ret) 966 if (ret)
967 return ret; 967 return ret;
diff --git a/drivers/media/i2c/s5k5baf.c b/drivers/media/i2c/s5k5baf.c
index 1d47b30953a4..564938ab2abd 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)
408 408
409static inline bool s5k5baf_is_cis_subdev(struct v4l2_subdev *sd) 409static inline bool s5k5baf_is_cis_subdev(struct v4l2_subdev *sd)
410{ 410{
411 return sd->entity.function == MEDIA_ENT_T_V4L2_SUBDEV_SENSOR; 411 return sd->entity.function == MEDIA_ENT_F_CAM_SENSOR;
412} 412}
413 413
414static inline struct s5k5baf *to_s5k5baf(struct v4l2_subdev *sd) 414static inline struct s5k5baf *to_s5k5baf(struct v4l2_subdev *sd)
@@ -1904,7 +1904,7 @@ static int s5k5baf_configure_subdevs(struct s5k5baf *state,
1904 sd->flags |= V4L2_SUBDEV_FL_HAS_DEVNODE; 1904 sd->flags |= V4L2_SUBDEV_FL_HAS_DEVNODE;
1905 1905
1906 state->cis_pad.flags = MEDIA_PAD_FL_SOURCE; 1906 state->cis_pad.flags = MEDIA_PAD_FL_SOURCE;
1907 sd->entity.function = MEDIA_ENT_T_V4L2_SUBDEV_SENSOR; 1907 sd->entity.function = MEDIA_ENT_F_CAM_SENSOR;
1908 ret = media_entity_init(&sd->entity, NUM_CIS_PADS, &state->cis_pad); 1908 ret = media_entity_init(&sd->entity, NUM_CIS_PADS, &state->cis_pad);
1909 if (ret < 0) 1909 if (ret < 0)
1910 goto err; 1910 goto err;
@@ -1919,7 +1919,7 @@ static int s5k5baf_configure_subdevs(struct s5k5baf *state,
1919 1919
1920 state->pads[PAD_CIS].flags = MEDIA_PAD_FL_SINK; 1920 state->pads[PAD_CIS].flags = MEDIA_PAD_FL_SINK;
1921 state->pads[PAD_OUT].flags = MEDIA_PAD_FL_SOURCE; 1921 state->pads[PAD_OUT].flags = MEDIA_PAD_FL_SOURCE;
1922 sd->entity.function = MEDIA_ENT_T_V4L2_SUBDEV_UNKNOWN; 1922 sd->entity.function = MEDIA_ENT_F_V4L2_SUBDEV_UNKNOWN;
1923 ret = media_entity_init(&sd->entity, NUM_ISP_PADS, state->pads); 1923 ret = media_entity_init(&sd->entity, NUM_ISP_PADS, state->pads);
1924 1924
1925 if (!ret) 1925 if (!ret)
diff --git a/drivers/media/i2c/s5k6aa.c b/drivers/media/i2c/s5k6aa.c
index d7244234473e..d71d104441bd 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,
1577 sd->flags |= V4L2_SUBDEV_FL_HAS_DEVNODE; 1577 sd->flags |= V4L2_SUBDEV_FL_HAS_DEVNODE;
1578 1578
1579 s5k6aa->pad.flags = MEDIA_PAD_FL_SOURCE; 1579 s5k6aa->pad.flags = MEDIA_PAD_FL_SOURCE;
1580 sd->entity.function = MEDIA_ENT_T_V4L2_SUBDEV_SENSOR; 1580 sd->entity.function = MEDIA_ENT_F_CAM_SENSOR;
1581 ret = media_entity_init(&sd->entity, 1, &s5k6aa->pad); 1581 ret = media_entity_init(&sd->entity, 1, &s5k6aa->pad);
1582 if (ret) 1582 if (ret)
1583 return ret; 1583 return ret;
diff --git a/drivers/media/i2c/smiapp/smiapp-core.c b/drivers/media/i2c/smiapp/smiapp-core.c
index ef325b653697..3eaa69ee341b 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)
2763 2763
2764 dev_dbg(&client->dev, "profile %d\n", sensor->minfo.smiapp_profile); 2764 dev_dbg(&client->dev, "profile %d\n", sensor->minfo.smiapp_profile);
2765 2765
2766 sensor->pixel_array->sd.entity.function = MEDIA_ENT_T_V4L2_SUBDEV_SENSOR; 2766 sensor->pixel_array->sd.entity.function = MEDIA_ENT_F_CAM_SENSOR;
2767 2767
2768 /* final steps */ 2768 /* final steps */
2769 smiapp_read_frame_fmt(sensor); 2769 smiapp_read_frame_fmt(sensor);
diff --git a/drivers/media/i2c/tvp514x.c b/drivers/media/i2c/tvp514x.c
index 11e426dbe891..455dd4e6a1da 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)
1095#if defined(CONFIG_MEDIA_CONTROLLER) 1095#if defined(CONFIG_MEDIA_CONTROLLER)
1096 decoder->pad.flags = MEDIA_PAD_FL_SOURCE; 1096 decoder->pad.flags = MEDIA_PAD_FL_SOURCE;
1097 decoder->sd.flags |= V4L2_SUBDEV_FL_HAS_DEVNODE; 1097 decoder->sd.flags |= V4L2_SUBDEV_FL_HAS_DEVNODE;
1098 decoder->sd.entity.flags |= MEDIA_ENT_T_V4L2_SUBDEV_DECODER; 1098 decoder->sd.entity.flags |= MEDIA_ENT_F_ATV_DECODER;
1099 1099
1100 ret = media_entity_init(&decoder->sd.entity, 1, &decoder->pad); 1100 ret = media_entity_init(&decoder->sd.entity, 1, &decoder->pad);
1101 if (ret < 0) { 1101 if (ret < 0) {
diff --git a/drivers/media/i2c/tvp7002.c b/drivers/media/i2c/tvp7002.c
index a5ee2b8df429..216a07956fe9 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)
1012#if defined(CONFIG_MEDIA_CONTROLLER) 1012#if defined(CONFIG_MEDIA_CONTROLLER)
1013 device->pad.flags = MEDIA_PAD_FL_SOURCE; 1013 device->pad.flags = MEDIA_PAD_FL_SOURCE;
1014 device->sd.flags |= V4L2_SUBDEV_FL_HAS_DEVNODE; 1014 device->sd.flags |= V4L2_SUBDEV_FL_HAS_DEVNODE;
1015 device->sd.entity.flags |= MEDIA_ENT_T_V4L2_SUBDEV_DECODER; 1015 device->sd.entity.flags |= MEDIA_ENT_F_ATV_DECODER;
1016 1016
1017 error = media_entity_init(&device->sd.entity, 1, &device->pad); 1017 error = media_entity_init(&device->sd.entity, 1, &device->pad);
1018 if (error < 0) 1018 if (error < 0)
diff --git a/drivers/media/media-device.c b/drivers/media/media-device.c
index 83525ac29328..f177d50c7a44 100644
--- a/drivers/media/media-device.c
+++ b/drivers/media/media-device.c
@@ -611,8 +611,8 @@ int __must_check media_device_register_entity(struct media_device *mdev,
611{ 611{
612 int i; 612 int i;
613 613
614 if (entity->function == MEDIA_ENT_T_V4L2_SUBDEV_UNKNOWN || 614 if (entity->function == MEDIA_ENT_F_V4L2_SUBDEV_UNKNOWN ||
615 entity->function == MEDIA_ENT_T_UNKNOWN) 615 entity->function == MEDIA_ENT_F_UNKNOWN)
616 dev_warn(mdev->dev, 616 dev_warn(mdev->dev,
617 "Entity type for entity %s was not initialized!\n", 617 "Entity type for entity %s was not initialized!\n",
618 entity->name); 618 entity->name);
diff --git a/drivers/media/platform/xilinx/xilinx-dma.c b/drivers/media/platform/xilinx/xilinx-dma.c
index 1f0043f3ec4d..b69c9630114d 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,
191 while ((entity = media_entity_graph_walk_next(&graph))) { 191 while ((entity = media_entity_graph_walk_next(&graph))) {
192 struct xvip_dma *dma; 192 struct xvip_dma *dma;
193 193
194 if (entity->function != MEDIA_ENT_T_V4L2_VIDEO) 194 if (entity->function != MEDIA_ENT_F_IO_V4L)
195 continue; 195 continue;
196 196
197 dma = to_xvip_dma(media_entity_to_video_device(entity)); 197 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 865d68dc4dc8..1b207fa16a55 100644
--- a/drivers/media/usb/au0828/au0828-core.c
+++ b/drivers/media/usb/au0828/au0828-core.c
@@ -266,10 +266,10 @@ static int au0828_create_media_graph(struct au0828_dev *dev)
266 266
267 media_device_for_each_entity(entity, mdev) { 267 media_device_for_each_entity(entity, mdev) {
268 switch (entity->function) { 268 switch (entity->function) {
269 case MEDIA_ENT_T_V4L2_SUBDEV_TUNER: 269 case MEDIA_ENT_F_TUNER:
270 tuner = entity; 270 tuner = entity;
271 break; 271 break;
272 case MEDIA_ENT_T_V4L2_SUBDEV_DECODER: 272 case MEDIA_ENT_F_ATV_DECODER:
273 decoder = entity; 273 decoder = entity;
274 break; 274 break;
275 } 275 }
diff --git a/drivers/media/usb/au0828/au0828-video.c b/drivers/media/usb/au0828/au0828-video.c
index 066ba4b7c746..839361c035ff 100644
--- a/drivers/media/usb/au0828/au0828-video.c
+++ b/drivers/media/usb/au0828/au0828-video.c
@@ -1832,18 +1832,18 @@ static void au0828_analog_create_entities(struct au0828_dev *dev)
1832 1832
1833 switch (AUVI_INPUT(i).type) { 1833 switch (AUVI_INPUT(i).type) {
1834 case AU0828_VMUX_COMPOSITE: 1834 case AU0828_VMUX_COMPOSITE:
1835 ent->function = MEDIA_ENT_T_CONN_COMPOSITE; 1835 ent->function = MEDIA_ENT_F_CONN_COMPOSITE;
1836 break; 1836 break;
1837 case AU0828_VMUX_SVIDEO: 1837 case AU0828_VMUX_SVIDEO:
1838 ent->function = MEDIA_ENT_T_CONN_SVIDEO; 1838 ent->function = MEDIA_ENT_F_CONN_SVIDEO;
1839 break; 1839 break;
1840 case AU0828_VMUX_CABLE: 1840 case AU0828_VMUX_CABLE:
1841 case AU0828_VMUX_TELEVISION: 1841 case AU0828_VMUX_TELEVISION:
1842 case AU0828_VMUX_DVB: 1842 case AU0828_VMUX_DVB:
1843 ent->function = MEDIA_ENT_T_CONN_RF; 1843 ent->function = MEDIA_ENT_F_CONN_RF;
1844 break; 1844 break;
1845 default: /* AU0828_VMUX_DEBUG */ 1845 default: /* AU0828_VMUX_DEBUG */
1846 ent->function = MEDIA_ENT_T_CONN_TEST; 1846 ent->function = MEDIA_ENT_F_CONN_TEST;
1847 break; 1847 break;
1848 } 1848 }
1849 1849
diff --git a/drivers/media/usb/cx231xx/cx231xx-cards.c b/drivers/media/usb/cx231xx/cx231xx-cards.c
index 5062c42a694c..0e1efc59ff58 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)
1250 1250
1251 media_device_for_each_entity(entity, mdev) { 1251 media_device_for_each_entity(entity, mdev) {
1252 switch (entity->function) { 1252 switch (entity->function) {
1253 case MEDIA_ENT_T_V4L2_SUBDEV_TUNER: 1253 case MEDIA_ENT_F_TUNER:
1254 tuner = entity; 1254 tuner = entity;
1255 break; 1255 break;
1256 case MEDIA_ENT_T_V4L2_SUBDEV_DECODER: 1256 case MEDIA_ENT_F_ATV_DECODER:
1257 decoder = entity; 1257 decoder = entity;
1258 break; 1258 break;
1259 } 1259 }
diff --git a/drivers/media/usb/cx231xx/cx231xx-video.c b/drivers/media/usb/cx231xx/cx231xx-video.c
index 110359deab37..905ccd7cbc6d 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)
119 * this should be enough for the actual needs. 119 * this should be enough for the actual needs.
120 */ 120 */
121 media_device_for_each_entity(entity, mdev) { 121 media_device_for_each_entity(entity, mdev) {
122 if (entity->function == MEDIA_ENT_T_V4L2_SUBDEV_DECODER) { 122 if (entity->function == MEDIA_ENT_F_ATV_DECODER) {
123 decoder = entity; 123 decoder = entity;
124 break; 124 break;
125 } 125 }
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:
698#if defined(CONFIG_MEDIA_CONTROLLER) 698#if defined(CONFIG_MEDIA_CONTROLLER)
699 t->pad[TUNER_PAD_RF_INPUT].flags = MEDIA_PAD_FL_SINK; 699 t->pad[TUNER_PAD_RF_INPUT].flags = MEDIA_PAD_FL_SINK;
700 t->pad[TUNER_PAD_IF_OUTPUT].flags = MEDIA_PAD_FL_SOURCE; 700 t->pad[TUNER_PAD_IF_OUTPUT].flags = MEDIA_PAD_FL_SOURCE;
701 t->sd.entity.function = MEDIA_ENT_T_V4L2_SUBDEV_TUNER; 701 t->sd.entity.function = MEDIA_ENT_F_TUNER;
702 t->sd.entity.name = t->name; 702 t->sd.entity.name = t->name;
703 703
704 ret = media_entity_init(&t->sd.entity, TUNER_NUM_PADS, &t->pad[0]); 704 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 965449958e97..ed96642c27bf 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)
197 if (v4l2_dev->mdev) { 197 if (v4l2_dev->mdev) {
198 /* Remove interfaces and interface links */ 198 /* Remove interfaces and interface links */
199 media_devnode_remove(vdev->intf_devnode); 199 media_devnode_remove(vdev->intf_devnode);
200 if (vdev->entity.function != MEDIA_ENT_T_UNKNOWN) 200 if (vdev->entity.function != MEDIA_ENT_F_UNKNOWN)
201 media_device_unregister_entity(&vdev->entity); 201 media_device_unregister_entity(&vdev->entity);
202 } 202 }
203#endif 203#endif
@@ -735,20 +735,20 @@ static int video_register_media_controller(struct video_device *vdev, int type)
735 if (!vdev->v4l2_dev->mdev) 735 if (!vdev->v4l2_dev->mdev)
736 return 0; 736 return 0;
737 737
738 vdev->entity.function = MEDIA_ENT_T_UNKNOWN; 738 vdev->entity.function = MEDIA_ENT_F_UNKNOWN;
739 739
740 switch (type) { 740 switch (type) {
741 case VFL_TYPE_GRABBER: 741 case VFL_TYPE_GRABBER:
742 intf_type = MEDIA_INTF_T_V4L_VIDEO; 742 intf_type = MEDIA_INTF_T_V4L_VIDEO;
743 vdev->entity.function = MEDIA_ENT_T_V4L2_VIDEO; 743 vdev->entity.function = MEDIA_ENT_F_IO_V4L;
744 break; 744 break;
745 case VFL_TYPE_VBI: 745 case VFL_TYPE_VBI:
746 intf_type = MEDIA_INTF_T_V4L_VBI; 746 intf_type = MEDIA_INTF_T_V4L_VBI;
747 vdev->entity.function = MEDIA_ENT_T_V4L2_VBI; 747 vdev->entity.function = MEDIA_ENT_F_IO_VBI;
748 break; 748 break;
749 case VFL_TYPE_SDR: 749 case VFL_TYPE_SDR:
750 intf_type = MEDIA_INTF_T_V4L_SWRADIO; 750 intf_type = MEDIA_INTF_T_V4L_SWRADIO;
751 vdev->entity.function = MEDIA_ENT_T_V4L2_SWRADIO; 751 vdev->entity.function = MEDIA_ENT_F_IO_SWRADIO;
752 break; 752 break;
753 case VFL_TYPE_RADIO: 753 case VFL_TYPE_RADIO:
754 intf_type = MEDIA_INTF_T_V4L_RADIO; 754 intf_type = MEDIA_INTF_T_V4L_RADIO;
@@ -766,7 +766,7 @@ static int video_register_media_controller(struct video_device *vdev, int type)
766 return 0; 766 return 0;
767 } 767 }
768 768
769 if (vdev->entity.function != MEDIA_ENT_T_UNKNOWN) { 769 if (vdev->entity.function != MEDIA_ENT_F_UNKNOWN) {
770 vdev->entity.name = vdev->name; 770 vdev->entity.name = vdev->name;
771 771
772 /* Needed just for backward compatibility with legacy MC API */ 772 /* Needed just for backward compatibility with legacy MC API */
@@ -793,7 +793,7 @@ static int video_register_media_controller(struct video_device *vdev, int type)
793 return -ENOMEM; 793 return -ENOMEM;
794 } 794 }
795 795
796 if (vdev->entity.function != MEDIA_ENT_T_UNKNOWN) { 796 if (vdev->entity.function != MEDIA_ENT_F_UNKNOWN) {
797 struct media_link *link; 797 struct media_link *link;
798 798
799 link = media_create_intf_link(&vdev->entity, 799 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(
655 if (ret < 0) 655 if (ret < 0)
656 return ERR_PTR(ret); 656 return ERR_PTR(ret);
657 657
658 sd->entity.function = MEDIA_ENT_T_V4L2_SUBDEV_FLASH; 658 sd->entity.function = MEDIA_ENT_F_FLASH;
659 659
660 ret = v4l2_flash_init_controls(v4l2_flash, config); 660 ret = v4l2_flash_init_controls(v4l2_flash, config);
661 if (ret < 0) 661 if (ret < 0)
diff --git a/drivers/media/v4l2-core/v4l2-subdev.c b/drivers/media/v4l2-core/v4l2-subdev.c
index b440cb66669c..d63083803144 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,
535 return v4l2_subdev_call(sd, pad, get_fmt, NULL, fmt); 535 return v4l2_subdev_call(sd, pad, get_fmt, NULL, fmt);
536 } 536 }
537 537
538 WARN(pad->entity->function != MEDIA_ENT_T_V4L2_VIDEO, 538 WARN(pad->entity->function != MEDIA_ENT_F_IO_V4L,
539 "Driver bug! Wrong media entity type 0x%08x, entity %s\n", 539 "Driver bug! Wrong media entity type 0x%08x, entity %s\n",
540 pad->entity->function, pad->entity->name); 540 pad->entity->function, pad->entity->name);
541 541
@@ -584,7 +584,7 @@ void v4l2_subdev_init(struct v4l2_subdev *sd, const struct v4l2_subdev_ops *ops)
584 sd->host_priv = NULL; 584 sd->host_priv = NULL;
585#if defined(CONFIG_MEDIA_CONTROLLER) 585#if defined(CONFIG_MEDIA_CONTROLLER)
586 sd->entity.name = sd->name; 586 sd->entity.name = sd->name;
587 sd->entity.function = MEDIA_ENT_T_V4L2_SUBDEV_UNKNOWN; 587 sd->entity.function = MEDIA_ENT_F_V4L2_SUBDEV_UNKNOWN;
588#endif 588#endif
589} 589}
590EXPORT_SYMBOL(v4l2_subdev_init); 590EXPORT_SYMBOL(v4l2_subdev_init);
diff --git a/include/media/media-entity.h b/include/media/media-entity.h
index 70ccd6cf14c1..df84e8eeb24b 100644
--- a/include/media/media-entity.h
+++ b/include/media/media-entity.h
@@ -274,9 +274,9 @@ static inline bool is_media_entity_v4l2_io(struct media_entity *entity)
274 return false; 274 return false;
275 275
276 switch (entity->function) { 276 switch (entity->function) {
277 case MEDIA_ENT_T_V4L2_VIDEO: 277 case MEDIA_ENT_F_IO_V4L:
278 case MEDIA_ENT_T_V4L2_VBI: 278 case MEDIA_ENT_F_IO_VBI:
279 case MEDIA_ENT_T_V4L2_SWRADIO: 279 case MEDIA_ENT_F_IO_SWRADIO:
280 return true; 280 return true;
281 default: 281 default:
282 return false; 282 return false;
@@ -289,12 +289,12 @@ static inline bool is_media_entity_v4l2_subdev(struct media_entity *entity)
289 return false; 289 return false;
290 290
291 switch (entity->function) { 291 switch (entity->function) {
292 case MEDIA_ENT_T_V4L2_SUBDEV_UNKNOWN: 292 case MEDIA_ENT_F_V4L2_SUBDEV_UNKNOWN:
293 case MEDIA_ENT_T_V4L2_SUBDEV_SENSOR: 293 case MEDIA_ENT_F_CAM_SENSOR:
294 case MEDIA_ENT_T_V4L2_SUBDEV_FLASH: 294 case MEDIA_ENT_F_FLASH:
295 case MEDIA_ENT_T_V4L2_SUBDEV_LENS: 295 case MEDIA_ENT_F_LENS:
296 case MEDIA_ENT_T_V4L2_SUBDEV_DECODER: 296 case MEDIA_ENT_F_ATV_DECODER:
297 case MEDIA_ENT_T_V4L2_SUBDEV_TUNER: 297 case MEDIA_ENT_F_TUNER:
298 return true; 298 return true;
299 299
300 default: 300 default:
diff --git a/include/uapi/linux/media.h b/include/uapi/linux/media.h
index 290dd5585dc8..ff6a8010c520 100644
--- a/include/uapi/linux/media.h
+++ b/include/uapi/linux/media.h
@@ -46,87 +46,93 @@ struct media_device_info {
46 * Initial value to be used when a new entity is created 46 * Initial value to be used when a new entity is created
47 * Drivers should change it to something useful 47 * Drivers should change it to something useful
48 */ 48 */
49#define MEDIA_ENT_T_UNKNOWN 0x00000000 49#define MEDIA_ENT_F_UNKNOWN 0x00000000
50 50
51/* 51/*
52 * Base numbers for entity types 52 * 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 each 55 * 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 0x00000000 59#define MEDIA_ENT_F_BASE 0x00000000
62#define MEDIA_ENT_T_V4L2_BASE 0x00010000 60#define MEDIA_ENT_F_OLD_BASE 0x00010000
63#define MEDIA_ENT_T_V4L2_SUBDEV_BASE 0x00020000 61#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) and 64 * 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 and 68#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 used 69#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 before 95 * 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_BASE 98
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 16 118#define MEDIA_ENT_TYPE_SHIFT 16
119#define MEDIA_ENT_TYPE_MASK 0x00ff0000 119#define MEDIA_ENT_TYPE_MASK 0x00ff0000
120#define MEDIA_ENT_SUBTYPE_MASK 0x0000ffff 120#define MEDIA_ENT_SUBTYPE_MASK 0x0000ffff
121 121
122#define MEDIA_ENT_T_DEVNODE MEDIA_ENT_T_V4L2_BASE 122#define MEDIA_ENT_T_DEVNODE MEDIA_ENT_F_OLD_BASE
123#define MEDIA_ENT_T_V4L2_SUBDEV MEDIA_ENT_T_V4L2_SUBDEV_BASE 123#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#endif 136#endif
131 137
132/* Entity flags */ 138/* Entity flags */