summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab@osg.samsung.com>2015-12-11 04:44:40 -0500
committerMauro Carvalho Chehab <mchehab@osg.samsung.com>2016-01-11 09:19:03 -0500
commitab22e77cd3d3073c8cac51b59713ef635678dfbe (patch)
treedfe14b163cd094531b260cab7e7d69d035b751da
parentb83e250833e6c40a9e92935ea6fc125b64792357 (diff)
[media] media framework: rename pads init function to media_entity_pads_init()
With the MC next gen rework, what's left for media_entity_init() is to just initialize the PADs. However, certain devices, like a FLASH led/light doesn't have any input or output PAD. So, there's no reason why calling media_entity_init() would be mandatory. Also, despite its name, what this function actually does is to initialize the PADs data. So, rename it to media_entity_pads_init() in order to reflect that. The media entity actual init happens during entity register, at media_device_register_entity(). We should move init of num_links and num_backlinks to it. Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
-rw-r--r--Documentation/media-framework.txt18
-rw-r--r--Documentation/video4linux/v4l2-framework.txt8
-rw-r--r--Documentation/zh_CN/video4linux/v4l2-framework.txt8
-rw-r--r--drivers/media/dvb-core/dvbdev.c4
-rw-r--r--drivers/media/dvb-frontends/au8522_decoder.c2
-rw-r--r--drivers/media/i2c/ad9389b.c2
-rw-r--r--drivers/media/i2c/adp1653.c2
-rw-r--r--drivers/media/i2c/adv7180.c2
-rw-r--r--drivers/media/i2c/adv7511.c2
-rw-r--r--drivers/media/i2c/adv7604.c2
-rw-r--r--drivers/media/i2c/adv7842.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/mt9m032.c2
-rw-r--r--drivers/media/i2c/mt9p031.c2
-rw-r--r--drivers/media/i2c/mt9t001.c2
-rw-r--r--drivers/media/i2c/mt9v032.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.c4
-rw-r--r--drivers/media/i2c/s5k6a3.c2
-rw-r--r--drivers/media/i2c/s5k6aa.c2
-rw-r--r--drivers/media/i2c/smiapp/smiapp-core.c6
-rw-r--r--drivers/media/i2c/tc358743.c2
-rw-r--r--drivers/media/i2c/tvp514x.c2
-rw-r--r--drivers/media/i2c/tvp7002.c2
-rw-r--r--drivers/media/media-device.c2
-rw-r--r--drivers/media/media-entity.c11
-rw-r--r--drivers/media/platform/exynos4-is/fimc-capture.c4
-rw-r--r--drivers/media/platform/exynos4-is/fimc-isp-video.c2
-rw-r--r--drivers/media/platform/exynos4-is/fimc-isp.c2
-rw-r--r--drivers/media/platform/exynos4-is/fimc-lite.c4
-rw-r--r--drivers/media/platform/exynos4-is/fimc-m2m.c2
-rw-r--r--drivers/media/platform/exynos4-is/mipi-csis.c2
-rw-r--r--drivers/media/platform/omap3isp/ispccdc.c2
-rw-r--r--drivers/media/platform/omap3isp/ispccp2.c2
-rw-r--r--drivers/media/platform/omap3isp/ispcsi2.c2
-rw-r--r--drivers/media/platform/omap3isp/isppreview.c2
-rw-r--r--drivers/media/platform/omap3isp/ispresizer.c2
-rw-r--r--drivers/media/platform/omap3isp/ispstat.c2
-rw-r--r--drivers/media/platform/omap3isp/ispvideo.c2
-rw-r--r--drivers/media/platform/s3c-camif/camif-capture.c4
-rw-r--r--drivers/media/platform/vsp1/vsp1_entity.c2
-rw-r--r--drivers/media/platform/vsp1/vsp1_video.c2
-rw-r--r--drivers/media/platform/xilinx/xilinx-dma.c2
-rw-r--r--drivers/media/platform/xilinx/xilinx-tpg.c2
-rw-r--r--drivers/media/usb/au0828/au0828-video.c6
-rw-r--r--drivers/media/usb/cx231xx/cx231xx-video.c4
-rw-r--r--drivers/media/usb/uvc/uvc_entity.c4
-rw-r--r--drivers/media/v4l2-core/tuner-core.c2
-rw-r--r--drivers/media/v4l2-core/v4l2-flash-led-class.c2
-rw-r--r--drivers/staging/media/davinci_vpfe/dm365_ipipe.c2
-rw-r--r--drivers/staging/media/davinci_vpfe/dm365_ipipeif.c2
-rw-r--r--drivers/staging/media/davinci_vpfe/dm365_isif.c2
-rw-r--r--drivers/staging/media/davinci_vpfe/dm365_resizer.c6
-rw-r--r--drivers/staging/media/davinci_vpfe/vpfe_video.c2
-rw-r--r--drivers/staging/media/omap4iss/iss_csi2.c2
-rw-r--r--drivers/staging/media/omap4iss/iss_ipipe.c2
-rw-r--r--drivers/staging/media/omap4iss/iss_ipipeif.c2
-rw-r--r--drivers/staging/media/omap4iss/iss_resizer.c2
-rw-r--r--drivers/staging/media/omap4iss/iss_video.c2
-rw-r--r--include/media/media-entity.h2
68 files changed, 102 insertions, 99 deletions
diff --git a/Documentation/media-framework.txt b/Documentation/media-framework.txt
index b424de6c3bb3..7fbfe4bd1f47 100644
--- a/Documentation/media-framework.txt
+++ b/Documentation/media-framework.txt
@@ -101,14 +101,18 @@ include/media/media-entity.h. The structure is usually embedded into a
101higher-level structure, such as a v4l2_subdev or video_device instance, 101higher-level structure, such as a v4l2_subdev or video_device instance,
102although drivers can allocate entities directly. 102although drivers can allocate entities directly.
103 103
104Drivers initialize entities by calling 104Drivers initialize entity pads by calling
105 105
106 media_entity_init(struct media_entity *entity, u16 num_pads, 106 media_entity_pads_init(struct media_entity *entity, u16 num_pads,
107 struct media_pad *pads); 107 struct media_pad *pads);
108 108
109The media_entity name, type, flags, revision and group_id fields can be 109If no pads are needed, drivers could directly fill entity->num_pads
110initialized before or after calling media_entity_init. Entities embedded in 110with 0 and entity->pads with NULL or to call the above function that
111higher-level standard structures can have some of those fields set by the 111will do the same.
112
113The media_entity name, type, flags, revision and group_id fields should be
114initialized before calling media_device_register_entity(). Entities embedded
115in higher-level standard structures can have some of those fields set by the
112higher-level framework. 116higher-level framework.
113 117
114As the number of pads is known in advance, the pads array is not allocated 118As the number of pads is known in advance, the pads array is not allocated
@@ -116,10 +120,10 @@ dynamically but is managed by the entity driver. Most drivers will embed the
116pads array in a driver-specific structure, avoiding dynamic allocation. 120pads array in a driver-specific structure, avoiding dynamic allocation.
117 121
118Drivers must set the direction of every pad in the pads array before calling 122Drivers must set the direction of every pad in the pads array before calling
119media_entity_init. The function will initialize the other pads fields. 123media_entity_pads_init. The function will initialize the other pads fields.
120 124
121Unlike the number of pads, the total number of links isn't always known in 125Unlike the number of pads, the total number of links isn't always known in
122advance by the entity driver. As an initial estimate, media_entity_init 126advance by the entity driver. As an initial estimate, media_entity_pads_init
123pre-allocates a number of links equal to the number of pads. The links array 127pre-allocates a number of links equal to the number of pads. The links array
124will be reallocated if it grows beyond the initial estimate. 128will be reallocated if it grows beyond the initial estimate.
125 129
diff --git a/Documentation/video4linux/v4l2-framework.txt b/Documentation/video4linux/v4l2-framework.txt
index 2e0fc28fa12f..fa41608ab2b4 100644
--- a/Documentation/video4linux/v4l2-framework.txt
+++ b/Documentation/video4linux/v4l2-framework.txt
@@ -295,12 +295,12 @@ module owner. This is done for you if you use the i2c helper functions.
295 295
296If integration with the media framework is needed, you must initialize the 296If integration with the media framework is needed, you must initialize the
297media_entity struct embedded in the v4l2_subdev struct (entity field) by 297media_entity struct embedded in the v4l2_subdev struct (entity field) by
298calling media_entity_init(): 298calling media_entity_pads_init(), if the entity has pads:
299 299
300 struct media_pad *pads = &my_sd->pads; 300 struct media_pad *pads = &my_sd->pads;
301 int err; 301 int err;
302 302
303 err = media_entity_init(&sd->entity, npads, pads); 303 err = media_entity_pads_init(&sd->entity, npads, pads);
304 304
305The pads array must have been previously initialized. There is no need to 305The pads array must have been previously initialized. There is no need to
306manually set the struct media_entity function and name fields, but the 306manually set the struct media_entity function and name fields, but the
@@ -695,12 +695,12 @@ difference is that the inode argument is omitted since it is never used.
695 695
696If integration with the media framework is needed, you must initialize the 696If integration with the media framework is needed, you must initialize the
697media_entity struct embedded in the video_device struct (entity field) by 697media_entity struct embedded in the video_device struct (entity field) by
698calling media_entity_init(): 698calling media_entity_pads_init():
699 699
700 struct media_pad *pad = &my_vdev->pad; 700 struct media_pad *pad = &my_vdev->pad;
701 int err; 701 int err;
702 702
703 err = media_entity_init(&vdev->entity, 1, pad); 703 err = media_entity_pads_init(&vdev->entity, 1, pad);
704 704
705The pads array must have been previously initialized. There is no need to 705The pads array must have been previously initialized. There is no need to
706manually set the struct media_entity type and name fields. 706manually set the struct media_entity type and name fields.
diff --git a/Documentation/zh_CN/video4linux/v4l2-framework.txt b/Documentation/zh_CN/video4linux/v4l2-framework.txt
index ff815cb92031..698660b7f21f 100644
--- a/Documentation/zh_CN/video4linux/v4l2-framework.txt
+++ b/Documentation/zh_CN/video4linux/v4l2-framework.txt
@@ -289,13 +289,13 @@ struct v4l2_subdev_ops {
289然后,你必须用一个唯一的名字初始化 subdev->name,并初始化模块的 289然后,你必须用一个唯一的名字初始化 subdev->name,并初始化模块的
290owner 域。若使用 i2c 辅助函数,这些都会帮你处理好。 290owner 域。若使用 i2c 辅助函数,这些都会帮你处理好。
291 291
292若需同媒体框架整合,你必须调用 media_entity_init() 初始化 v4l2_subdev 292若需同媒体框架整合,你必须调用 media_entity_pads_init() 初始化 v4l2_subdev
293结构体中的 media_entity 结构体(entity 域): 293结构体中的 media_entity 结构体(entity 域):
294 294
295 struct media_pad *pads = &my_sd->pads; 295 struct media_pad *pads = &my_sd->pads;
296 int err; 296 int err;
297 297
298 err = media_entity_init(&sd->entity, npads, pads); 298 err = media_entity_pads_init(&sd->entity, npads, pads);
299 299
300pads 数组必须预先初始化。无须手动设置 media_entity 的 type 和 300pads 数组必须预先初始化。无须手动设置 media_entity 的 type 和
301name 域,但如有必要,revision 域必须初始化。 301name 域,但如有必要,revision 域必须初始化。
@@ -596,13 +596,13 @@ void v4l2_disable_ioctl(struct video_device *vdev, unsigned int cmd);
596v4l2_file_operations 结构体是 file_operations 的一个子集。其主要 596v4l2_file_operations 结构体是 file_operations 的一个子集。其主要
597区别在于:因 inode 参数从未被使用,它将被忽略。 597区别在于:因 inode 参数从未被使用,它将被忽略。
598 598
599如果需要与媒体框架整合,你必须通过调用 media_entity_init() 初始化 599如果需要与媒体框架整合,你必须通过调用 media_entity_pads_init() 初始化
600嵌入在 video_device 结构体中的 media_entity(entity 域)结构体: 600嵌入在 video_device 结构体中的 media_entity(entity 域)结构体:
601 601
602 struct media_pad *pad = &my_vdev->pad; 602 struct media_pad *pad = &my_vdev->pad;
603 int err; 603 int err;
604 604
605 err = media_entity_init(&vdev->entity, 1, pad); 605 err = media_entity_pads_init(&vdev->entity, 1, pad);
606 606
607pads 数组必须预先初始化。没有必要手动设置 media_entity 的 type 和 607pads 数组必须预先初始化。没有必要手动设置 media_entity 的 type 和
608name 域。 608name 域。
diff --git a/drivers/media/dvb-core/dvbdev.c b/drivers/media/dvb-core/dvbdev.c
index 1d4e35693d09..b56e00817d3f 100644
--- a/drivers/media/dvb-core/dvbdev.c
+++ b/drivers/media/dvb-core/dvbdev.c
@@ -245,7 +245,7 @@ static int dvb_create_tsout_entity(struct dvb_device *dvbdev,
245 entity->function = MEDIA_ENT_F_IO_DTV; 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_pads_init(entity, 1, pads);
249 if (ret < 0) 249 if (ret < 0)
250 return ret; 250 return ret;
251 251
@@ -340,7 +340,7 @@ static int dvb_create_media_entity(struct dvb_device *dvbdev,
340 } 340 }
341 341
342 if (npads) { 342 if (npads) {
343 ret = media_entity_init(dvbdev->entity, npads, dvbdev->pads); 343 ret = media_entity_pads_init(dvbdev->entity, npads, dvbdev->pads);
344 if (ret) 344 if (ret)
345 return ret; 345 return ret;
346 } 346 }
diff --git a/drivers/media/dvb-frontends/au8522_decoder.c b/drivers/media/dvb-frontends/au8522_decoder.c
index 464a2beca30d..73612c5353d1 100644
--- a/drivers/media/dvb-frontends/au8522_decoder.c
+++ b/drivers/media/dvb-frontends/au8522_decoder.c
@@ -768,7 +768,7 @@ static int au8522_probe(struct i2c_client *client,
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_F_ATV_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_pads_init(&sd->entity, ARRAY_SIZE(state->pads),
772 state->pads); 772 state->pads);
773 if (ret < 0) { 773 if (ret < 0) {
774 v4l_info(client, "failed to initialize media entity!\n"); 774 v4l_info(client, "failed to initialize media entity!\n");
diff --git a/drivers/media/i2c/ad9389b.c b/drivers/media/i2c/ad9389b.c
index a02dc4925707..788967dadd29 100644
--- a/drivers/media/i2c/ad9389b.c
+++ b/drivers/media/i2c/ad9389b.c
@@ -1158,7 +1158,7 @@ static int ad9389b_probe(struct i2c_client *client, const struct i2c_device_id *
1158 state->rgb_quantization_range_ctrl->is_private = true; 1158 state->rgb_quantization_range_ctrl->is_private = true;
1159 1159
1160 state->pad.flags = MEDIA_PAD_FL_SINK; 1160 state->pad.flags = MEDIA_PAD_FL_SINK;
1161 err = media_entity_init(&sd->entity, 1, &state->pad); 1161 err = media_entity_pads_init(&sd->entity, 1, &state->pad);
1162 if (err) 1162 if (err)
1163 goto err_hdl; 1163 goto err_hdl;
1164 1164
diff --git a/drivers/media/i2c/adp1653.c b/drivers/media/i2c/adp1653.c
index 7150f35d5935..7e9cbf757e95 100644
--- a/drivers/media/i2c/adp1653.c
+++ b/drivers/media/i2c/adp1653.c
@@ -512,7 +512,7 @@ static int adp1653_probe(struct i2c_client *client,
512 if (ret) 512 if (ret)
513 goto free_and_quit; 513 goto free_and_quit;
514 514
515 ret = media_entity_init(&flash->subdev.entity, 0, NULL); 515 ret = media_entity_pads_init(&flash->subdev.entity, 0, NULL);
516 if (ret < 0) 516 if (ret < 0)
517 goto free_and_quit; 517 goto free_and_quit;
518 518
diff --git a/drivers/media/i2c/adv7180.c b/drivers/media/i2c/adv7180.c
index 2ebe9efdfc1b..ff57c1dcb8af 100644
--- a/drivers/media/i2c/adv7180.c
+++ b/drivers/media/i2c/adv7180.c
@@ -1214,7 +1214,7 @@ static int adv7180_probe(struct i2c_client *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_F_ATV_DECODER; 1216 sd->entity.flags |= MEDIA_ENT_F_ATV_DECODER;
1217 ret = media_entity_init(&sd->entity, 1, &state->pad); 1217 ret = media_entity_pads_init(&sd->entity, 1, &state->pad);
1218 if (ret) 1218 if (ret)
1219 goto err_free_ctrl; 1219 goto err_free_ctrl;
1220 1220
diff --git a/drivers/media/i2c/adv7511.c b/drivers/media/i2c/adv7511.c
index cbcf81b1d29e..471fd23b5c5c 100644
--- a/drivers/media/i2c/adv7511.c
+++ b/drivers/media/i2c/adv7511.c
@@ -1482,7 +1482,7 @@ static int adv7511_probe(struct i2c_client *client, const struct i2c_device_id *
1482 state->rgb_quantization_range_ctrl->is_private = true; 1482 state->rgb_quantization_range_ctrl->is_private = true;
1483 1483
1484 state->pad.flags = MEDIA_PAD_FL_SINK; 1484 state->pad.flags = MEDIA_PAD_FL_SINK;
1485 err = media_entity_init(&sd->entity, 1, &state->pad); 1485 err = media_entity_pads_init(&sd->entity, 1, &state->pad);
1486 if (err) 1486 if (err)
1487 goto err_hdl; 1487 goto err_hdl;
1488 1488
diff --git a/drivers/media/i2c/adv7604.c b/drivers/media/i2c/adv7604.c
index c2df7e8053f3..f8dd7505b529 100644
--- a/drivers/media/i2c/adv7604.c
+++ b/drivers/media/i2c/adv7604.c
@@ -3208,7 +3208,7 @@ static int adv76xx_probe(struct i2c_client *client,
3208 state->pads[i].flags = MEDIA_PAD_FL_SINK; 3208 state->pads[i].flags = MEDIA_PAD_FL_SINK;
3209 state->pads[state->source_pad].flags = MEDIA_PAD_FL_SOURCE; 3209 state->pads[state->source_pad].flags = MEDIA_PAD_FL_SOURCE;
3210 3210
3211 err = media_entity_init(&sd->entity, state->source_pad + 1, 3211 err = media_entity_pads_init(&sd->entity, state->source_pad + 1,
3212 state->pads); 3212 state->pads);
3213 if (err) 3213 if (err)
3214 goto err_work_queues; 3214 goto err_work_queues;
diff --git a/drivers/media/i2c/adv7842.c b/drivers/media/i2c/adv7842.c
index b5013a937254..5fbb788e7b59 100644
--- a/drivers/media/i2c/adv7842.c
+++ b/drivers/media/i2c/adv7842.c
@@ -3309,7 +3309,7 @@ static int adv7842_probe(struct i2c_client *client,
3309 adv7842_delayed_work_enable_hotplug); 3309 adv7842_delayed_work_enable_hotplug);
3310 3310
3311 state->pad.flags = MEDIA_PAD_FL_SOURCE; 3311 state->pad.flags = MEDIA_PAD_FL_SOURCE;
3312 err = media_entity_init(&sd->entity, 1, &state->pad); 3312 err = media_entity_pads_init(&sd->entity, 1, &state->pad);
3313 if (err) 3313 if (err)
3314 goto err_work_queues; 3314 goto err_work_queues;
3315 3315
diff --git a/drivers/media/i2c/as3645a.c b/drivers/media/i2c/as3645a.c
index b1bc4d0f76f2..2e90e4094b79 100644
--- a/drivers/media/i2c/as3645a.c
+++ b/drivers/media/i2c/as3645a.c
@@ -827,7 +827,7 @@ static int as3645a_probe(struct i2c_client *client,
827 if (ret < 0) 827 if (ret < 0)
828 goto done; 828 goto done;
829 829
830 ret = media_entity_init(&flash->subdev.entity, 0, NULL); 830 ret = media_entity_pads_init(&flash->subdev.entity, 0, NULL);
831 if (ret < 0) 831 if (ret < 0)
832 goto done; 832 goto done;
833 833
diff --git a/drivers/media/i2c/cx25840/cx25840-core.c b/drivers/media/i2c/cx25840/cx25840-core.c
index 4d975aa5be36..07a3e7173144 100644
--- a/drivers/media/i2c/cx25840/cx25840-core.c
+++ b/drivers/media/i2c/cx25840/cx25840-core.c
@@ -5213,7 +5213,7 @@ static int cx25840_probe(struct i2c_client *client,
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_F_ATV_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_pads_init(&sd->entity, ARRAY_SIZE(state->pads),
5217 state->pads); 5217 state->pads);
5218 if (ret < 0) { 5218 if (ret < 0) {
5219 v4l_info(client, "failed to initialize media entity!\n"); 5219 v4l_info(client, "failed to initialize media entity!\n");
diff --git a/drivers/media/i2c/lm3560.c b/drivers/media/i2c/lm3560.c
index 98266f707ea0..251a2aaf98c3 100644
--- a/drivers/media/i2c/lm3560.c
+++ b/drivers/media/i2c/lm3560.c
@@ -365,7 +365,7 @@ static int lm3560_subdev_init(struct lm3560_flash *flash,
365 rval = lm3560_init_controls(flash, led_no); 365 rval = lm3560_init_controls(flash, led_no);
366 if (rval) 366 if (rval)
367 goto err_out; 367 goto err_out;
368 rval = media_entity_init(&flash->subdev_led[led_no].entity, 0, NULL); 368 rval = media_entity_pads_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_F_FLASH; 371 flash->subdev_led[led_no].entity.function = MEDIA_ENT_F_FLASH;
diff --git a/drivers/media/i2c/lm3646.c b/drivers/media/i2c/lm3646.c
index ba5ee0d7a78e..7e9967af36ec 100644
--- a/drivers/media/i2c/lm3646.c
+++ b/drivers/media/i2c/lm3646.c
@@ -282,7 +282,7 @@ static int lm3646_subdev_init(struct lm3646_flash *flash)
282 rval = lm3646_init_controls(flash); 282 rval = lm3646_init_controls(flash);
283 if (rval) 283 if (rval)
284 goto err_out; 284 goto err_out;
285 rval = media_entity_init(&flash->subdev_led.entity, 0, NULL); 285 rval = media_entity_pads_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_F_FLASH; 288 flash->subdev_led.entity.function = MEDIA_ENT_F_FLASH;
diff --git a/drivers/media/i2c/m5mols/m5mols_core.c b/drivers/media/i2c/m5mols/m5mols_core.c
index bec5cea23b65..acb804bceccb 100644
--- a/drivers/media/i2c/m5mols/m5mols_core.c
+++ b/drivers/media/i2c/m5mols/m5mols_core.c
@@ -975,7 +975,7 @@ static int m5mols_probe(struct i2c_client *client,
975 975
976 sd->internal_ops = &m5mols_subdev_internal_ops; 976 sd->internal_ops = &m5mols_subdev_internal_ops;
977 info->pad.flags = MEDIA_PAD_FL_SOURCE; 977 info->pad.flags = MEDIA_PAD_FL_SOURCE;
978 ret = media_entity_init(&sd->entity, 1, &info->pad); 978 ret = media_entity_pads_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_F_CAM_SENSOR; 981 sd->entity.function = MEDIA_ENT_F_CAM_SENSOR;
diff --git a/drivers/media/i2c/mt9m032.c b/drivers/media/i2c/mt9m032.c
index a2a450839ca1..da076796999e 100644
--- a/drivers/media/i2c/mt9m032.c
+++ b/drivers/media/i2c/mt9m032.c
@@ -799,7 +799,7 @@ static int mt9m032_probe(struct i2c_client *client,
799 799
800 sensor->subdev.ctrl_handler = &sensor->ctrls; 800 sensor->subdev.ctrl_handler = &sensor->ctrls;
801 sensor->pad.flags = MEDIA_PAD_FL_SOURCE; 801 sensor->pad.flags = MEDIA_PAD_FL_SOURCE;
802 ret = media_entity_init(&sensor->subdev.entity, 1, &sensor->pad); 802 ret = media_entity_pads_init(&sensor->subdev.entity, 1, &sensor->pad);
803 if (ret < 0) 803 if (ret < 0)
804 goto error_ctrl; 804 goto error_ctrl;
805 805
diff --git a/drivers/media/i2c/mt9p031.c b/drivers/media/i2c/mt9p031.c
index 165f29cddca6..237737fec09c 100644
--- a/drivers/media/i2c/mt9p031.c
+++ b/drivers/media/i2c/mt9p031.c
@@ -1112,7 +1112,7 @@ static int mt9p031_probe(struct i2c_client *client,
1112 mt9p031->subdev.internal_ops = &mt9p031_subdev_internal_ops; 1112 mt9p031->subdev.internal_ops = &mt9p031_subdev_internal_ops;
1113 1113
1114 mt9p031->pad.flags = MEDIA_PAD_FL_SOURCE; 1114 mt9p031->pad.flags = MEDIA_PAD_FL_SOURCE;
1115 ret = media_entity_init(&mt9p031->subdev.entity, 1, &mt9p031->pad); 1115 ret = media_entity_pads_init(&mt9p031->subdev.entity, 1, &mt9p031->pad);
1116 if (ret < 0) 1116 if (ret < 0)
1117 goto done; 1117 goto done;
1118 1118
diff --git a/drivers/media/i2c/mt9t001.c b/drivers/media/i2c/mt9t001.c
index 7d3df84651d8..702d562f8e39 100644
--- a/drivers/media/i2c/mt9t001.c
+++ b/drivers/media/i2c/mt9t001.c
@@ -933,7 +933,7 @@ static int mt9t001_probe(struct i2c_client *client,
933 mt9t001->subdev.flags |= V4L2_SUBDEV_FL_HAS_DEVNODE; 933 mt9t001->subdev.flags |= V4L2_SUBDEV_FL_HAS_DEVNODE;
934 934
935 mt9t001->pad.flags = MEDIA_PAD_FL_SOURCE; 935 mt9t001->pad.flags = MEDIA_PAD_FL_SOURCE;
936 ret = media_entity_init(&mt9t001->subdev.entity, 1, &mt9t001->pad); 936 ret = media_entity_pads_init(&mt9t001->subdev.entity, 1, &mt9t001->pad);
937 937
938done: 938done:
939 if (ret < 0) { 939 if (ret < 0) {
diff --git a/drivers/media/i2c/mt9v032.c b/drivers/media/i2c/mt9v032.c
index b4f0f042c6c3..2e1d116a64e7 100644
--- a/drivers/media/i2c/mt9v032.c
+++ b/drivers/media/i2c/mt9v032.c
@@ -1046,7 +1046,7 @@ static int mt9v032_probe(struct i2c_client *client,
1046 mt9v032->subdev.flags |= V4L2_SUBDEV_FL_HAS_DEVNODE; 1046 mt9v032->subdev.flags |= V4L2_SUBDEV_FL_HAS_DEVNODE;
1047 1047
1048 mt9v032->pad.flags = MEDIA_PAD_FL_SOURCE; 1048 mt9v032->pad.flags = MEDIA_PAD_FL_SOURCE;
1049 ret = media_entity_init(&mt9v032->subdev.entity, 1, &mt9v032->pad); 1049 ret = media_entity_pads_init(&mt9v032->subdev.entity, 1, &mt9v032->pad);
1050 if (ret < 0) 1050 if (ret < 0)
1051 goto err; 1051 goto err;
1052 1052
diff --git a/drivers/media/i2c/noon010pc30.c b/drivers/media/i2c/noon010pc30.c
index 47ea3f79eacc..30cb90b88d75 100644
--- a/drivers/media/i2c/noon010pc30.c
+++ b/drivers/media/i2c/noon010pc30.c
@@ -780,7 +780,7 @@ static int noon010_probe(struct i2c_client *client,
780 780
781 info->pad.flags = MEDIA_PAD_FL_SOURCE; 781 info->pad.flags = MEDIA_PAD_FL_SOURCE;
782 sd->entity.function = MEDIA_ENT_F_CAM_SENSOR; 782 sd->entity.function = MEDIA_ENT_F_CAM_SENSOR;
783 ret = media_entity_init(&sd->entity, 1, &info->pad); 783 ret = media_entity_pads_init(&sd->entity, 1, &info->pad);
784 if (ret < 0) 784 if (ret < 0)
785 goto np_err; 785 goto np_err;
786 786
diff --git a/drivers/media/i2c/ov2659.c b/drivers/media/i2c/ov2659.c
index cf8e71610248..02b9a3440557 100644
--- a/drivers/media/i2c/ov2659.c
+++ b/drivers/media/i2c/ov2659.c
@@ -1446,7 +1446,7 @@ static int ov2659_probe(struct i2c_client *client,
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_F_CAM_SENSOR; 1448 sd->entity.function = MEDIA_ENT_F_CAM_SENSOR;
1449 ret = media_entity_init(&sd->entity, 1, &ov2659->pad); 1449 ret = media_entity_pads_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);
1452 return ret; 1452 return ret;
diff --git a/drivers/media/i2c/ov9650.c b/drivers/media/i2c/ov9650.c
index adb4aab45c10..a0b3c9bde53d 100644
--- a/drivers/media/i2c/ov9650.c
+++ b/drivers/media/i2c/ov9650.c
@@ -1501,7 +1501,7 @@ static int ov965x_probe(struct i2c_client *client,
1501 1501
1502 ov965x->pad.flags = MEDIA_PAD_FL_SOURCE; 1502 ov965x->pad.flags = MEDIA_PAD_FL_SOURCE;
1503 sd->entity.function = MEDIA_ENT_F_CAM_SENSOR; 1503 sd->entity.function = MEDIA_ENT_F_CAM_SENSOR;
1504 ret = media_entity_init(&sd->entity, 1, &ov965x->pad); 1504 ret = media_entity_pads_init(&sd->entity, 1, &ov965x->pad);
1505 if (ret < 0) 1505 if (ret < 0)
1506 return ret; 1506 return ret;
1507 1507
diff --git a/drivers/media/i2c/s5c73m3/s5c73m3-core.c b/drivers/media/i2c/s5c73m3/s5c73m3-core.c
index 3d578f2ce7b2..57b3d27993a4 100644
--- a/drivers/media/i2c/s5c73m3/s5c73m3-core.c
+++ b/drivers/media/i2c/s5c73m3/s5c73m3-core.c
@@ -1690,7 +1690,7 @@ static int s5c73m3_probe(struct i2c_client *client,
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_F_CAM_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_pads_init(&sd->entity, S5C73M3_NUM_PADS,
1694 state->sensor_pads); 1694 state->sensor_pads);
1695 if (ret < 0) 1695 if (ret < 0)
1696 return ret; 1696 return ret;
@@ -1706,7 +1706,7 @@ static int s5c73m3_probe(struct i2c_client *client,
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_F_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_pads_init(&oif_sd->entity, OIF_NUM_PADS,
1710 state->oif_pads); 1710 state->oif_pads);
1711 if (ret < 0) 1711 if (ret < 0)
1712 return ret; 1712 return ret;
diff --git a/drivers/media/i2c/s5k4ecgx.c b/drivers/media/i2c/s5k4ecgx.c
index bacec84e773f..8a0f22da590f 100644
--- a/drivers/media/i2c/s5k4ecgx.c
+++ b/drivers/media/i2c/s5k4ecgx.c
@@ -962,7 +962,7 @@ static int s5k4ecgx_probe(struct i2c_client *client,
962 962
963 priv->pad.flags = MEDIA_PAD_FL_SOURCE; 963 priv->pad.flags = MEDIA_PAD_FL_SOURCE;
964 sd->entity.function = MEDIA_ENT_F_CAM_SENSOR; 964 sd->entity.function = MEDIA_ENT_F_CAM_SENSOR;
965 ret = media_entity_init(&sd->entity, 1, &priv->pad); 965 ret = media_entity_pads_init(&sd->entity, 1, &priv->pad);
966 if (ret) 966 if (ret)
967 return ret; 967 return ret;
968 968
diff --git a/drivers/media/i2c/s5k5baf.c b/drivers/media/i2c/s5k5baf.c
index 564938ab2abd..fc3a5a8e6c9c 100644
--- a/drivers/media/i2c/s5k5baf.c
+++ b/drivers/media/i2c/s5k5baf.c
@@ -1905,7 +1905,7 @@ static int s5k5baf_configure_subdevs(struct s5k5baf *state,
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_F_CAM_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_pads_init(&sd->entity, NUM_CIS_PADS, &state->cis_pad);
1909 if (ret < 0) 1909 if (ret < 0)
1910 goto err; 1910 goto err;
1911 1911
@@ -1920,7 +1920,7 @@ static int s5k5baf_configure_subdevs(struct s5k5baf *state,
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_F_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_pads_init(&sd->entity, NUM_ISP_PADS, state->pads);
1924 1924
1925 if (!ret) 1925 if (!ret)
1926 return 0; 1926 return 0;
diff --git a/drivers/media/i2c/s5k6a3.c b/drivers/media/i2c/s5k6a3.c
index 2434a7944781..b9e43ffa5085 100644
--- a/drivers/media/i2c/s5k6a3.c
+++ b/drivers/media/i2c/s5k6a3.c
@@ -333,7 +333,7 @@ static int s5k6a3_probe(struct i2c_client *client,
333 sensor->format.height = S5K6A3_DEFAULT_HEIGHT; 333 sensor->format.height = S5K6A3_DEFAULT_HEIGHT;
334 334
335 sensor->pad.flags = MEDIA_PAD_FL_SOURCE; 335 sensor->pad.flags = MEDIA_PAD_FL_SOURCE;
336 ret = media_entity_init(&sd->entity, 1, &sensor->pad); 336 ret = media_entity_pads_init(&sd->entity, 1, &sensor->pad);
337 if (ret < 0) 337 if (ret < 0)
338 return ret; 338 return ret;
339 339
diff --git a/drivers/media/i2c/s5k6aa.c b/drivers/media/i2c/s5k6aa.c
index d71d104441bd..faee11383cb7 100644
--- a/drivers/media/i2c/s5k6aa.c
+++ b/drivers/media/i2c/s5k6aa.c
@@ -1578,7 +1578,7 @@ static int s5k6aa_probe(struct i2c_client *client,
1578 1578
1579 s5k6aa->pad.flags = MEDIA_PAD_FL_SOURCE; 1579 s5k6aa->pad.flags = MEDIA_PAD_FL_SOURCE;
1580 sd->entity.function = MEDIA_ENT_F_CAM_SENSOR; 1580 sd->entity.function = MEDIA_ENT_F_CAM_SENSOR;
1581 ret = media_entity_init(&sd->entity, 1, &s5k6aa->pad); 1581 ret = media_entity_pads_init(&sd->entity, 1, &s5k6aa->pad);
1582 if (ret) 1582 if (ret)
1583 return ret; 1583 return ret;
1584 1584
diff --git a/drivers/media/i2c/smiapp/smiapp-core.c b/drivers/media/i2c/smiapp/smiapp-core.c
index 3eaa69ee341b..a215efe7a8ba 100644
--- a/drivers/media/i2c/smiapp/smiapp-core.c
+++ b/drivers/media/i2c/smiapp/smiapp-core.c
@@ -2487,11 +2487,11 @@ static int smiapp_register_subdevs(struct smiapp_sensor *sensor)
2487 if (!last) 2487 if (!last)
2488 continue; 2488 continue;
2489 2489
2490 rval = media_entity_init(&this->sd.entity, 2490 rval = media_entity_pads_init(&this->sd.entity,
2491 this->npads, this->pads); 2491 this->npads, this->pads);
2492 if (rval) { 2492 if (rval) {
2493 dev_err(&client->dev, 2493 dev_err(&client->dev,
2494 "media_entity_init failed\n"); 2494 "media_entity_pads_init failed\n");
2495 return rval; 2495 return rval;
2496 } 2496 }
2497 2497
@@ -3077,7 +3077,7 @@ static int smiapp_probe(struct i2c_client *client,
3077 sensor->src->sensor = sensor; 3077 sensor->src->sensor = sensor;
3078 3078
3079 sensor->src->pads[0].flags = MEDIA_PAD_FL_SOURCE; 3079 sensor->src->pads[0].flags = MEDIA_PAD_FL_SOURCE;
3080 rval = media_entity_init(&sensor->src->sd.entity, 2, 3080 rval = media_entity_pads_init(&sensor->src->sd.entity, 2,
3081 sensor->src->pads); 3081 sensor->src->pads);
3082 if (rval < 0) 3082 if (rval < 0)
3083 return rval; 3083 return rval;
diff --git a/drivers/media/i2c/tc358743.c b/drivers/media/i2c/tc358743.c
index 78e5b644d400..3397eb99c67b 100644
--- a/drivers/media/i2c/tc358743.c
+++ b/drivers/media/i2c/tc358743.c
@@ -1889,7 +1889,7 @@ static int tc358743_probe(struct i2c_client *client,
1889 } 1889 }
1890 1890
1891 state->pad.flags = MEDIA_PAD_FL_SOURCE; 1891 state->pad.flags = MEDIA_PAD_FL_SOURCE;
1892 err = media_entity_init(&sd->entity, 1, &state->pad); 1892 err = media_entity_pads_init(&sd->entity, 1, &state->pad);
1893 if (err < 0) 1893 if (err < 0)
1894 goto err_hdl; 1894 goto err_hdl;
1895 1895
diff --git a/drivers/media/i2c/tvp514x.c b/drivers/media/i2c/tvp514x.c
index 455dd4e6a1da..7fa5f1e4fe37 100644
--- a/drivers/media/i2c/tvp514x.c
+++ b/drivers/media/i2c/tvp514x.c
@@ -1097,7 +1097,7 @@ tvp514x_probe(struct i2c_client *client, const struct i2c_device_id *id)
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_F_ATV_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_pads_init(&decoder->sd.entity, 1, &decoder->pad);
1101 if (ret < 0) { 1101 if (ret < 0) {
1102 v4l2_err(sd, "%s decoder driver failed to register !!\n", 1102 v4l2_err(sd, "%s decoder driver failed to register !!\n",
1103 sd->name); 1103 sd->name);
diff --git a/drivers/media/i2c/tvp7002.c b/drivers/media/i2c/tvp7002.c
index 216a07956fe9..83c79fa5f61d 100644
--- a/drivers/media/i2c/tvp7002.c
+++ b/drivers/media/i2c/tvp7002.c
@@ -1014,7 +1014,7 @@ static int tvp7002_probe(struct i2c_client *c, const struct i2c_device_id *id)
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_F_ATV_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_pads_init(&device->sd.entity, 1, &device->pad);
1018 if (error < 0) 1018 if (error < 0)
1019 return error; 1019 return error;
1020#endif 1020#endif
diff --git a/drivers/media/media-device.c b/drivers/media/media-device.c
index 14bd568e2f41..b8cd7733a31c 100644
--- a/drivers/media/media-device.c
+++ b/drivers/media/media-device.c
@@ -623,6 +623,8 @@ int __must_check media_device_register_entity(struct media_device *mdev,
623 WARN_ON(entity->graph_obj.mdev != NULL); 623 WARN_ON(entity->graph_obj.mdev != NULL);
624 entity->graph_obj.mdev = mdev; 624 entity->graph_obj.mdev = mdev;
625 INIT_LIST_HEAD(&entity->links); 625 INIT_LIST_HEAD(&entity->links);
626 entity->num_links = 0;
627 entity->num_backlinks = 0;
626 628
627 spin_lock(&mdev->lock); 629 spin_lock(&mdev->lock);
628 /* Initialize media_gobj embedded at the entity */ 630 /* Initialize media_gobj embedded at the entity */
diff --git a/drivers/media/media-entity.c b/drivers/media/media-entity.c
index 07f2dc6c2df6..ef2102ac0c66 100644
--- a/drivers/media/media-entity.c
+++ b/drivers/media/media-entity.c
@@ -197,7 +197,7 @@ void media_gobj_remove(struct media_gobj *gobj)
197} 197}
198 198
199/** 199/**
200 * media_entity_init - Initialize a media entity 200 * media_entity_pads_init - Initialize a media entity
201 * 201 *
202 * @num_pads: Total number of sink and source pads. 202 * @num_pads: Total number of sink and source pads.
203 * @pads: Array of 'num_pads' pads. 203 * @pads: Array of 'num_pads' pads.
@@ -216,18 +216,15 @@ void media_gobj_remove(struct media_gobj *gobj)
216 * number of allocated elements. 216 * number of allocated elements.
217 * 217 *
218 * The pads array is managed by the entity driver and passed to 218 * The pads array is managed by the entity driver and passed to
219 * media_entity_init() where its pointer will be stored in the entity structure. 219 * media_entity_pads_init() where its pointer will be stored in the entity structure.
220 */ 220 */
221int 221int
222media_entity_init(struct media_entity *entity, u16 num_pads, 222media_entity_pads_init(struct media_entity *entity, u16 num_pads,
223 struct media_pad *pads) 223 struct media_pad *pads)
224{ 224{
225 struct media_device *mdev = entity->graph_obj.mdev; 225 struct media_device *mdev = entity->graph_obj.mdev;
226 unsigned int i; 226 unsigned int i;
227 227
228 entity->group_id = 0;
229 entity->num_links = 0;
230 entity->num_backlinks = 0;
231 entity->num_pads = num_pads; 228 entity->num_pads = num_pads;
232 entity->pads = pads; 229 entity->pads = pads;
233 230
@@ -247,7 +244,7 @@ media_entity_init(struct media_entity *entity, u16 num_pads,
247 244
248 return 0; 245 return 0;
249} 246}
250EXPORT_SYMBOL_GPL(media_entity_init); 247EXPORT_SYMBOL_GPL(media_entity_pads_init);
251 248
252void 249void
253media_entity_cleanup(struct media_entity *entity) 250media_entity_cleanup(struct media_entity *entity)
diff --git a/drivers/media/platform/exynos4-is/fimc-capture.c b/drivers/media/platform/exynos4-is/fimc-capture.c
index 48a826372d3d..bf47d3b9cbe7 100644
--- a/drivers/media/platform/exynos4-is/fimc-capture.c
+++ b/drivers/media/platform/exynos4-is/fimc-capture.c
@@ -1799,7 +1799,7 @@ static int fimc_register_capture_device(struct fimc_dev *fimc,
1799 vid_cap->wb_fmt.code = fmt->mbus_code; 1799 vid_cap->wb_fmt.code = fmt->mbus_code;
1800 1800
1801 vid_cap->vd_pad.flags = MEDIA_PAD_FL_SINK; 1801 vid_cap->vd_pad.flags = MEDIA_PAD_FL_SINK;
1802 ret = media_entity_init(&vfd->entity, 1, &vid_cap->vd_pad); 1802 ret = media_entity_pads_init(&vfd->entity, 1, &vid_cap->vd_pad);
1803 if (ret) 1803 if (ret)
1804 goto err_free_ctx; 1804 goto err_free_ctx;
1805 1805
@@ -1891,7 +1891,7 @@ int fimc_initialize_capture_subdev(struct fimc_dev *fimc)
1891 fimc->vid_cap.sd_pads[FIMC_SD_PAD_SINK_CAM].flags = MEDIA_PAD_FL_SINK; 1891 fimc->vid_cap.sd_pads[FIMC_SD_PAD_SINK_CAM].flags = MEDIA_PAD_FL_SINK;
1892 fimc->vid_cap.sd_pads[FIMC_SD_PAD_SINK_FIFO].flags = MEDIA_PAD_FL_SINK; 1892 fimc->vid_cap.sd_pads[FIMC_SD_PAD_SINK_FIFO].flags = MEDIA_PAD_FL_SINK;
1893 fimc->vid_cap.sd_pads[FIMC_SD_PAD_SOURCE].flags = MEDIA_PAD_FL_SOURCE; 1893 fimc->vid_cap.sd_pads[FIMC_SD_PAD_SOURCE].flags = MEDIA_PAD_FL_SOURCE;
1894 ret = media_entity_init(&sd->entity, FIMC_SD_PADS_NUM, 1894 ret = media_entity_pads_init(&sd->entity, FIMC_SD_PADS_NUM,
1895 fimc->vid_cap.sd_pads); 1895 fimc->vid_cap.sd_pads);
1896 if (ret) 1896 if (ret)
1897 return ret; 1897 return ret;
diff --git a/drivers/media/platform/exynos4-is/fimc-isp-video.c b/drivers/media/platform/exynos4-is/fimc-isp-video.c
index 9c7794bcf0c3..bf9261eb57a1 100644
--- a/drivers/media/platform/exynos4-is/fimc-isp-video.c
+++ b/drivers/media/platform/exynos4-is/fimc-isp-video.c
@@ -616,7 +616,7 @@ int fimc_isp_video_device_register(struct fimc_isp *isp,
616 vdev->lock = &isp->video_lock; 616 vdev->lock = &isp->video_lock;
617 617
618 iv->pad.flags = MEDIA_PAD_FL_SINK; 618 iv->pad.flags = MEDIA_PAD_FL_SINK;
619 ret = media_entity_init(&vdev->entity, 1, &iv->pad); 619 ret = media_entity_pads_init(&vdev->entity, 1, &iv->pad);
620 if (ret < 0) 620 if (ret < 0)
621 return ret; 621 return ret;
622 622
diff --git a/drivers/media/platform/exynos4-is/fimc-isp.c b/drivers/media/platform/exynos4-is/fimc-isp.c
index f52eebf765c1..293b807020c4 100644
--- a/drivers/media/platform/exynos4-is/fimc-isp.c
+++ b/drivers/media/platform/exynos4-is/fimc-isp.c
@@ -708,7 +708,7 @@ int fimc_isp_subdev_create(struct fimc_isp *isp)
708 isp->subdev_pads[FIMC_ISP_SD_PAD_SINK].flags = MEDIA_PAD_FL_SINK; 708 isp->subdev_pads[FIMC_ISP_SD_PAD_SINK].flags = MEDIA_PAD_FL_SINK;
709 isp->subdev_pads[FIMC_ISP_SD_PAD_SRC_FIFO].flags = MEDIA_PAD_FL_SOURCE; 709 isp->subdev_pads[FIMC_ISP_SD_PAD_SRC_FIFO].flags = MEDIA_PAD_FL_SOURCE;
710 isp->subdev_pads[FIMC_ISP_SD_PAD_SRC_DMA].flags = MEDIA_PAD_FL_SOURCE; 710 isp->subdev_pads[FIMC_ISP_SD_PAD_SRC_DMA].flags = MEDIA_PAD_FL_SOURCE;
711 ret = media_entity_init(&sd->entity, FIMC_ISP_SD_PADS_NUM, 711 ret = media_entity_pads_init(&sd->entity, FIMC_ISP_SD_PADS_NUM,
712 isp->subdev_pads); 712 isp->subdev_pads);
713 if (ret) 713 if (ret)
714 return ret; 714 return ret;
diff --git a/drivers/media/platform/exynos4-is/fimc-lite.c b/drivers/media/platform/exynos4-is/fimc-lite.c
index 957cf144a675..e85649147dc8 100644
--- a/drivers/media/platform/exynos4-is/fimc-lite.c
+++ b/drivers/media/platform/exynos4-is/fimc-lite.c
@@ -1314,7 +1314,7 @@ static int fimc_lite_subdev_registered(struct v4l2_subdev *sd)
1314 return ret; 1314 return ret;
1315 1315
1316 fimc->vd_pad.flags = MEDIA_PAD_FL_SINK; 1316 fimc->vd_pad.flags = MEDIA_PAD_FL_SINK;
1317 ret = media_entity_init(&vfd->entity, 1, &fimc->vd_pad); 1317 ret = media_entity_pads_init(&vfd->entity, 1, &fimc->vd_pad);
1318 if (ret < 0) 1318 if (ret < 0)
1319 return ret; 1319 return ret;
1320 1320
@@ -1428,7 +1428,7 @@ static int fimc_lite_create_capture_subdev(struct fimc_lite *fimc)
1428 fimc->subdev_pads[FLITE_SD_PAD_SINK].flags = MEDIA_PAD_FL_SINK; 1428 fimc->subdev_pads[FLITE_SD_PAD_SINK].flags = MEDIA_PAD_FL_SINK;
1429 fimc->subdev_pads[FLITE_SD_PAD_SOURCE_DMA].flags = MEDIA_PAD_FL_SOURCE; 1429 fimc->subdev_pads[FLITE_SD_PAD_SOURCE_DMA].flags = MEDIA_PAD_FL_SOURCE;
1430 fimc->subdev_pads[FLITE_SD_PAD_SOURCE_ISP].flags = MEDIA_PAD_FL_SOURCE; 1430 fimc->subdev_pads[FLITE_SD_PAD_SOURCE_ISP].flags = MEDIA_PAD_FL_SOURCE;
1431 ret = media_entity_init(&sd->entity, FLITE_SD_PADS_NUM, 1431 ret = media_entity_pads_init(&sd->entity, FLITE_SD_PADS_NUM,
1432 fimc->subdev_pads); 1432 fimc->subdev_pads);
1433 if (ret) 1433 if (ret)
1434 return ret; 1434 return ret;
diff --git a/drivers/media/platform/exynos4-is/fimc-m2m.c b/drivers/media/platform/exynos4-is/fimc-m2m.c
index 8ff4e6f76b84..55ec4c99d484 100644
--- a/drivers/media/platform/exynos4-is/fimc-m2m.c
+++ b/drivers/media/platform/exynos4-is/fimc-m2m.c
@@ -739,7 +739,7 @@ int fimc_register_m2m_device(struct fimc_dev *fimc,
739 return PTR_ERR(fimc->m2m.m2m_dev); 739 return PTR_ERR(fimc->m2m.m2m_dev);
740 } 740 }
741 741
742 ret = media_entity_init(&vfd->entity, 0, NULL); 742 ret = media_entity_pads_init(&vfd->entity, 0, NULL);
743 if (ret) 743 if (ret)
744 goto err_me; 744 goto err_me;
745 745
diff --git a/drivers/media/platform/exynos4-is/mipi-csis.c b/drivers/media/platform/exynos4-is/mipi-csis.c
index 8847797b0d0b..ac5e50e595be 100644
--- a/drivers/media/platform/exynos4-is/mipi-csis.c
+++ b/drivers/media/platform/exynos4-is/mipi-csis.c
@@ -866,7 +866,7 @@ static int s5pcsis_probe(struct platform_device *pdev)
866 866
867 state->pads[CSIS_PAD_SINK].flags = MEDIA_PAD_FL_SINK; 867 state->pads[CSIS_PAD_SINK].flags = MEDIA_PAD_FL_SINK;
868 state->pads[CSIS_PAD_SOURCE].flags = MEDIA_PAD_FL_SOURCE; 868 state->pads[CSIS_PAD_SOURCE].flags = MEDIA_PAD_FL_SOURCE;
869 ret = media_entity_init(&state->sd.entity, 869 ret = media_entity_pads_init(&state->sd.entity,
870 CSIS_PADS_NUM, state->pads); 870 CSIS_PADS_NUM, state->pads);
871 if (ret < 0) 871 if (ret < 0)
872 goto e_clkdis; 872 goto e_clkdis;
diff --git a/drivers/media/platform/omap3isp/ispccdc.c b/drivers/media/platform/omap3isp/ispccdc.c
index f0e530c98188..dae674cd3f74 100644
--- a/drivers/media/platform/omap3isp/ispccdc.c
+++ b/drivers/media/platform/omap3isp/ispccdc.c
@@ -2655,7 +2655,7 @@ static int ccdc_init_entities(struct isp_ccdc_device *ccdc)
2655 pads[CCDC_PAD_SOURCE_OF].flags = MEDIA_PAD_FL_SOURCE; 2655 pads[CCDC_PAD_SOURCE_OF].flags = MEDIA_PAD_FL_SOURCE;
2656 2656
2657 me->ops = &ccdc_media_ops; 2657 me->ops = &ccdc_media_ops;
2658 ret = media_entity_init(me, CCDC_PADS_NUM, pads); 2658 ret = media_entity_pads_init(me, CCDC_PADS_NUM, pads);
2659 if (ret < 0) 2659 if (ret < 0)
2660 return ret; 2660 return ret;
2661 2661
diff --git a/drivers/media/platform/omap3isp/ispccp2.c b/drivers/media/platform/omap3isp/ispccp2.c
index ae3038e643cc..0c790b25f6f9 100644
--- a/drivers/media/platform/omap3isp/ispccp2.c
+++ b/drivers/media/platform/omap3isp/ispccp2.c
@@ -1076,7 +1076,7 @@ static int ccp2_init_entities(struct isp_ccp2_device *ccp2)
1076 pads[CCP2_PAD_SOURCE].flags = MEDIA_PAD_FL_SOURCE; 1076 pads[CCP2_PAD_SOURCE].flags = MEDIA_PAD_FL_SOURCE;
1077 1077
1078 me->ops = &ccp2_media_ops; 1078 me->ops = &ccp2_media_ops;
1079 ret = media_entity_init(me, CCP2_PADS_NUM, pads); 1079 ret = media_entity_pads_init(me, CCP2_PADS_NUM, pads);
1080 if (ret < 0) 1080 if (ret < 0)
1081 return ret; 1081 return ret;
1082 1082
diff --git a/drivers/media/platform/omap3isp/ispcsi2.c b/drivers/media/platform/omap3isp/ispcsi2.c
index b1617f7efdee..f50f6b305204 100644
--- a/drivers/media/platform/omap3isp/ispcsi2.c
+++ b/drivers/media/platform/omap3isp/ispcsi2.c
@@ -1250,7 +1250,7 @@ static int csi2_init_entities(struct isp_csi2_device *csi2)
1250 | MEDIA_PAD_FL_MUST_CONNECT; 1250 | MEDIA_PAD_FL_MUST_CONNECT;
1251 1251
1252 me->ops = &csi2_media_ops; 1252 me->ops = &csi2_media_ops;
1253 ret = media_entity_init(me, CSI2_PADS_NUM, pads); 1253 ret = media_entity_pads_init(me, CSI2_PADS_NUM, pads);
1254 if (ret < 0) 1254 if (ret < 0)
1255 return ret; 1255 return ret;
1256 1256
diff --git a/drivers/media/platform/omap3isp/isppreview.c b/drivers/media/platform/omap3isp/isppreview.c
index cfb2debb02bf..c300cb7219e9 100644
--- a/drivers/media/platform/omap3isp/isppreview.c
+++ b/drivers/media/platform/omap3isp/isppreview.c
@@ -2287,7 +2287,7 @@ static int preview_init_entities(struct isp_prev_device *prev)
2287 pads[PREV_PAD_SOURCE].flags = MEDIA_PAD_FL_SOURCE; 2287 pads[PREV_PAD_SOURCE].flags = MEDIA_PAD_FL_SOURCE;
2288 2288
2289 me->ops = &preview_media_ops; 2289 me->ops = &preview_media_ops;
2290 ret = media_entity_init(me, PREV_PADS_NUM, pads); 2290 ret = media_entity_pads_init(me, PREV_PADS_NUM, pads);
2291 if (ret < 0) 2291 if (ret < 0)
2292 return ret; 2292 return ret;
2293 2293
diff --git a/drivers/media/platform/omap3isp/ispresizer.c b/drivers/media/platform/omap3isp/ispresizer.c
index e3ecf1787fc4..cd0a9f6e1fed 100644
--- a/drivers/media/platform/omap3isp/ispresizer.c
+++ b/drivers/media/platform/omap3isp/ispresizer.c
@@ -1733,7 +1733,7 @@ static int resizer_init_entities(struct isp_res_device *res)
1733 pads[RESZ_PAD_SOURCE].flags = MEDIA_PAD_FL_SOURCE; 1733 pads[RESZ_PAD_SOURCE].flags = MEDIA_PAD_FL_SOURCE;
1734 1734
1735 me->ops = &resizer_media_ops; 1735 me->ops = &resizer_media_ops;
1736 ret = media_entity_init(me, RESZ_PADS_NUM, pads); 1736 ret = media_entity_pads_init(me, RESZ_PADS_NUM, pads);
1737 if (ret < 0) 1737 if (ret < 0)
1738 return ret; 1738 return ret;
1739 1739
diff --git a/drivers/media/platform/omap3isp/ispstat.c b/drivers/media/platform/omap3isp/ispstat.c
index f7a5eee9f11d..1b9217d3b1b6 100644
--- a/drivers/media/platform/omap3isp/ispstat.c
+++ b/drivers/media/platform/omap3isp/ispstat.c
@@ -1028,7 +1028,7 @@ static int isp_stat_init_entities(struct ispstat *stat, const char *name,
1028 stat->pad.flags = MEDIA_PAD_FL_SINK | MEDIA_PAD_FL_MUST_CONNECT; 1028 stat->pad.flags = MEDIA_PAD_FL_SINK | MEDIA_PAD_FL_MUST_CONNECT;
1029 me->ops = NULL; 1029 me->ops = NULL;
1030 1030
1031 return media_entity_init(me, 1, &stat->pad); 1031 return media_entity_pads_init(me, 1, &stat->pad);
1032} 1032}
1033 1033
1034int omap3isp_stat_init(struct ispstat *stat, const char *name, 1034int omap3isp_stat_init(struct ispstat *stat, const char *name,
diff --git a/drivers/media/platform/omap3isp/ispvideo.c b/drivers/media/platform/omap3isp/ispvideo.c
index 768efd775abc..1240b06202f0 100644
--- a/drivers/media/platform/omap3isp/ispvideo.c
+++ b/drivers/media/platform/omap3isp/ispvideo.c
@@ -1368,7 +1368,7 @@ int omap3isp_video_init(struct isp_video *video, const char *name)
1368 if (IS_ERR(video->alloc_ctx)) 1368 if (IS_ERR(video->alloc_ctx))
1369 return PTR_ERR(video->alloc_ctx); 1369 return PTR_ERR(video->alloc_ctx);
1370 1370
1371 ret = media_entity_init(&video->video.entity, 1, &video->pad); 1371 ret = media_entity_pads_init(&video->video.entity, 1, &video->pad);
1372 if (ret < 0) { 1372 if (ret < 0) {
1373 vb2_dma_contig_cleanup_ctx(video->alloc_ctx); 1373 vb2_dma_contig_cleanup_ctx(video->alloc_ctx);
1374 return ret; 1374 return ret;
diff --git a/drivers/media/platform/s3c-camif/camif-capture.c b/drivers/media/platform/s3c-camif/camif-capture.c
index 05bfa9d08b19..bd060ef5d1e1 100644
--- a/drivers/media/platform/s3c-camif/camif-capture.c
+++ b/drivers/media/platform/s3c-camif/camif-capture.c
@@ -1144,7 +1144,7 @@ int s3c_camif_register_video_node(struct camif_dev *camif, int idx)
1144 goto err_vd_rel; 1144 goto err_vd_rel;
1145 1145
1146 vp->pad.flags = MEDIA_PAD_FL_SINK; 1146 vp->pad.flags = MEDIA_PAD_FL_SINK;
1147 ret = media_entity_init(&vfd->entity, 1, &vp->pad); 1147 ret = media_entity_pads_init(&vfd->entity, 1, &vp->pad);
1148 if (ret) 1148 if (ret)
1149 goto err_vd_rel; 1149 goto err_vd_rel;
1150 1150
@@ -1559,7 +1559,7 @@ int s3c_camif_create_subdev(struct camif_dev *camif)
1559 camif->pads[CAMIF_SD_PAD_SOURCE_C].flags = MEDIA_PAD_FL_SOURCE; 1559 camif->pads[CAMIF_SD_PAD_SOURCE_C].flags = MEDIA_PAD_FL_SOURCE;
1560 camif->pads[CAMIF_SD_PAD_SOURCE_P].flags = MEDIA_PAD_FL_SOURCE; 1560 camif->pads[CAMIF_SD_PAD_SOURCE_P].flags = MEDIA_PAD_FL_SOURCE;
1561 1561
1562 ret = media_entity_init(&sd->entity, CAMIF_SD_PADS_NUM, 1562 ret = media_entity_pads_init(&sd->entity, CAMIF_SD_PADS_NUM,
1563 camif->pads); 1563 camif->pads);
1564 if (ret) 1564 if (ret)
1565 return ret; 1565 return ret;
diff --git a/drivers/media/platform/vsp1/vsp1_entity.c b/drivers/media/platform/vsp1/vsp1_entity.c
index 619942ff2058..d7308530952f 100644
--- a/drivers/media/platform/vsp1/vsp1_entity.c
+++ b/drivers/media/platform/vsp1/vsp1_entity.c
@@ -219,7 +219,7 @@ int vsp1_entity_init(struct vsp1_device *vsp1, struct vsp1_entity *entity,
219 entity->pads[num_pads - 1].flags = MEDIA_PAD_FL_SOURCE; 219 entity->pads[num_pads - 1].flags = MEDIA_PAD_FL_SOURCE;
220 220
221 /* Initialize the media entity. */ 221 /* Initialize the media entity. */
222 return media_entity_init(&entity->subdev.entity, num_pads, 222 return media_entity_pads_init(&entity->subdev.entity, num_pads,
223 entity->pads); 223 entity->pads);
224} 224}
225 225
diff --git a/drivers/media/platform/vsp1/vsp1_video.c b/drivers/media/platform/vsp1/vsp1_video.c
index 024d10de3740..e3304303dce3 100644
--- a/drivers/media/platform/vsp1/vsp1_video.c
+++ b/drivers/media/platform/vsp1/vsp1_video.c
@@ -1192,7 +1192,7 @@ int vsp1_video_init(struct vsp1_video *video, struct vsp1_entity *rwpf)
1192 video->pipe.state = VSP1_PIPELINE_STOPPED; 1192 video->pipe.state = VSP1_PIPELINE_STOPPED;
1193 1193
1194 /* Initialize the media entity... */ 1194 /* Initialize the media entity... */
1195 ret = media_entity_init(&video->video.entity, 1, &video->pad); 1195 ret = media_entity_pads_init(&video->video.entity, 1, &video->pad);
1196 if (ret < 0) 1196 if (ret < 0)
1197 return ret; 1197 return ret;
1198 1198
diff --git a/drivers/media/platform/xilinx/xilinx-dma.c b/drivers/media/platform/xilinx/xilinx-dma.c
index b69c9630114d..0181ff402a5a 100644
--- a/drivers/media/platform/xilinx/xilinx-dma.c
+++ b/drivers/media/platform/xilinx/xilinx-dma.c
@@ -675,7 +675,7 @@ int xvip_dma_init(struct xvip_composite_device *xdev, struct xvip_dma *dma,
675 dma->pad.flags = type == V4L2_BUF_TYPE_VIDEO_CAPTURE 675 dma->pad.flags = type == V4L2_BUF_TYPE_VIDEO_CAPTURE
676 ? MEDIA_PAD_FL_SINK : MEDIA_PAD_FL_SOURCE; 676 ? MEDIA_PAD_FL_SINK : MEDIA_PAD_FL_SOURCE;
677 677
678 ret = media_entity_init(&dma->video.entity, 1, &dma->pad); 678 ret = media_entity_pads_init(&dma->video.entity, 1, &dma->pad);
679 if (ret < 0) 679 if (ret < 0)
680 goto error; 680 goto error;
681 681
diff --git a/drivers/media/platform/xilinx/xilinx-tpg.c b/drivers/media/platform/xilinx/xilinx-tpg.c
index c09ca513a9dc..2ec1f6c4b274 100644
--- a/drivers/media/platform/xilinx/xilinx-tpg.c
+++ b/drivers/media/platform/xilinx/xilinx-tpg.c
@@ -838,7 +838,7 @@ static int xtpg_probe(struct platform_device *pdev)
838 subdev->flags |= V4L2_SUBDEV_FL_HAS_DEVNODE; 838 subdev->flags |= V4L2_SUBDEV_FL_HAS_DEVNODE;
839 subdev->entity.ops = &xtpg_media_ops; 839 subdev->entity.ops = &xtpg_media_ops;
840 840
841 ret = media_entity_init(&subdev->entity, xtpg->npads, xtpg->pads); 841 ret = media_entity_pads_init(&subdev->entity, xtpg->npads, xtpg->pads);
842 if (ret < 0) 842 if (ret < 0)
843 goto error; 843 goto error;
844 844
diff --git a/drivers/media/usb/au0828/au0828-video.c b/drivers/media/usb/au0828/au0828-video.c
index 839361c035ff..8c54fd21022e 100644
--- a/drivers/media/usb/au0828/au0828-video.c
+++ b/drivers/media/usb/au0828/au0828-video.c
@@ -1810,12 +1810,12 @@ static void au0828_analog_create_entities(struct au0828_dev *dev)
1810 1810
1811 /* Initialize Video and VBI pads */ 1811 /* Initialize Video and VBI pads */
1812 dev->video_pad.flags = MEDIA_PAD_FL_SINK; 1812 dev->video_pad.flags = MEDIA_PAD_FL_SINK;
1813 ret = media_entity_init(&dev->vdev.entity, 1, &dev->video_pad); 1813 ret = media_entity_pads_init(&dev->vdev.entity, 1, &dev->video_pad);
1814 if (ret < 0) 1814 if (ret < 0)
1815 pr_err("failed to initialize video media entity!\n"); 1815 pr_err("failed to initialize video media entity!\n");
1816 1816
1817 dev->vbi_pad.flags = MEDIA_PAD_FL_SINK; 1817 dev->vbi_pad.flags = MEDIA_PAD_FL_SINK;
1818 ret = media_entity_init(&dev->vbi_dev.entity, 1, &dev->vbi_pad); 1818 ret = media_entity_pads_init(&dev->vbi_dev.entity, 1, &dev->vbi_pad);
1819 if (ret < 0) 1819 if (ret < 0)
1820 pr_err("failed to initialize vbi media entity!\n"); 1820 pr_err("failed to initialize vbi media entity!\n");
1821 1821
@@ -1847,7 +1847,7 @@ static void au0828_analog_create_entities(struct au0828_dev *dev)
1847 break; 1847 break;
1848 } 1848 }
1849 1849
1850 ret = media_entity_init(ent, 1, &dev->input_pad[i]); 1850 ret = media_entity_pads_init(ent, 1, &dev->input_pad[i]);
1851 if (ret < 0) 1851 if (ret < 0)
1852 pr_err("failed to initialize input pad[%d]!\n", i); 1852 pr_err("failed to initialize input pad[%d]!\n", i);
1853 1853
diff --git a/drivers/media/usb/cx231xx/cx231xx-video.c b/drivers/media/usb/cx231xx/cx231xx-video.c
index 905ccd7cbc6d..9b88cd8127ac 100644
--- a/drivers/media/usb/cx231xx/cx231xx-video.c
+++ b/drivers/media/usb/cx231xx/cx231xx-video.c
@@ -2175,7 +2175,7 @@ int cx231xx_register_analog_devices(struct cx231xx *dev)
2175 cx231xx_vdev_init(dev, &dev->vdev, &cx231xx_video_template, "video"); 2175 cx231xx_vdev_init(dev, &dev->vdev, &cx231xx_video_template, "video");
2176#if defined(CONFIG_MEDIA_CONTROLLER) 2176#if defined(CONFIG_MEDIA_CONTROLLER)
2177 dev->video_pad.flags = MEDIA_PAD_FL_SINK; 2177 dev->video_pad.flags = MEDIA_PAD_FL_SINK;
2178 ret = media_entity_init(&dev->vdev.entity, 1, &dev->video_pad); 2178 ret = media_entity_pads_init(&dev->vdev.entity, 1, &dev->video_pad);
2179 if (ret < 0) 2179 if (ret < 0)
2180 dev_err(dev->dev, "failed to initialize video media entity!\n"); 2180 dev_err(dev->dev, "failed to initialize video media entity!\n");
2181#endif 2181#endif
@@ -2202,7 +2202,7 @@ int cx231xx_register_analog_devices(struct cx231xx *dev)
2202 2202
2203#if defined(CONFIG_MEDIA_CONTROLLER) 2203#if defined(CONFIG_MEDIA_CONTROLLER)
2204 dev->vbi_pad.flags = MEDIA_PAD_FL_SINK; 2204 dev->vbi_pad.flags = MEDIA_PAD_FL_SINK;
2205 ret = media_entity_init(&dev->vbi_dev.entity, 1, &dev->vbi_pad); 2205 ret = media_entity_pads_init(&dev->vbi_dev.entity, 1, &dev->vbi_pad);
2206 if (ret < 0) 2206 if (ret < 0)
2207 dev_err(dev->dev, "failed to initialize vbi media entity!\n"); 2207 dev_err(dev->dev, "failed to initialize vbi media entity!\n");
2208#endif 2208#endif
diff --git a/drivers/media/usb/uvc/uvc_entity.c b/drivers/media/usb/uvc/uvc_entity.c
index 7f82b65b238e..38e893a1408b 100644
--- a/drivers/media/usb/uvc/uvc_entity.c
+++ b/drivers/media/usb/uvc/uvc_entity.c
@@ -94,10 +94,10 @@ static int uvc_mc_init_entity(struct uvc_entity *entity)
94 strlcpy(entity->subdev.name, entity->name, 94 strlcpy(entity->subdev.name, entity->name,
95 sizeof(entity->subdev.name)); 95 sizeof(entity->subdev.name));
96 96
97 ret = media_entity_init(&entity->subdev.entity, 97 ret = media_entity_pads_init(&entity->subdev.entity,
98 entity->num_pads, entity->pads); 98 entity->num_pads, entity->pads);
99 } else if (entity->vdev != NULL) { 99 } else if (entity->vdev != NULL) {
100 ret = media_entity_init(&entity->vdev->entity, 100 ret = media_entity_pads_init(&entity->vdev->entity,
101 entity->num_pads, entity->pads); 101 entity->num_pads, entity->pads);
102 if (entity->flags & UVC_ENTITY_FLAG_DEFAULT) 102 if (entity->flags & UVC_ENTITY_FLAG_DEFAULT)
103 entity->vdev->entity.flags |= MEDIA_ENT_FL_DEFAULT; 103 entity->vdev->entity.flags |= MEDIA_ENT_FL_DEFAULT;
diff --git a/drivers/media/v4l2-core/tuner-core.c b/drivers/media/v4l2-core/tuner-core.c
index 05fc4df61b85..76496fd282aa 100644
--- a/drivers/media/v4l2-core/tuner-core.c
+++ b/drivers/media/v4l2-core/tuner-core.c
@@ -701,7 +701,7 @@ register_client:
701 t->sd.entity.function = MEDIA_ENT_F_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_pads_init(&t->sd.entity, TUNER_NUM_PADS, &t->pad[0]);
705 if (ret < 0) { 705 if (ret < 0) {
706 tuner_err("failed to initialize media entity!\n"); 706 tuner_err("failed to initialize media entity!\n");
707 kfree(t); 707 kfree(t);
diff --git a/drivers/media/v4l2-core/v4l2-flash-led-class.c b/drivers/media/v4l2-core/v4l2-flash-led-class.c
index 5c686a24712b..13d5a36bc5d8 100644
--- a/drivers/media/v4l2-core/v4l2-flash-led-class.c
+++ b/drivers/media/v4l2-core/v4l2-flash-led-class.c
@@ -651,7 +651,7 @@ struct v4l2_flash *v4l2_flash_init(
651 sd->flags |= V4L2_SUBDEV_FL_HAS_DEVNODE; 651 sd->flags |= V4L2_SUBDEV_FL_HAS_DEVNODE;
652 strlcpy(sd->name, config->dev_name, sizeof(sd->name)); 652 strlcpy(sd->name, config->dev_name, sizeof(sd->name));
653 653
654 ret = media_entity_init(&sd->entity, 0, NULL); 654 ret = media_entity_pads_init(&sd->entity, 0, NULL);
655 if (ret < 0) 655 if (ret < 0)
656 return ERR_PTR(ret); 656 return ERR_PTR(ret);
657 657
diff --git a/drivers/staging/media/davinci_vpfe/dm365_ipipe.c b/drivers/staging/media/davinci_vpfe/dm365_ipipe.c
index 77837afab0ce..ac78ed2f8bcc 100644
--- a/drivers/staging/media/davinci_vpfe/dm365_ipipe.c
+++ b/drivers/staging/media/davinci_vpfe/dm365_ipipe.c
@@ -1843,7 +1843,7 @@ vpfe_ipipe_init(struct vpfe_ipipe_device *ipipe, struct platform_device *pdev)
1843 v4l2_ctrl_handler_setup(&ipipe->ctrls); 1843 v4l2_ctrl_handler_setup(&ipipe->ctrls);
1844 sd->ctrl_handler = &ipipe->ctrls; 1844 sd->ctrl_handler = &ipipe->ctrls;
1845 1845
1846 return media_entity_init(me, IPIPE_PADS_NUM, pads); 1846 return media_entity_pads_init(me, IPIPE_PADS_NUM, pads);
1847} 1847}
1848 1848
1849/* 1849/*
diff --git a/drivers/staging/media/davinci_vpfe/dm365_ipipeif.c b/drivers/staging/media/davinci_vpfe/dm365_ipipeif.c
index b66584ecb693..a54c60fce3d5 100644
--- a/drivers/staging/media/davinci_vpfe/dm365_ipipeif.c
+++ b/drivers/staging/media/davinci_vpfe/dm365_ipipeif.c
@@ -1031,7 +1031,7 @@ int vpfe_ipipeif_init(struct vpfe_ipipeif_device *ipipeif,
1031 ipipeif->output = IPIPEIF_OUTPUT_NONE; 1031 ipipeif->output = IPIPEIF_OUTPUT_NONE;
1032 me->ops = &ipipeif_media_ops; 1032 me->ops = &ipipeif_media_ops;
1033 1033
1034 ret = media_entity_init(me, IPIPEIF_NUM_PADS, pads); 1034 ret = media_entity_pads_init(me, IPIPEIF_NUM_PADS, pads);
1035 if (ret) 1035 if (ret)
1036 goto fail; 1036 goto fail;
1037 1037
diff --git a/drivers/staging/media/davinci_vpfe/dm365_isif.c b/drivers/staging/media/davinci_vpfe/dm365_isif.c
index 8ca0c1297ec8..b35667afb73f 100644
--- a/drivers/staging/media/davinci_vpfe/dm365_isif.c
+++ b/drivers/staging/media/davinci_vpfe/dm365_isif.c
@@ -2057,7 +2057,7 @@ int vpfe_isif_init(struct vpfe_isif_device *isif, struct platform_device *pdev)
2057 isif->input = ISIF_INPUT_NONE; 2057 isif->input = ISIF_INPUT_NONE;
2058 isif->output = ISIF_OUTPUT_NONE; 2058 isif->output = ISIF_OUTPUT_NONE;
2059 me->ops = &isif_media_ops; 2059 me->ops = &isif_media_ops;
2060 status = media_entity_init(me, ISIF_PADS_NUM, pads); 2060 status = media_entity_pads_init(me, ISIF_PADS_NUM, pads);
2061 if (status) 2061 if (status)
2062 goto isif_fail; 2062 goto isif_fail;
2063 isif->video_out.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; 2063 isif->video_out.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
diff --git a/drivers/staging/media/davinci_vpfe/dm365_resizer.c b/drivers/staging/media/davinci_vpfe/dm365_resizer.c
index ba887efd226a..669ae3f9791f 100644
--- a/drivers/staging/media/davinci_vpfe/dm365_resizer.c
+++ b/drivers/staging/media/davinci_vpfe/dm365_resizer.c
@@ -1915,7 +1915,7 @@ int vpfe_resizer_init(struct vpfe_resizer_device *vpfe_rsz,
1915 vpfe_rsz->crop_resizer.output2 = RESIZER_CROP_OUTPUT_NONE; 1915 vpfe_rsz->crop_resizer.output2 = RESIZER_CROP_OUTPUT_NONE;
1916 vpfe_rsz->crop_resizer.rsz_device = vpfe_rsz; 1916 vpfe_rsz->crop_resizer.rsz_device = vpfe_rsz;
1917 me->ops = &resizer_media_ops; 1917 me->ops = &resizer_media_ops;
1918 ret = media_entity_init(me, RESIZER_CROP_PADS_NUM, pads); 1918 ret = media_entity_pads_init(me, RESIZER_CROP_PADS_NUM, pads);
1919 if (ret) 1919 if (ret)
1920 return ret; 1920 return ret;
1921 1921
@@ -1937,7 +1937,7 @@ int vpfe_resizer_init(struct vpfe_resizer_device *vpfe_rsz,
1937 vpfe_rsz->resizer_a.output = RESIZER_OUTPUT_NONE; 1937 vpfe_rsz->resizer_a.output = RESIZER_OUTPUT_NONE;
1938 vpfe_rsz->resizer_a.rsz_device = vpfe_rsz; 1938 vpfe_rsz->resizer_a.rsz_device = vpfe_rsz;
1939 me->ops = &resizer_media_ops; 1939 me->ops = &resizer_media_ops;
1940 ret = media_entity_init(me, RESIZER_PADS_NUM, pads); 1940 ret = media_entity_pads_init(me, RESIZER_PADS_NUM, pads);
1941 if (ret) 1941 if (ret)
1942 return ret; 1942 return ret;
1943 1943
@@ -1959,7 +1959,7 @@ int vpfe_resizer_init(struct vpfe_resizer_device *vpfe_rsz,
1959 vpfe_rsz->resizer_b.output = RESIZER_OUTPUT_NONE; 1959 vpfe_rsz->resizer_b.output = RESIZER_OUTPUT_NONE;
1960 vpfe_rsz->resizer_b.rsz_device = vpfe_rsz; 1960 vpfe_rsz->resizer_b.rsz_device = vpfe_rsz;
1961 me->ops = &resizer_media_ops; 1961 me->ops = &resizer_media_ops;
1962 ret = media_entity_init(me, RESIZER_PADS_NUM, pads); 1962 ret = media_entity_pads_init(me, RESIZER_PADS_NUM, pads);
1963 if (ret) 1963 if (ret)
1964 return ret; 1964 return ret;
1965 1965
diff --git a/drivers/staging/media/davinci_vpfe/vpfe_video.c b/drivers/staging/media/davinci_vpfe/vpfe_video.c
index a5e30413fc47..285dc1a69b2c 100644
--- a/drivers/staging/media/davinci_vpfe/vpfe_video.c
+++ b/drivers/staging/media/davinci_vpfe/vpfe_video.c
@@ -1599,7 +1599,7 @@ int vpfe_video_init(struct vpfe_video_device *video, const char *name)
1599 spin_lock_init(&video->irqlock); 1599 spin_lock_init(&video->irqlock);
1600 spin_lock_init(&video->dma_queue_lock); 1600 spin_lock_init(&video->dma_queue_lock);
1601 mutex_init(&video->lock); 1601 mutex_init(&video->lock);
1602 ret = media_entity_init(&video->video_dev.entity, 1602 ret = media_entity_pads_init(&video->video_dev.entity,
1603 1, &video->pad); 1603 1, &video->pad);
1604 if (ret < 0) 1604 if (ret < 0)
1605 return ret; 1605 return ret;
diff --git a/drivers/staging/media/omap4iss/iss_csi2.c b/drivers/staging/media/omap4iss/iss_csi2.c
index 2b9a36cd8fa8..226366a03661 100644
--- a/drivers/staging/media/omap4iss/iss_csi2.c
+++ b/drivers/staging/media/omap4iss/iss_csi2.c
@@ -1276,7 +1276,7 @@ static int csi2_init_entities(struct iss_csi2_device *csi2, const char *subname)
1276 pads[CSI2_PAD_SINK].flags = MEDIA_PAD_FL_SINK; 1276 pads[CSI2_PAD_SINK].flags = MEDIA_PAD_FL_SINK;
1277 1277
1278 me->ops = &csi2_media_ops; 1278 me->ops = &csi2_media_ops;
1279 ret = media_entity_init(me, CSI2_PADS_NUM, pads); 1279 ret = media_entity_pads_init(me, CSI2_PADS_NUM, pads);
1280 if (ret < 0) 1280 if (ret < 0)
1281 return ret; 1281 return ret;
1282 1282
diff --git a/drivers/staging/media/omap4iss/iss_ipipe.c b/drivers/staging/media/omap4iss/iss_ipipe.c
index dd9d7d54e6f8..d38782e8e84c 100644
--- a/drivers/staging/media/omap4iss/iss_ipipe.c
+++ b/drivers/staging/media/omap4iss/iss_ipipe.c
@@ -516,7 +516,7 @@ static int ipipe_init_entities(struct iss_ipipe_device *ipipe)
516 pads[IPIPE_PAD_SOURCE_VP].flags = MEDIA_PAD_FL_SOURCE; 516 pads[IPIPE_PAD_SOURCE_VP].flags = MEDIA_PAD_FL_SOURCE;
517 517
518 me->ops = &ipipe_media_ops; 518 me->ops = &ipipe_media_ops;
519 ret = media_entity_init(me, IPIPE_PADS_NUM, pads); 519 ret = media_entity_pads_init(me, IPIPE_PADS_NUM, pads);
520 if (ret < 0) 520 if (ret < 0)
521 return ret; 521 return ret;
522 522
diff --git a/drivers/staging/media/omap4iss/iss_ipipeif.c b/drivers/staging/media/omap4iss/iss_ipipeif.c
index 8cbb9840a989..c2b5638a0898 100644
--- a/drivers/staging/media/omap4iss/iss_ipipeif.c
+++ b/drivers/staging/media/omap4iss/iss_ipipeif.c
@@ -748,7 +748,7 @@ static int ipipeif_init_entities(struct iss_ipipeif_device *ipipeif)
748 pads[IPIPEIF_PAD_SOURCE_VP].flags = MEDIA_PAD_FL_SOURCE; 748 pads[IPIPEIF_PAD_SOURCE_VP].flags = MEDIA_PAD_FL_SOURCE;
749 749
750 me->ops = &ipipeif_media_ops; 750 me->ops = &ipipeif_media_ops;
751 ret = media_entity_init(me, IPIPEIF_PADS_NUM, pads); 751 ret = media_entity_pads_init(me, IPIPEIF_PADS_NUM, pads);
752 if (ret < 0) 752 if (ret < 0)
753 return ret; 753 return ret;
754 754
diff --git a/drivers/staging/media/omap4iss/iss_resizer.c b/drivers/staging/media/omap4iss/iss_resizer.c
index a3925ecd0ed7..fea13ab4041f 100644
--- a/drivers/staging/media/omap4iss/iss_resizer.c
+++ b/drivers/staging/media/omap4iss/iss_resizer.c
@@ -790,7 +790,7 @@ static int resizer_init_entities(struct iss_resizer_device *resizer)
790 pads[RESIZER_PAD_SOURCE_MEM].flags = MEDIA_PAD_FL_SOURCE; 790 pads[RESIZER_PAD_SOURCE_MEM].flags = MEDIA_PAD_FL_SOURCE;
791 791
792 me->ops = &resizer_media_ops; 792 me->ops = &resizer_media_ops;
793 ret = media_entity_init(me, RESIZER_PADS_NUM, pads); 793 ret = media_entity_pads_init(me, RESIZER_PADS_NUM, pads);
794 if (ret < 0) 794 if (ret < 0)
795 return ret; 795 return ret;
796 796
diff --git a/drivers/staging/media/omap4iss/iss_video.c b/drivers/staging/media/omap4iss/iss_video.c
index 60b7a58e6122..8c6af412bc16 100644
--- a/drivers/staging/media/omap4iss/iss_video.c
+++ b/drivers/staging/media/omap4iss/iss_video.c
@@ -1101,7 +1101,7 @@ int omap4iss_video_init(struct iss_video *video, const char *name)
1101 return -EINVAL; 1101 return -EINVAL;
1102 } 1102 }
1103 1103
1104 ret = media_entity_init(&video->video.entity, 1, &video->pad); 1104 ret = media_entity_pads_init(&video->video.entity, 1, &video->pad);
1105 if (ret < 0) 1105 if (ret < 0)
1106 return ret; 1106 return ret;
1107 1107
diff --git a/include/media/media-entity.h b/include/media/media-entity.h
index cd3f3a77df2d..32fef503d950 100644
--- a/include/media/media-entity.h
+++ b/include/media/media-entity.h
@@ -347,7 +347,7 @@ void media_gobj_init(struct media_device *mdev,
347 struct media_gobj *gobj); 347 struct media_gobj *gobj);
348void media_gobj_remove(struct media_gobj *gobj); 348void media_gobj_remove(struct media_gobj *gobj);
349 349
350int media_entity_init(struct media_entity *entity, u16 num_pads, 350int media_entity_pads_init(struct media_entity *entity, u16 num_pads,
351 struct media_pad *pads); 351 struct media_pad *pads);
352void media_entity_cleanup(struct media_entity *entity); 352void media_entity_cleanup(struct media_entity *entity);
353 353