linux-media.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v4 0/6] MC preparation patches
@ 2015-08-14 14:56 Mauro Carvalho Chehab
  2015-08-14 14:56 ` [PATCH v4 1/6] media: get rid of unused "extra_links" param on media_entity_init() Mauro Carvalho Chehab
                   ` (6 more replies)
  0 siblings, 7 replies; 27+ messages in thread
From: Mauro Carvalho Chehab @ 2015-08-14 14:56 UTC (permalink / raw)
  To: Linux Media Mailing List; +Cc: Mauro Carvalho Chehab, Mauro Carvalho Chehab

Those are the initial patches from my previous series of MC changes.

The first patch removes an unused parameter when creating links.

The next 5 patches warrant that all object types (entities, pads and
links) will have an unique ID, as agreed at the MC workshop.

They prepare for the addition of the media interfaces and interface
links.

Mauro Carvalho Chehab (6):
  media: get rid of unused "extra_links" param on media_entity_init()
  media: create a macro to get entity ID
  media: add a common struct to be embed on media graph objects
  media: use media_graph_obj inside entities
  media: use media_graph_obj inside pads
  media: use media_graph_obj inside links

 Documentation/media-framework.txt                  |  2 +-
 Documentation/video4linux/v4l2-framework.txt       |  4 +-
 Documentation/zh_CN/video4linux/v4l2-framework.txt |  4 +-
 drivers/media/dvb-core/dvbdev.c                    |  2 +-
 drivers/media/i2c/ad9389b.c                        |  2 +-
 drivers/media/i2c/adp1653.c                        |  2 +-
 drivers/media/i2c/adv7180.c                        |  2 +-
 drivers/media/i2c/adv7511.c                        |  2 +-
 drivers/media/i2c/adv7604.c                        |  2 +-
 drivers/media/i2c/adv7842.c                        |  2 +-
 drivers/media/i2c/as3645a.c                        |  2 +-
 drivers/media/i2c/cx25840/cx25840-core.c           |  2 +-
 drivers/media/i2c/lm3560.c                         |  2 +-
 drivers/media/i2c/lm3646.c                         |  2 +-
 drivers/media/i2c/m5mols/m5mols_core.c             |  2 +-
 drivers/media/i2c/mt9m032.c                        |  2 +-
 drivers/media/i2c/mt9p031.c                        |  2 +-
 drivers/media/i2c/mt9t001.c                        |  2 +-
 drivers/media/i2c/mt9v032.c                        |  2 +-
 drivers/media/i2c/noon010pc30.c                    |  2 +-
 drivers/media/i2c/ov2659.c                         |  2 +-
 drivers/media/i2c/ov9650.c                         |  2 +-
 drivers/media/i2c/s5c73m3/s5c73m3-core.c           |  4 +-
 drivers/media/i2c/s5k4ecgx.c                       |  2 +-
 drivers/media/i2c/s5k5baf.c                        |  4 +-
 drivers/media/i2c/s5k6a3.c                         |  2 +-
 drivers/media/i2c/s5k6aa.c                         |  2 +-
 drivers/media/i2c/smiapp/smiapp-core.c             |  4 +-
 drivers/media/i2c/tc358743.c                       |  2 +-
 drivers/media/i2c/tvp514x.c                        |  2 +-
 drivers/media/i2c/tvp7002.c                        |  2 +-
 drivers/media/media-device.c                       | 29 +++++++----
 drivers/media/media-entity.c                       | 58 +++++++++++++++++++---
 drivers/media/platform/exynos4-is/fimc-capture.c   |  4 +-
 drivers/media/platform/exynos4-is/fimc-isp-video.c |  2 +-
 drivers/media/platform/exynos4-is/fimc-isp.c       |  2 +-
 drivers/media/platform/exynos4-is/fimc-lite.c      |  4 +-
 drivers/media/platform/exynos4-is/fimc-m2m.c       |  2 +-
 drivers/media/platform/exynos4-is/mipi-csis.c      |  2 +-
 drivers/media/platform/omap3isp/ispccdc.c          |  2 +-
 drivers/media/platform/omap3isp/ispccp2.c          |  2 +-
 drivers/media/platform/omap3isp/ispcsi2.c          |  2 +-
 drivers/media/platform/omap3isp/isppreview.c       |  2 +-
 drivers/media/platform/omap3isp/ispresizer.c       |  2 +-
 drivers/media/platform/omap3isp/ispstat.c          |  2 +-
 drivers/media/platform/omap3isp/ispvideo.c         |  2 +-
 drivers/media/platform/s3c-camif/camif-capture.c   |  4 +-
 drivers/media/platform/vsp1/vsp1_entity.c          |  2 +-
 drivers/media/platform/vsp1/vsp1_video.c           |  6 +--
 drivers/media/platform/xilinx/xilinx-dma.c         |  2 +-
 drivers/media/platform/xilinx/xilinx-tpg.c         |  2 +-
 drivers/media/usb/cx231xx/cx231xx-video.c          |  4 +-
 drivers/media/usb/uvc/uvc_entity.c                 |  4 +-
 drivers/media/v4l2-core/tuner-core.c               |  2 +-
 drivers/media/v4l2-core/v4l2-flash-led-class.c     |  2 +-
 drivers/staging/media/davinci_vpfe/dm365_ipipe.c   |  2 +-
 drivers/staging/media/davinci_vpfe/dm365_ipipeif.c |  2 +-
 drivers/staging/media/davinci_vpfe/dm365_isif.c    |  2 +-
 drivers/staging/media/davinci_vpfe/dm365_resizer.c |  6 +--
 drivers/staging/media/davinci_vpfe/vpfe_video.c    |  2 +-
 drivers/staging/media/omap4iss/iss_csi2.c          |  2 +-
 drivers/staging/media/omap4iss/iss_ipipe.c         |  2 +-
 drivers/staging/media/omap4iss/iss_ipipeif.c       |  2 +-
 drivers/staging/media/omap4iss/iss_resizer.c       |  2 +-
 drivers/staging/media/omap4iss/iss_video.c         |  2 +-
 include/media/media-device.h                       |  8 ++-
 include/media/media-entity.h                       | 48 ++++++++++++++++--
 67 files changed, 200 insertions(+), 97 deletions(-)

-- 
2.4.3


^ permalink raw reply	[flat|nested] 27+ messages in thread

* [PATCH v4 1/6] media: get rid of unused "extra_links" param on media_entity_init()
  2015-08-14 14:56 [PATCH v4 0/6] MC preparation patches Mauro Carvalho Chehab
@ 2015-08-14 14:56 ` Mauro Carvalho Chehab
  2015-08-14 14:59   ` Hans Verkuil
  2015-08-14 15:16   ` Laurent Pinchart
  2015-08-14 14:56 ` [PATCH v4 2/6] media: create a macro to get entity ID Mauro Carvalho Chehab
                   ` (5 subsequent siblings)
  6 siblings, 2 replies; 27+ messages in thread
From: Mauro Carvalho Chehab @ 2015-08-14 14:56 UTC (permalink / raw)
  To: Linux Media Mailing List
  Cc: Mauro Carvalho Chehab, Mauro Carvalho Chehab, Jonathan Corbet,
	Harry Wei, Hans Verkuil, Sakari Ailus, Lars-Peter Clausen,
	Laurent Pinchart, Kyungmin Park, Heungjun Kim, Prabhakar Lad,
	Andrzej Hajda, Mats Randgaard, Sylwester Nawrocki, Kukjin Kim,
	Krzysztof Kozlowski, Hyun Kwon, Michal Simek,
	Sören Brinkmann, Greg Kroah-Hartman, Joe Perches,
	Boris BREZILLON, Javier Martinez Canillas, Guennadi Liakhovetski,
	Ricardo Ribalda Delgado, Axel Lin, Scott Jiang, Bryan Wu,
	Jacek Anaszewski, Aya Mahfouz, Haneen Mohammed, Tapasweni Pathak,
	anuvazhayil, Mahati Chamarthy, Navya Sri Nizamkari, linux-doc,
	linux-kernel, linux-arm-kernel, linux-samsung-soc, linux-sh,
	devel

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset=true, Size: 40559 bytes --]

Currently, media_entity_init() creates an array with the links,
allocated at init time. It provides a parameter (extra_links)
that would allocate more links than the current needs, but this
is not used by any driver.

As we want to be able to do dynamic link allocation/removal,
we'll need to change the implementation of the links. So,
before doing that, let's first remove that extra unused
parameter, in order to cleanup the interface first.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>

diff --git a/Documentation/media-framework.txt b/Documentation/media-framework.txt
index f552a75c0e70..2cc6019f7147 100644
--- a/Documentation/media-framework.txt
+++ b/Documentation/media-framework.txt
@@ -104,7 +104,7 @@ although drivers can allocate entities directly.
 Drivers initialize entities by calling
 
 	media_entity_init(struct media_entity *entity, u16 num_pads,
-			  struct media_pad *pads, u16 extra_links);
+			  struct media_pad *pads);
 
 The media_entity name, type, flags, revision and group_id fields can be
 initialized before or after calling media_entity_init. Entities embedded in
diff --git a/Documentation/video4linux/v4l2-framework.txt b/Documentation/video4linux/v4l2-framework.txt
index 75d5c18d689a..109cc3792534 100644
--- a/Documentation/video4linux/v4l2-framework.txt
+++ b/Documentation/video4linux/v4l2-framework.txt
@@ -300,7 +300,7 @@ calling media_entity_init():
 	struct media_pad *pads = &my_sd->pads;
 	int err;
 
-	err = media_entity_init(&sd->entity, npads, pads, 0);
+	err = media_entity_init(&sd->entity, npads, pads);
 
 The pads array must have been previously initialized. There is no need to
 manually set the struct media_entity type and name fields, but the revision
@@ -700,7 +700,7 @@ calling media_entity_init():
 	struct media_pad *pad = &my_vdev->pad;
 	int err;
 
-	err = media_entity_init(&vdev->entity, 1, pad, 0);
+	err = media_entity_init(&vdev->entity, 1, pad);
 
 The pads array must have been previously initialized. There is no need to
 manually 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 2b828e631e31..ff815cb92031 100644
--- a/Documentation/zh_CN/video4linux/v4l2-framework.txt
+++ b/Documentation/zh_CN/video4linux/v4l2-framework.txt
@@ -295,7 +295,7 @@ owner 域。若使用 i2c 辅助函数,这些都会帮你处理好。
 	struct media_pad *pads = &my_sd->pads;
 	int err;
 
-	err = media_entity_init(&sd->entity, npads, pads, 0);
+	err = media_entity_init(&sd->entity, npads, pads);
 
 pads 数组必须预先初始化。无须手动设置 media_entity 的 type 和
 name 域,但如有必要,revision 域必须初始化。
@@ -602,7 +602,7 @@ v4l2_file_operations 结构体是 file_operations 的一个子集。其主要
 	struct media_pad *pad = &my_vdev->pad;
 	int err;
 
-	err = media_entity_init(&vdev->entity, 1, pad, 0);
+	err = media_entity_init(&vdev->entity, 1, pad);
 
 pads 数组必须预先初始化。没有必要手动设置 media_entity 的 type 和
 name 域。
diff --git a/drivers/media/dvb-core/dvbdev.c b/drivers/media/dvb-core/dvbdev.c
index 13bb57f0457f..2fdcbb5f000a 100644
--- a/drivers/media/dvb-core/dvbdev.c
+++ b/drivers/media/dvb-core/dvbdev.c
@@ -249,7 +249,7 @@ static void dvb_register_media_device(struct dvb_device *dvbdev,
 	}
 
 	if (npads)
-		ret = media_entity_init(dvbdev->entity, npads, dvbdev->pads, 0);
+		ret = media_entity_init(dvbdev->entity, npads, dvbdev->pads);
 	if (!ret)
 		ret = media_device_register_entity(dvbdev->adapter->mdev,
 						   dvbdev->entity);
diff --git a/drivers/media/i2c/ad9389b.c b/drivers/media/i2c/ad9389b.c
index 69094ab047b1..39d6ee681aeb 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 *
 	state->rgb_quantization_range_ctrl->is_private = true;
 
 	state->pad.flags = MEDIA_PAD_FL_SINK;
-	err = media_entity_init(&sd->entity, 1, &state->pad, 0);
+	err = media_entity_init(&sd->entity, 1, &state->pad);
 	if (err)
 		goto err_hdl;
 
diff --git a/drivers/media/i2c/adp1653.c b/drivers/media/i2c/adp1653.c
index c70ababce954..5f76997f6e07 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,
 	if (ret)
 		goto free_and_quit;
 
-	ret = media_entity_init(&flash->subdev.entity, 0, NULL, 0);
+	ret = media_entity_init(&flash->subdev.entity, 0, NULL);
 	if (ret < 0)
 		goto free_and_quit;
 
diff --git a/drivers/media/i2c/adv7180.c b/drivers/media/i2c/adv7180.c
index f82c8aa164fa..bab91a1e1525 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,
 
 	state->pad.flags = MEDIA_PAD_FL_SOURCE;
 	sd->entity.flags |= MEDIA_ENT_T_V4L2_SUBDEV_DECODER;
-	ret = media_entity_init(&sd->entity, 1, &state->pad, 0);
+	ret = media_entity_init(&sd->entity, 1, &state->pad);
 	if (ret)
 		goto err_free_ctrl;
 
diff --git a/drivers/media/i2c/adv7511.c b/drivers/media/i2c/adv7511.c
index ef198cee8969..992ac143a40b 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 *
 	state->rgb_quantization_range_ctrl->is_private = true;
 
 	state->pad.flags = MEDIA_PAD_FL_SINK;
-	err = media_entity_init(&sd->entity, 1, &state->pad, 0);
+	err = media_entity_init(&sd->entity, 1, &state->pad);
 	if (err)
 		goto err_hdl;
 
diff --git a/drivers/media/i2c/adv7604.c b/drivers/media/i2c/adv7604.c
index 5631ec004eed..35fccf450870 100644
--- a/drivers/media/i2c/adv7604.c
+++ b/drivers/media/i2c/adv7604.c
@@ -3209,7 +3209,7 @@ static int adv76xx_probe(struct i2c_client *client,
 	state->pads[state->source_pad].flags = MEDIA_PAD_FL_SOURCE;
 
 	err = media_entity_init(&sd->entity, state->source_pad + 1,
-				state->pads, 0);
+				state->pads);
 	if (err)
 		goto err_work_queues;
 
diff --git a/drivers/media/i2c/adv7842.c b/drivers/media/i2c/adv7842.c
index b7269b8f040d..3968d018135c 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,
 			adv7842_delayed_work_enable_hotplug);
 
 	state->pad.flags = MEDIA_PAD_FL_SOURCE;
-	err = media_entity_init(&sd->entity, 1, &state->pad, 0);
+	err = media_entity_init(&sd->entity, 1, &state->pad);
 	if (err)
 		goto err_work_queues;
 
diff --git a/drivers/media/i2c/as3645a.c b/drivers/media/i2c/as3645a.c
index 301084b07887..9d579a836f79 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,
 	if (ret < 0)
 		goto done;
 
-	ret = media_entity_init(&flash->subdev.entity, 0, NULL, 0);
+	ret = media_entity_init(&flash->subdev.entity, 0, NULL);
 	if (ret < 0)
 		goto done;
 
diff --git a/drivers/media/i2c/cx25840/cx25840-core.c b/drivers/media/i2c/cx25840/cx25840-core.c
index fe6eb78b6914..270135d06b32 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,
 	sd->entity.type = MEDIA_ENT_T_V4L2_SUBDEV_DECODER;
 
 	ret = media_entity_init(&sd->entity, ARRAY_SIZE(state->pads),
-				state->pads, 0);
+				state->pads);
 	if (ret < 0) {
 		v4l_info(client, "failed to initialize media entity!\n");
 		return ret;
diff --git a/drivers/media/i2c/lm3560.c b/drivers/media/i2c/lm3560.c
index d9ece4b2d047..9bd9def0852c 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,
 	rval = lm3560_init_controls(flash, led_no);
 	if (rval)
 		goto err_out;
-	rval = media_entity_init(&flash->subdev_led[led_no].entity, 0, NULL, 0);
+	rval = media_entity_init(&flash->subdev_led[led_no].entity, 0, NULL);
 	if (rval < 0)
 		goto err_out;
 	flash->subdev_led[led_no].entity.type = MEDIA_ENT_T_V4L2_SUBDEV_FLASH;
diff --git a/drivers/media/i2c/lm3646.c b/drivers/media/i2c/lm3646.c
index 626fb4679c02..4160e18af607 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)
 	rval = lm3646_init_controls(flash);
 	if (rval)
 		goto err_out;
-	rval = media_entity_init(&flash->subdev_led.entity, 0, NULL, 0);
+	rval = media_entity_init(&flash->subdev_led.entity, 0, NULL);
 	if (rval < 0)
 		goto err_out;
 	flash->subdev_led.entity.type = MEDIA_ENT_T_V4L2_SUBDEV_FLASH;
diff --git a/drivers/media/i2c/m5mols/m5mols_core.c b/drivers/media/i2c/m5mols/m5mols_core.c
index 6404c0d93e7a..f718a1009e4c 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,
 
 	sd->internal_ops = &m5mols_subdev_internal_ops;
 	info->pad.flags = MEDIA_PAD_FL_SOURCE;
-	ret = media_entity_init(&sd->entity, 1, &info->pad, 0);
+	ret = media_entity_init(&sd->entity, 1, &info->pad);
 	if (ret < 0)
 		return ret;
 	sd->entity.type = MEDIA_ENT_T_V4L2_SUBDEV_SENSOR;
diff --git a/drivers/media/i2c/mt9m032.c b/drivers/media/i2c/mt9m032.c
index c7747bd0cabb..1493ab6e7fb3 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,
 
 	sensor->subdev.ctrl_handler = &sensor->ctrls;
 	sensor->pad.flags = MEDIA_PAD_FL_SOURCE;
-	ret = media_entity_init(&sensor->subdev.entity, 1, &sensor->pad, 0);
+	ret = media_entity_init(&sensor->subdev.entity, 1, &sensor->pad);
 	if (ret < 0)
 		goto error_ctrl;
 
diff --git a/drivers/media/i2c/mt9p031.c b/drivers/media/i2c/mt9p031.c
index 0db15f528ac1..e3c5af82b7c1 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,
 	mt9p031->subdev.internal_ops = &mt9p031_subdev_internal_ops;
 
 	mt9p031->pad.flags = MEDIA_PAD_FL_SOURCE;
-	ret = media_entity_init(&mt9p031->subdev.entity, 1, &mt9p031->pad, 0);
+	ret = media_entity_init(&mt9p031->subdev.entity, 1, &mt9p031->pad);
 	if (ret < 0)
 		goto done;
 
diff --git a/drivers/media/i2c/mt9t001.c b/drivers/media/i2c/mt9t001.c
index 8ae99f7f254c..1dae1a98bc85 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,
 	mt9t001->subdev.flags |= V4L2_SUBDEV_FL_HAS_DEVNODE;
 
 	mt9t001->pad.flags = MEDIA_PAD_FL_SOURCE;
-	ret = media_entity_init(&mt9t001->subdev.entity, 1, &mt9t001->pad, 0);
+	ret = media_entity_init(&mt9t001->subdev.entity, 1, &mt9t001->pad);
 
 done:
 	if (ret < 0) {
diff --git a/drivers/media/i2c/mt9v032.c b/drivers/media/i2c/mt9v032.c
index a68ce94ee097..065659e98719 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,
 	mt9v032->subdev.flags |= V4L2_SUBDEV_FL_HAS_DEVNODE;
 
 	mt9v032->pad.flags = MEDIA_PAD_FL_SOURCE;
-	ret = media_entity_init(&mt9v032->subdev.entity, 1, &mt9v032->pad, 0);
+	ret = media_entity_init(&mt9v032->subdev.entity, 1, &mt9v032->pad);
 	if (ret < 0)
 		goto err;
 
diff --git a/drivers/media/i2c/noon010pc30.c b/drivers/media/i2c/noon010pc30.c
index f197b6cbd407..a9761251b970 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,
 
 	info->pad.flags = MEDIA_PAD_FL_SOURCE;
 	sd->entity.type = MEDIA_ENT_T_V4L2_SUBDEV_SENSOR;
-	ret = media_entity_init(&sd->entity, 1, &info->pad, 0);
+	ret = media_entity_init(&sd->entity, 1, &info->pad);
 	if (ret < 0)
 		goto np_err;
 
diff --git a/drivers/media/i2c/ov2659.c b/drivers/media/i2c/ov2659.c
index 6edffc7b74e3..39f2d2cfdc9c 100644
--- a/drivers/media/i2c/ov2659.c
+++ b/drivers/media/i2c/ov2659.c
@@ -1450,7 +1450,7 @@ static int ov2659_probe(struct i2c_client *client,
 #if defined(CONFIG_MEDIA_CONTROLLER)
 	ov2659->pad.flags = MEDIA_PAD_FL_SOURCE;
 	sd->entity.type = MEDIA_ENT_T_V4L2_SUBDEV_SENSOR;
-	ret = media_entity_init(&sd->entity, 1, &ov2659->pad, 0);
+	ret = media_entity_init(&sd->entity, 1, &ov2659->pad);
 	if (ret < 0) {
 		v4l2_ctrl_handler_free(&ov2659->ctrls);
 		return ret;
diff --git a/drivers/media/i2c/ov9650.c b/drivers/media/i2c/ov9650.c
index 2bc473385c91..6a6747343512 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,
 
 	ov965x->pad.flags = MEDIA_PAD_FL_SOURCE;
 	sd->entity.type = MEDIA_ENT_T_V4L2_SUBDEV_SENSOR;
-	ret = media_entity_init(&sd->entity, 1, &ov965x->pad, 0);
+	ret = media_entity_init(&sd->entity, 1, &ov965x->pad);
 	if (ret < 0)
 		return ret;
 
diff --git a/drivers/media/i2c/s5c73m3/s5c73m3-core.c b/drivers/media/i2c/s5c73m3/s5c73m3-core.c
index 53c5ea89f0b9..6d167428727d 100644
--- a/drivers/media/i2c/s5c73m3/s5c73m3-core.c
+++ b/drivers/media/i2c/s5c73m3/s5c73m3-core.c
@@ -1691,7 +1691,7 @@ static int s5c73m3_probe(struct i2c_client *client,
 	sd->entity.type = MEDIA_ENT_T_V4L2_SUBDEV;
 
 	ret = media_entity_init(&sd->entity, S5C73M3_NUM_PADS,
-							state->sensor_pads, 0);
+							state->sensor_pads);
 	if (ret < 0)
 		return ret;
 
@@ -1707,7 +1707,7 @@ static int s5c73m3_probe(struct i2c_client *client,
 	oif_sd->entity.type = MEDIA_ENT_T_V4L2_SUBDEV;
 
 	ret = media_entity_init(&oif_sd->entity, OIF_NUM_PADS,
-							state->oif_pads, 0);
+							state->oif_pads);
 	if (ret < 0)
 		return ret;
 
diff --git a/drivers/media/i2c/s5k4ecgx.c b/drivers/media/i2c/s5k4ecgx.c
index 97084237275d..d207ddce31b6 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,
 
 	priv->pad.flags = MEDIA_PAD_FL_SOURCE;
 	sd->entity.type = MEDIA_ENT_T_V4L2_SUBDEV_SENSOR;
-	ret = media_entity_init(&sd->entity, 1, &priv->pad, 0);
+	ret = media_entity_init(&sd->entity, 1, &priv->pad);
 	if (ret)
 		return ret;
 
diff --git a/drivers/media/i2c/s5k5baf.c b/drivers/media/i2c/s5k5baf.c
index 774e0d0c94cb..30a9ca62e034 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,
 
 	state->cis_pad.flags = MEDIA_PAD_FL_SOURCE;
 	sd->entity.type = MEDIA_ENT_T_V4L2_SUBDEV_SENSOR;
-	ret = media_entity_init(&sd->entity, NUM_CIS_PADS, &state->cis_pad, 0);
+	ret = media_entity_init(&sd->entity, NUM_CIS_PADS, &state->cis_pad);
 	if (ret < 0)
 		goto err;
 
@@ -1920,7 +1920,7 @@ static int s5k5baf_configure_subdevs(struct s5k5baf *state,
 	state->pads[PAD_CIS].flags = MEDIA_PAD_FL_SINK;
 	state->pads[PAD_OUT].flags = MEDIA_PAD_FL_SOURCE;
 	sd->entity.type = MEDIA_ENT_T_V4L2_SUBDEV;
-	ret = media_entity_init(&sd->entity, NUM_ISP_PADS, state->pads, 0);
+	ret = media_entity_init(&sd->entity, NUM_ISP_PADS, state->pads);
 
 	if (!ret)
 		return 0;
diff --git a/drivers/media/i2c/s5k6a3.c b/drivers/media/i2c/s5k6a3.c
index b1b1574dfb95..2434a7944781 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,
 	sensor->format.height = S5K6A3_DEFAULT_HEIGHT;
 
 	sensor->pad.flags = MEDIA_PAD_FL_SOURCE;
-	ret = media_entity_init(&sd->entity, 1, &sensor->pad, 0);
+	ret = media_entity_init(&sd->entity, 1, &sensor->pad);
 	if (ret < 0)
 		return ret;
 
diff --git a/drivers/media/i2c/s5k6aa.c b/drivers/media/i2c/s5k6aa.c
index d0ad6a25bdab..39a461f9d9bb 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,
 
 	s5k6aa->pad.flags = MEDIA_PAD_FL_SOURCE;
 	sd->entity.type = MEDIA_ENT_T_V4L2_SUBDEV_SENSOR;
-	ret = media_entity_init(&sd->entity, 1, &s5k6aa->pad, 0);
+	ret = media_entity_init(&sd->entity, 1, &s5k6aa->pad);
 	if (ret)
 		return ret;
 
diff --git a/drivers/media/i2c/smiapp/smiapp-core.c b/drivers/media/i2c/smiapp/smiapp-core.c
index 636ebd6fe5dc..308613ea0aed 100644
--- a/drivers/media/i2c/smiapp/smiapp-core.c
+++ b/drivers/media/i2c/smiapp/smiapp-core.c
@@ -2488,7 +2488,7 @@ static int smiapp_register_subdevs(struct smiapp_sensor *sensor)
 			continue;
 
 		rval = media_entity_init(&this->sd.entity,
-					 this->npads, this->pads, 0);
+					 this->npads, this->pads);
 		if (rval) {
 			dev_err(&client->dev,
 				"media_entity_init failed\n");
@@ -3078,7 +3078,7 @@ static int smiapp_probe(struct i2c_client *client,
 
 	sensor->src->pads[0].flags = MEDIA_PAD_FL_SOURCE;
 	rval = media_entity_init(&sensor->src->sd.entity, 2,
-				 sensor->src->pads, 0);
+				 sensor->src->pads);
 	if (rval < 0)
 		return rval;
 
diff --git a/drivers/media/i2c/tc358743.c b/drivers/media/i2c/tc358743.c
index 2e926317d7e9..6dc6c49a3622 100644
--- a/drivers/media/i2c/tc358743.c
+++ b/drivers/media/i2c/tc358743.c
@@ -1877,7 +1877,7 @@ static int tc358743_probe(struct i2c_client *client,
 	}
 
 	state->pad.flags = MEDIA_PAD_FL_SOURCE;
-	err = media_entity_init(&sd->entity, 1, &state->pad, 0);
+	err = media_entity_init(&sd->entity, 1, &state->pad);
 	if (err < 0)
 		goto err_hdl;
 
diff --git a/drivers/media/i2c/tvp514x.c b/drivers/media/i2c/tvp514x.c
index a93985a9b070..11801636d901 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)
 	decoder->sd.flags |= V4L2_SUBDEV_FL_HAS_DEVNODE;
 	decoder->sd.entity.flags |= MEDIA_ENT_T_V4L2_SUBDEV_DECODER;
 
-	ret = media_entity_init(&decoder->sd.entity, 1, &decoder->pad, 0);
+	ret = media_entity_init(&decoder->sd.entity, 1, &decoder->pad);
 	if (ret < 0) {
 		v4l2_err(sd, "%s decoder driver failed to register !!\n",
 			 sd->name);
diff --git a/drivers/media/i2c/tvp7002.c b/drivers/media/i2c/tvp7002.c
index f617d8b745ee..3630f3e2a4c7 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)
 	device->sd.flags |= V4L2_SUBDEV_FL_HAS_DEVNODE;
 	device->sd.entity.flags |= MEDIA_ENT_T_V4L2_SUBDEV_DECODER;
 
-	error = media_entity_init(&device->sd.entity, 1, &device->pad, 0);
+	error = media_entity_init(&device->sd.entity, 1, &device->pad);
 	if (error < 0)
 		return error;
 #endif
diff --git a/drivers/media/media-entity.c b/drivers/media/media-entity.c
index 4d8e01c7b1b2..78440c7aad94 100644
--- a/drivers/media/media-entity.c
+++ b/drivers/media/media-entity.c
@@ -30,7 +30,6 @@
  * media_entity_init - Initialize a media entity
  *
  * @num_pads: Total number of sink and source pads.
- * @extra_links: Initial estimate of the number of extra links.
  * @pads: Array of 'num_pads' pads.
  *
  * The total number of pads is an intrinsic property of entities known by the
@@ -52,10 +51,10 @@
  */
 int
 media_entity_init(struct media_entity *entity, u16 num_pads,
-		  struct media_pad *pads, u16 extra_links)
+		  struct media_pad *pads)
 {
 	struct media_link *links;
-	unsigned int max_links = num_pads + extra_links;
+	unsigned int max_links = num_pads;
 	unsigned int i;
 
 	links = kzalloc(max_links * sizeof(links[0]), GFP_KERNEL);
diff --git a/drivers/media/platform/exynos4-is/fimc-capture.c b/drivers/media/platform/exynos4-is/fimc-capture.c
index cfebf292e15a..0627a93b2f3b 100644
--- a/drivers/media/platform/exynos4-is/fimc-capture.c
+++ b/drivers/media/platform/exynos4-is/fimc-capture.c
@@ -1804,7 +1804,7 @@ static int fimc_register_capture_device(struct fimc_dev *fimc,
 	vid_cap->wb_fmt.code = fmt->mbus_code;
 
 	vid_cap->vd_pad.flags = MEDIA_PAD_FL_SINK;
-	ret = media_entity_init(&vfd->entity, 1, &vid_cap->vd_pad, 0);
+	ret = media_entity_init(&vfd->entity, 1, &vid_cap->vd_pad);
 	if (ret)
 		goto err_free_ctx;
 
@@ -1897,7 +1897,7 @@ int fimc_initialize_capture_subdev(struct fimc_dev *fimc)
 	fimc->vid_cap.sd_pads[FIMC_SD_PAD_SINK_FIFO].flags = MEDIA_PAD_FL_SINK;
 	fimc->vid_cap.sd_pads[FIMC_SD_PAD_SOURCE].flags = MEDIA_PAD_FL_SOURCE;
 	ret = media_entity_init(&sd->entity, FIMC_SD_PADS_NUM,
-				fimc->vid_cap.sd_pads, 0);
+				fimc->vid_cap.sd_pads);
 	if (ret)
 		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 76b6b4d14616..b7dc5ac66e36 100644
--- a/drivers/media/platform/exynos4-is/fimc-isp-video.c
+++ b/drivers/media/platform/exynos4-is/fimc-isp-video.c
@@ -618,7 +618,7 @@ int fimc_isp_video_device_register(struct fimc_isp *isp,
 	vdev->lock = &isp->video_lock;
 
 	iv->pad.flags = MEDIA_PAD_FL_SINK;
-	ret = media_entity_init(&vdev->entity, 1, &iv->pad, 0);
+	ret = media_entity_init(&vdev->entity, 1, &iv->pad);
 	if (ret < 0)
 		return ret;
 
diff --git a/drivers/media/platform/exynos4-is/fimc-isp.c b/drivers/media/platform/exynos4-is/fimc-isp.c
index 5d78f5716f3b..f52eebf765c1 100644
--- a/drivers/media/platform/exynos4-is/fimc-isp.c
+++ b/drivers/media/platform/exynos4-is/fimc-isp.c
@@ -709,7 +709,7 @@ int fimc_isp_subdev_create(struct fimc_isp *isp)
 	isp->subdev_pads[FIMC_ISP_SD_PAD_SRC_FIFO].flags = MEDIA_PAD_FL_SOURCE;
 	isp->subdev_pads[FIMC_ISP_SD_PAD_SRC_DMA].flags = MEDIA_PAD_FL_SOURCE;
 	ret = media_entity_init(&sd->entity, FIMC_ISP_SD_PADS_NUM,
-				isp->subdev_pads, 0);
+				isp->subdev_pads);
 	if (ret)
 		return ret;
 
diff --git a/drivers/media/platform/exynos4-is/fimc-lite.c b/drivers/media/platform/exynos4-is/fimc-lite.c
index ca6261a86a5f..e8f707d1729b 100644
--- a/drivers/media/platform/exynos4-is/fimc-lite.c
+++ b/drivers/media/platform/exynos4-is/fimc-lite.c
@@ -1322,7 +1322,7 @@ static int fimc_lite_subdev_registered(struct v4l2_subdev *sd)
 		return ret;
 
 	fimc->vd_pad.flags = MEDIA_PAD_FL_SINK;
-	ret = media_entity_init(&vfd->entity, 1, &fimc->vd_pad, 0);
+	ret = media_entity_init(&vfd->entity, 1, &fimc->vd_pad);
 	if (ret < 0)
 		return ret;
 
@@ -1437,7 +1437,7 @@ static int fimc_lite_create_capture_subdev(struct fimc_lite *fimc)
 	fimc->subdev_pads[FLITE_SD_PAD_SOURCE_DMA].flags = MEDIA_PAD_FL_SOURCE;
 	fimc->subdev_pads[FLITE_SD_PAD_SOURCE_ISP].flags = MEDIA_PAD_FL_SOURCE;
 	ret = media_entity_init(&sd->entity, FLITE_SD_PADS_NUM,
-				fimc->subdev_pads, 0);
+				fimc->subdev_pads);
 	if (ret)
 		return ret;
 
diff --git a/drivers/media/platform/exynos4-is/fimc-m2m.c b/drivers/media/platform/exynos4-is/fimc-m2m.c
index 0ad1b6f84a27..b57daec48b21 100644
--- a/drivers/media/platform/exynos4-is/fimc-m2m.c
+++ b/drivers/media/platform/exynos4-is/fimc-m2m.c
@@ -738,7 +738,7 @@ int fimc_register_m2m_device(struct fimc_dev *fimc,
 		return PTR_ERR(fimc->m2m.m2m_dev);
 	}
 
-	ret = media_entity_init(&vfd->entity, 0, NULL, 0);
+	ret = media_entity_init(&vfd->entity, 0, NULL);
 	if (ret)
 		goto err_me;
 
diff --git a/drivers/media/platform/exynos4-is/mipi-csis.c b/drivers/media/platform/exynos4-is/mipi-csis.c
index d74e1bec3d86..cf10cd783a86 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)
 	state->pads[CSIS_PAD_SINK].flags = MEDIA_PAD_FL_SINK;
 	state->pads[CSIS_PAD_SOURCE].flags = MEDIA_PAD_FL_SOURCE;
 	ret = media_entity_init(&state->sd.entity,
-				CSIS_PADS_NUM, state->pads, 0);
+				CSIS_PADS_NUM, state->pads);
 	if (ret < 0)
 		goto e_clkdis;
 
diff --git a/drivers/media/platform/omap3isp/ispccdc.c b/drivers/media/platform/omap3isp/ispccdc.c
index a6a61cce43dd..3b10304b580b 100644
--- a/drivers/media/platform/omap3isp/ispccdc.c
+++ b/drivers/media/platform/omap3isp/ispccdc.c
@@ -2650,7 +2650,7 @@ static int ccdc_init_entities(struct isp_ccdc_device *ccdc)
 	pads[CCDC_PAD_SOURCE_OF].flags = MEDIA_PAD_FL_SOURCE;
 
 	me->ops = &ccdc_media_ops;
-	ret = media_entity_init(me, CCDC_PADS_NUM, pads, 0);
+	ret = media_entity_init(me, CCDC_PADS_NUM, pads);
 	if (ret < 0)
 		return ret;
 
diff --git a/drivers/media/platform/omap3isp/ispccp2.c b/drivers/media/platform/omap3isp/ispccp2.c
index 38e6a974c5b1..e1b5f5bea541 100644
--- a/drivers/media/platform/omap3isp/ispccp2.c
+++ b/drivers/media/platform/omap3isp/ispccp2.c
@@ -1071,7 +1071,7 @@ static int ccp2_init_entities(struct isp_ccp2_device *ccp2)
 	pads[CCP2_PAD_SOURCE].flags = MEDIA_PAD_FL_SOURCE;
 
 	me->ops = &ccp2_media_ops;
-	ret = media_entity_init(me, CCP2_PADS_NUM, pads, 0);
+	ret = media_entity_init(me, CCP2_PADS_NUM, pads);
 	if (ret < 0)
 		return ret;
 
diff --git a/drivers/media/platform/omap3isp/ispcsi2.c b/drivers/media/platform/omap3isp/ispcsi2.c
index a78338d012b4..6fff92f0813a 100644
--- a/drivers/media/platform/omap3isp/ispcsi2.c
+++ b/drivers/media/platform/omap3isp/ispcsi2.c
@@ -1245,7 +1245,7 @@ static int csi2_init_entities(struct isp_csi2_device *csi2)
 				    | MEDIA_PAD_FL_MUST_CONNECT;
 
 	me->ops = &csi2_media_ops;
-	ret = media_entity_init(me, CSI2_PADS_NUM, pads, 0);
+	ret = media_entity_init(me, CSI2_PADS_NUM, pads);
 	if (ret < 0)
 		return ret;
 
diff --git a/drivers/media/platform/omap3isp/isppreview.c b/drivers/media/platform/omap3isp/isppreview.c
index 13803270d104..b440c6342ca4 100644
--- a/drivers/media/platform/omap3isp/isppreview.c
+++ b/drivers/media/platform/omap3isp/isppreview.c
@@ -2282,7 +2282,7 @@ static int preview_init_entities(struct isp_prev_device *prev)
 	pads[PREV_PAD_SOURCE].flags = MEDIA_PAD_FL_SOURCE;
 
 	me->ops = &preview_media_ops;
-	ret = media_entity_init(me, PREV_PADS_NUM, pads, 0);
+	ret = media_entity_init(me, PREV_PADS_NUM, pads);
 	if (ret < 0)
 		return ret;
 
diff --git a/drivers/media/platform/omap3isp/ispresizer.c b/drivers/media/platform/omap3isp/ispresizer.c
index 7cfb43dc0ffd..3deb1ec4a973 100644
--- a/drivers/media/platform/omap3isp/ispresizer.c
+++ b/drivers/media/platform/omap3isp/ispresizer.c
@@ -1728,7 +1728,7 @@ static int resizer_init_entities(struct isp_res_device *res)
 	pads[RESZ_PAD_SOURCE].flags = MEDIA_PAD_FL_SOURCE;
 
 	me->ops = &resizer_media_ops;
-	ret = media_entity_init(me, RESZ_PADS_NUM, pads, 0);
+	ret = media_entity_init(me, RESZ_PADS_NUM, pads);
 	if (ret < 0)
 		return ret;
 
diff --git a/drivers/media/platform/omap3isp/ispstat.c b/drivers/media/platform/omap3isp/ispstat.c
index 20434e83e801..92a31dd28ace 100644
--- a/drivers/media/platform/omap3isp/ispstat.c
+++ b/drivers/media/platform/omap3isp/ispstat.c
@@ -1029,7 +1029,7 @@ static int isp_stat_init_entities(struct ispstat *stat, const char *name,
 	stat->pad.flags = MEDIA_PAD_FL_SINK | MEDIA_PAD_FL_MUST_CONNECT;
 	me->ops = NULL;
 
-	return media_entity_init(me, 1, &stat->pad, 0);
+	return media_entity_init(me, 1, &stat->pad);
 }
 
 int 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 d285af18df7f..1809e52d2df9 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)
 	if (IS_ERR(video->alloc_ctx))
 		return PTR_ERR(video->alloc_ctx);
 
-	ret = media_entity_init(&video->video.entity, 1, &video->pad, 0);
+	ret = media_entity_init(&video->video.entity, 1, &video->pad);
 	if (ret < 0) {
 		vb2_dma_contig_cleanup_ctx(video->alloc_ctx);
 		return ret;
diff --git a/drivers/media/platform/s3c-camif/camif-capture.c b/drivers/media/platform/s3c-camif/camif-capture.c
index 76e6289a5612..eae667eab1b9 100644
--- a/drivers/media/platform/s3c-camif/camif-capture.c
+++ b/drivers/media/platform/s3c-camif/camif-capture.c
@@ -1159,7 +1159,7 @@ int s3c_camif_register_video_node(struct camif_dev *camif, int idx)
 		goto err_vd_rel;
 
 	vp->pad.flags = MEDIA_PAD_FL_SINK;
-	ret = media_entity_init(&vfd->entity, 1, &vp->pad, 0);
+	ret = media_entity_init(&vfd->entity, 1, &vp->pad);
 	if (ret)
 		goto err_vd_rel;
 
@@ -1575,7 +1575,7 @@ int s3c_camif_create_subdev(struct camif_dev *camif)
 	camif->pads[CAMIF_SD_PAD_SOURCE_P].flags = MEDIA_PAD_FL_SOURCE;
 
 	ret = media_entity_init(&sd->entity, CAMIF_SD_PADS_NUM,
-				camif->pads, 0);
+				camif->pads);
 	if (ret)
 		return ret;
 
diff --git a/drivers/media/platform/vsp1/vsp1_entity.c b/drivers/media/platform/vsp1/vsp1_entity.c
index fd95a75b04f4..619942ff2058 100644
--- a/drivers/media/platform/vsp1/vsp1_entity.c
+++ b/drivers/media/platform/vsp1/vsp1_entity.c
@@ -220,7 +220,7 @@ int vsp1_entity_init(struct vsp1_device *vsp1, struct vsp1_entity *entity,
 
 	/* Initialize the media entity. */
 	return media_entity_init(&entity->subdev.entity, num_pads,
-				 entity->pads, 0);
+				 entity->pads);
 }
 
 void vsp1_entity_destroy(struct vsp1_entity *entity)
diff --git a/drivers/media/platform/vsp1/vsp1_video.c b/drivers/media/platform/vsp1/vsp1_video.c
index 3c124c14ce14..17f08973f835 100644
--- a/drivers/media/platform/vsp1/vsp1_video.c
+++ b/drivers/media/platform/vsp1/vsp1_video.c
@@ -1221,7 +1221,7 @@ int vsp1_video_init(struct vsp1_video *video, struct vsp1_entity *rwpf)
 	video->pipe.state = VSP1_PIPELINE_STOPPED;
 
 	/* Initialize the media entity... */
-	ret = media_entity_init(&video->video.entity, 1, &video->pad, 0);
+	ret = media_entity_init(&video->video.entity, 1, &video->pad);
 	if (ret < 0)
 		return ret;
 
diff --git a/drivers/media/platform/xilinx/xilinx-dma.c b/drivers/media/platform/xilinx/xilinx-dma.c
index e779c93cb015..f7f9aa353a55 100644
--- a/drivers/media/platform/xilinx/xilinx-dma.c
+++ b/drivers/media/platform/xilinx/xilinx-dma.c
@@ -676,7 +676,7 @@ int xvip_dma_init(struct xvip_composite_device *xdev, struct xvip_dma *dma,
 	dma->pad.flags = type == V4L2_BUF_TYPE_VIDEO_CAPTURE
 		       ? MEDIA_PAD_FL_SINK : MEDIA_PAD_FL_SOURCE;
 
-	ret = media_entity_init(&dma->video.entity, 1, &dma->pad, 0);
+	ret = media_entity_init(&dma->video.entity, 1, &dma->pad);
 	if (ret < 0)
 		goto error;
 
diff --git a/drivers/media/platform/xilinx/xilinx-tpg.c b/drivers/media/platform/xilinx/xilinx-tpg.c
index b5f7d5ecb7f6..285976aa0f4d 100644
--- a/drivers/media/platform/xilinx/xilinx-tpg.c
+++ b/drivers/media/platform/xilinx/xilinx-tpg.c
@@ -836,7 +836,7 @@ static int xtpg_probe(struct platform_device *pdev)
 	subdev->flags |= V4L2_SUBDEV_FL_HAS_DEVNODE;
 	subdev->entity.ops = &xtpg_media_ops;
 
-	ret = media_entity_init(&subdev->entity, xtpg->npads, xtpg->pads, 0);
+	ret = media_entity_init(&subdev->entity, xtpg->npads, xtpg->pads);
 	if (ret < 0)
 		goto error;
 
diff --git a/drivers/media/usb/cx231xx/cx231xx-video.c b/drivers/media/usb/cx231xx/cx231xx-video.c
index c6ff8968286a..8f04b125486f 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)
 	cx231xx_vdev_init(dev, &dev->vdev, &cx231xx_video_template, "video");
 #if defined(CONFIG_MEDIA_CONTROLLER)
 	dev->video_pad.flags = MEDIA_PAD_FL_SINK;
-	ret = media_entity_init(&dev->vdev.entity, 1, &dev->video_pad, 0);
+	ret = media_entity_init(&dev->vdev.entity, 1, &dev->video_pad);
 	if (ret < 0)
 		dev_err(dev->dev, "failed to initialize video media entity!\n");
 #endif
@@ -2202,7 +2202,7 @@ int cx231xx_register_analog_devices(struct cx231xx *dev)
 
 #if defined(CONFIG_MEDIA_CONTROLLER)
 	dev->vbi_pad.flags = MEDIA_PAD_FL_SINK;
-	ret = media_entity_init(&dev->vbi_dev.entity, 1, &dev->vbi_pad, 0);
+	ret = media_entity_init(&dev->vbi_dev.entity, 1, &dev->vbi_pad);
 	if (ret < 0)
 		dev_err(dev->dev, "failed to initialize vbi media entity!\n");
 #endif
diff --git a/drivers/media/usb/uvc/uvc_entity.c b/drivers/media/usb/uvc/uvc_entity.c
index dc56a59ecadc..245445491516 100644
--- a/drivers/media/usb/uvc/uvc_entity.c
+++ b/drivers/media/usb/uvc/uvc_entity.c
@@ -89,10 +89,10 @@ static int uvc_mc_init_entity(struct uvc_entity *entity)
 			sizeof(entity->subdev.name));
 
 		ret = media_entity_init(&entity->subdev.entity,
-					entity->num_pads, entity->pads, 0);
+					entity->num_pads, entity->pads);
 	} else if (entity->vdev != NULL) {
 		ret = media_entity_init(&entity->vdev->entity,
-					entity->num_pads, entity->pads, 0);
+					entity->num_pads, entity->pads);
 		if (entity->flags & UVC_ENTITY_FLAG_DEFAULT)
 			entity->vdev->entity.flags |= MEDIA_ENT_FL_DEFAULT;
 	} else
diff --git a/drivers/media/v4l2-core/tuner-core.c b/drivers/media/v4l2-core/tuner-core.c
index 581e21ad6801..100b8f069640 100644
--- a/drivers/media/v4l2-core/tuner-core.c
+++ b/drivers/media/v4l2-core/tuner-core.c
@@ -699,7 +699,7 @@ register_client:
 	t->sd.entity.type = MEDIA_ENT_T_V4L2_SUBDEV_TUNER;
 	t->sd.entity.name = t->name;
 
-	ret = media_entity_init(&t->sd.entity, 1, &t->pad, 0);
+	ret = media_entity_init(&t->sd.entity, 1, &t->pad);
 	if (ret < 0) {
 		tuner_err("failed to initialize media entity!\n");
 		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 5bdfb8d5263a..34c489fed55e 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(
 	sd->flags |= V4L2_SUBDEV_FL_HAS_DEVNODE;
 	strlcpy(sd->name, config->dev_name, sizeof(sd->name));
 
-	ret = media_entity_init(&sd->entity, 0, NULL, 0);
+	ret = media_entity_init(&sd->entity, 0, NULL);
 	if (ret < 0)
 		return ERR_PTR(ret);
 
diff --git a/drivers/staging/media/davinci_vpfe/dm365_ipipe.c b/drivers/staging/media/davinci_vpfe/dm365_ipipe.c
index 1bbb90ce0086..b89a057b8b7e 100644
--- a/drivers/staging/media/davinci_vpfe/dm365_ipipe.c
+++ b/drivers/staging/media/davinci_vpfe/dm365_ipipe.c
@@ -1839,7 +1839,7 @@ vpfe_ipipe_init(struct vpfe_ipipe_device *ipipe, struct platform_device *pdev)
 	v4l2_ctrl_handler_setup(&ipipe->ctrls);
 	sd->ctrl_handler = &ipipe->ctrls;
 
-	return media_entity_init(me, IPIPE_PADS_NUM, pads, 0);
+	return media_entity_init(me, IPIPE_PADS_NUM, pads);
 }
 
 /*
diff --git a/drivers/staging/media/davinci_vpfe/dm365_ipipeif.c b/drivers/staging/media/davinci_vpfe/dm365_ipipeif.c
index 8b230541b1d1..8fb676186898 100644
--- a/drivers/staging/media/davinci_vpfe/dm365_ipipeif.c
+++ b/drivers/staging/media/davinci_vpfe/dm365_ipipeif.c
@@ -1026,7 +1026,7 @@ int vpfe_ipipeif_init(struct vpfe_ipipeif_device *ipipeif,
 	ipipeif->output = IPIPEIF_OUTPUT_NONE;
 	me->ops = &ipipeif_media_ops;
 
-	ret = media_entity_init(me, IPIPEIF_NUM_PADS, pads, 0);
+	ret = media_entity_init(me, IPIPEIF_NUM_PADS, pads);
 	if (ret)
 		goto fail;
 
diff --git a/drivers/staging/media/davinci_vpfe/dm365_isif.c b/drivers/staging/media/davinci_vpfe/dm365_isif.c
index 80907b464412..b1f01adfa7c8 100644
--- a/drivers/staging/media/davinci_vpfe/dm365_isif.c
+++ b/drivers/staging/media/davinci_vpfe/dm365_isif.c
@@ -2052,7 +2052,7 @@ int vpfe_isif_init(struct vpfe_isif_device *isif, struct platform_device *pdev)
 	isif->input = ISIF_INPUT_NONE;
 	isif->output = ISIF_OUTPUT_NONE;
 	me->ops = &isif_media_ops;
-	status = media_entity_init(me, ISIF_PADS_NUM, pads, 0);
+	status = media_entity_init(me, ISIF_PADS_NUM, pads);
 	if (status)
 		goto isif_fail;
 	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 acb293ed9c91..692789aa22f4 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,
 	vpfe_rsz->crop_resizer.output2 = RESIZER_CROP_OUTPUT_NONE;
 	vpfe_rsz->crop_resizer.rsz_device = vpfe_rsz;
 	me->ops = &resizer_media_ops;
-	ret = media_entity_init(me, RESIZER_CROP_PADS_NUM, pads, 0);
+	ret = media_entity_init(me, RESIZER_CROP_PADS_NUM, pads);
 	if (ret)
 		return ret;
 
@@ -1937,7 +1937,7 @@ int vpfe_resizer_init(struct vpfe_resizer_device *vpfe_rsz,
 	vpfe_rsz->resizer_a.output = RESIZER_OUTPUT_NONE;
 	vpfe_rsz->resizer_a.rsz_device = vpfe_rsz;
 	me->ops = &resizer_media_ops;
-	ret = media_entity_init(me, RESIZER_PADS_NUM, pads, 0);
+	ret = media_entity_init(me, RESIZER_PADS_NUM, pads);
 	if (ret)
 		return ret;
 
@@ -1959,7 +1959,7 @@ int vpfe_resizer_init(struct vpfe_resizer_device *vpfe_rsz,
 	vpfe_rsz->resizer_b.output = RESIZER_OUTPUT_NONE;
 	vpfe_rsz->resizer_b.rsz_device = vpfe_rsz;
 	me->ops = &resizer_media_ops;
-	ret = media_entity_init(me, RESIZER_PADS_NUM, pads, 0);
+	ret = media_entity_init(me, RESIZER_PADS_NUM, pads);
 	if (ret)
 		return ret;
 
diff --git a/drivers/staging/media/davinci_vpfe/vpfe_video.c b/drivers/staging/media/davinci_vpfe/vpfe_video.c
index 87048a14c34d..61a8d5beff58 100644
--- a/drivers/staging/media/davinci_vpfe/vpfe_video.c
+++ b/drivers/staging/media/davinci_vpfe/vpfe_video.c
@@ -1594,7 +1594,7 @@ int vpfe_video_init(struct vpfe_video_device *video, const char *name)
 	spin_lock_init(&video->dma_queue_lock);
 	mutex_init(&video->lock);
 	ret = media_entity_init(&video->video_dev.entity,
-				1, &video->pad, 0);
+				1, &video->pad);
 	if (ret < 0)
 		return ret;
 
diff --git a/drivers/staging/media/omap4iss/iss_csi2.c b/drivers/staging/media/omap4iss/iss_csi2.c
index bc83f8246101..e936cfc218cb 100644
--- a/drivers/staging/media/omap4iss/iss_csi2.c
+++ b/drivers/staging/media/omap4iss/iss_csi2.c
@@ -1271,7 +1271,7 @@ static int csi2_init_entities(struct iss_csi2_device *csi2, const char *subname)
 	pads[CSI2_PAD_SINK].flags = MEDIA_PAD_FL_SINK;
 
 	me->ops = &csi2_media_ops;
-	ret = media_entity_init(me, CSI2_PADS_NUM, pads, 0);
+	ret = media_entity_init(me, CSI2_PADS_NUM, pads);
 	if (ret < 0)
 		return ret;
 
diff --git a/drivers/staging/media/omap4iss/iss_ipipe.c b/drivers/staging/media/omap4iss/iss_ipipe.c
index f94a59299a83..e1a7b7ba7362 100644
--- a/drivers/staging/media/omap4iss/iss_ipipe.c
+++ b/drivers/staging/media/omap4iss/iss_ipipe.c
@@ -513,7 +513,7 @@ static int ipipe_init_entities(struct iss_ipipe_device *ipipe)
 	pads[IPIPE_PAD_SOURCE_VP].flags = MEDIA_PAD_FL_SOURCE;
 
 	me->ops = &ipipe_media_ops;
-	ret = media_entity_init(me, IPIPE_PADS_NUM, pads, 0);
+	ret = media_entity_init(me, IPIPE_PADS_NUM, pads);
 	if (ret < 0)
 		return ret;
 
diff --git a/drivers/staging/media/omap4iss/iss_ipipeif.c b/drivers/staging/media/omap4iss/iss_ipipeif.c
index c0da13d55865..be5f80d7b5dc 100644
--- a/drivers/staging/media/omap4iss/iss_ipipeif.c
+++ b/drivers/staging/media/omap4iss/iss_ipipeif.c
@@ -743,7 +743,7 @@ static int ipipeif_init_entities(struct iss_ipipeif_device *ipipeif)
 	pads[IPIPEIF_PAD_SOURCE_VP].flags = MEDIA_PAD_FL_SOURCE;
 
 	me->ops = &ipipeif_media_ops;
-	ret = media_entity_init(me, IPIPEIF_PADS_NUM, pads, 0);
+	ret = media_entity_init(me, IPIPEIF_PADS_NUM, pads);
 	if (ret < 0)
 		return ret;
 
diff --git a/drivers/staging/media/omap4iss/iss_resizer.c b/drivers/staging/media/omap4iss/iss_resizer.c
index 5030cf3cd34c..91e724085dba 100644
--- a/drivers/staging/media/omap4iss/iss_resizer.c
+++ b/drivers/staging/media/omap4iss/iss_resizer.c
@@ -787,7 +787,7 @@ static int resizer_init_entities(struct iss_resizer_device *resizer)
 	pads[RESIZER_PAD_SOURCE_MEM].flags = MEDIA_PAD_FL_SOURCE;
 
 	me->ops = &resizer_media_ops;
-	ret = media_entity_init(me, RESIZER_PADS_NUM, pads, 0);
+	ret = media_entity_init(me, RESIZER_PADS_NUM, pads);
 	if (ret < 0)
 		return ret;
 
diff --git a/drivers/staging/media/omap4iss/iss_video.c b/drivers/staging/media/omap4iss/iss_video.c
index 40405d8710a6..bae67742706f 100644
--- a/drivers/staging/media/omap4iss/iss_video.c
+++ b/drivers/staging/media/omap4iss/iss_video.c
@@ -1104,7 +1104,7 @@ int omap4iss_video_init(struct iss_video *video, const char *name)
 		return -EINVAL;
 	}
 
-	ret = media_entity_init(&video->video.entity, 1, &video->pad, 0);
+	ret = media_entity_init(&video->video.entity, 1, &video->pad);
 	if (ret < 0)
 		return ret;
 
diff --git a/include/media/media-entity.h b/include/media/media-entity.h
index 0c003d817493..8b21a4d920d9 100644
--- a/include/media/media-entity.h
+++ b/include/media/media-entity.h
@@ -127,7 +127,7 @@ struct media_entity_graph {
 };
 
 int media_entity_init(struct media_entity *entity, u16 num_pads,
-		struct media_pad *pads, u16 extra_links);
+		struct media_pad *pads);
 void media_entity_cleanup(struct media_entity *entity);
 
 int media_entity_create_link(struct media_entity *source, u16 source_pad,
-- 
2.4.3


^ permalink raw reply related	[flat|nested] 27+ messages in thread

* [PATCH v4 2/6] media: create a macro to get entity ID
  2015-08-14 14:56 [PATCH v4 0/6] MC preparation patches Mauro Carvalho Chehab
  2015-08-14 14:56 ` [PATCH v4 1/6] media: get rid of unused "extra_links" param on media_entity_init() Mauro Carvalho Chehab
@ 2015-08-14 14:56 ` Mauro Carvalho Chehab
  2015-08-14 15:02   ` Hans Verkuil
  2015-08-14 21:08   ` Sakari Ailus
  2015-08-14 14:56 ` [PATCH v4 3/6] media: add a common struct to be embed on media graph objects Mauro Carvalho Chehab
                   ` (4 subsequent siblings)
  6 siblings, 2 replies; 27+ messages in thread
From: Mauro Carvalho Chehab @ 2015-08-14 14:56 UTC (permalink / raw)
  To: Linux Media Mailing List
  Cc: Mauro Carvalho Chehab, Mauro Carvalho Chehab, Laurent Pinchart,
	linux-sh

Instead of accessing direcly entity.id, let's create a macro,
as this field will be moved into a common struct later on.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>

diff --git a/drivers/media/media-device.c b/drivers/media/media-device.c
index 7b39440192d6..b9382f06044a 100644
--- a/drivers/media/media-device.c
+++ b/drivers/media/media-device.c
@@ -75,8 +75,8 @@ static struct media_entity *find_entity(struct media_device *mdev, u32 id)
 	spin_lock(&mdev->lock);
 
 	media_device_for_each_entity(entity, mdev) {
-		if ((entity->id == id && !next) ||
-		    (entity->id > id && next)) {
+		if (((entity_id(entity) == id) && !next) ||
+		    ((entity_id(entity) > id) && next)) {
 			spin_unlock(&mdev->lock);
 			return entity;
 		}
@@ -102,7 +102,7 @@ static long media_device_enum_entities(struct media_device *mdev,
 	if (ent == NULL)
 		return -EINVAL;
 
-	u_ent.id = ent->id;
+	u_ent.id = entity_id(ent);
 	if (ent->name)
 		strlcpy(u_ent.name, ent->name, sizeof(u_ent.name));
 	u_ent.type = ent->type;
@@ -120,7 +120,7 @@ static long media_device_enum_entities(struct media_device *mdev,
 static void media_device_kpad_to_upad(const struct media_pad *kpad,
 				      struct media_pad_desc *upad)
 {
-	upad->entity = kpad->entity->id;
+	upad->entity = entity_id(kpad->entity);
 	upad->index = kpad->index;
 	upad->flags = kpad->flags;
 }
diff --git a/drivers/media/media-entity.c b/drivers/media/media-entity.c
index 78440c7aad94..b8102bda664d 100644
--- a/drivers/media/media-entity.c
+++ b/drivers/media/media-entity.c
@@ -141,10 +141,10 @@ void media_entity_graph_walk_start(struct media_entity_graph *graph,
 	graph->stack[graph->top].entity = NULL;
 	bitmap_zero(graph->entities, MEDIA_ENTITY_ENUM_MAX_ID);
 
-	if (WARN_ON(entity->id >= MEDIA_ENTITY_ENUM_MAX_ID))
+	if (WARN_ON(entity_id(entity) >= MEDIA_ENTITY_ENUM_MAX_ID))
 		return;
 
-	__set_bit(entity->id, graph->entities);
+	__set_bit(entity_id(entity), graph->entities);
 	stack_push(graph, entity);
 }
 EXPORT_SYMBOL_GPL(media_entity_graph_walk_start);
@@ -185,11 +185,11 @@ media_entity_graph_walk_next(struct media_entity_graph *graph)
 
 		/* Get the entity in the other end of the link . */
 		next = media_entity_other(entity, link);
-		if (WARN_ON(next->id >= MEDIA_ENTITY_ENUM_MAX_ID))
+		if (WARN_ON(entity_id(next) >= MEDIA_ENTITY_ENUM_MAX_ID))
 			return NULL;
 
 		/* Has the entity already been visited? */
-		if (__test_and_set_bit(next->id, graph->entities)) {
+		if (__test_and_set_bit(entity_id(next), graph->entities)) {
 			link_top(graph)++;
 			continue;
 		}
diff --git a/drivers/media/platform/vsp1/vsp1_video.c b/drivers/media/platform/vsp1/vsp1_video.c
index 17f08973f835..01bc3c48a2b4 100644
--- a/drivers/media/platform/vsp1/vsp1_video.c
+++ b/drivers/media/platform/vsp1/vsp1_video.c
@@ -352,10 +352,10 @@ static int vsp1_pipeline_validate_branch(struct vsp1_pipeline *pipe,
 			break;
 
 		/* Ensure the branch has no loop. */
-		if (entities & (1 << entity->subdev.entity.id))
+		if (entities & (1 << entity_id(&entity->subdev.entity)))
 			return -EPIPE;
 
-		entities |= 1 << entity->subdev.entity.id;
+		entities |= 1 << entity_id(&entity->subdev.entity);
 
 		/* UDS can't be chained. */
 		if (entity->type == VSP1_ENTITY_UDS) {
diff --git a/include/media/media-entity.h b/include/media/media-entity.h
index 8b21a4d920d9..478d5cd56be9 100644
--- a/include/media/media-entity.h
+++ b/include/media/media-entity.h
@@ -126,6 +126,8 @@ struct media_entity_graph {
 	int top;
 };
 
+#define entity_id(entity) ((entity)->id)
+
 int media_entity_init(struct media_entity *entity, u16 num_pads,
 		struct media_pad *pads);
 void media_entity_cleanup(struct media_entity *entity);
-- 
2.4.3


^ permalink raw reply related	[flat|nested] 27+ messages in thread

* [PATCH v4 3/6] media: add a common struct to be embed on media graph objects
  2015-08-14 14:56 [PATCH v4 0/6] MC preparation patches Mauro Carvalho Chehab
  2015-08-14 14:56 ` [PATCH v4 1/6] media: get rid of unused "extra_links" param on media_entity_init() Mauro Carvalho Chehab
  2015-08-14 14:56 ` [PATCH v4 2/6] media: create a macro to get entity ID Mauro Carvalho Chehab
@ 2015-08-14 14:56 ` Mauro Carvalho Chehab
  2015-08-14 15:03   ` Hans Verkuil
  2015-08-14 21:25   ` Sakari Ailus
  2015-08-14 14:56 ` [PATCH v4 4/6] media: use media_graph_obj inside entities Mauro Carvalho Chehab
                   ` (3 subsequent siblings)
  6 siblings, 2 replies; 27+ messages in thread
From: Mauro Carvalho Chehab @ 2015-08-14 14:56 UTC (permalink / raw)
  To: Linux Media Mailing List; +Cc: Mauro Carvalho Chehab, Mauro Carvalho Chehab

Due to the MC API proposed changes, we'll need to have an unique
object ID for all graph objects, and have some shared fields
that will be common on all media graph objects.

Right now, the only common object is the object ID, but other
fields will be added latter on.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>

diff --git a/drivers/media/media-entity.c b/drivers/media/media-entity.c
index b8102bda664d..046f1fe40b50 100644
--- a/drivers/media/media-entity.c
+++ b/drivers/media/media-entity.c
@@ -27,6 +27,39 @@
 #include <media/media-device.h>
 
 /**
+ *  graph_obj_init - Initialize a graph object
+ *
+ * @mdev:	Pointer to the media_device that contains the object
+ * @type:	Type of the object
+ * @gobj:	Pointer to the object
+ *
+ * This routine initializes the embedded struct media_graph_obj inside a
+ * media graph object. It is called automatically if media_*_create()
+ * calls are used. However, if the object (entity, link, pad, interface)
+ * is embedded on some other object, this function should be called before
+ * registering the object at the media controller.
+ */
+void graph_obj_init(struct media_device *mdev,
+			   enum media_graph_type type,
+			   struct media_graph_obj *gobj)
+{
+	/* An unique object ID will be provided on next patches */
+	gobj->id = type << 24;
+}
+
+/**
+ *  graph_obj_remove - Stop using a graph object on a media device
+ *
+ * @graph_obj:	Pointer to the object
+ *
+ * This should be called at media_device_unregister_*() routines
+ */
+void graph_obj_remove(struct media_graph_obj *gobj)
+{
+	/* For now, nothing to do */
+}
+
+/**
  * media_entity_init - Initialize a media entity
  *
  * @num_pads: Total number of sink and source pads.
diff --git a/include/media/media-entity.h b/include/media/media-entity.h
index 478d5cd56be9..58938bb980fe 100644
--- a/include/media/media-entity.h
+++ b/include/media/media-entity.h
@@ -28,6 +28,33 @@
 #include <linux/list.h>
 #include <linux/media.h>
 
+/* Enums used internally at the media controller to represent graphs */
+
+/**
+ * enum media_graph_type - type of a graph element
+ *
+ */
+enum media_graph_type {
+	 /* FIXME: add the types here, as we embeed media_graph_obj */
+	MEDIA_GRAPH_NONE
+};
+
+
+/* Structs to represent the objects that belong to a media graph */
+
+/**
+ * struct media_graph_obj - Define a graph object.
+ *
+ * @id:		Non-zero object ID identifier. The ID should be unique
+ *		inside a media_device
+ *
+ * All elements on the media graph should have this struct embedded
+ */
+struct media_graph_obj {
+	u32			id;
+};
+
+
 struct media_pipeline {
 };
 
@@ -128,6 +155,14 @@ struct media_entity_graph {
 
 #define entity_id(entity) ((entity)->id)
 
+#define gobj_to_entity(gobj) \
+		container_of(gobj, struct media_entity, graph_obj)
+
+void graph_obj_init(struct media_device *mdev,
+		    enum media_graph_type type,
+		    struct media_graph_obj *gobj);
+void graph_obj_remove(struct media_graph_obj *gobj);
+
 int media_entity_init(struct media_entity *entity, u16 num_pads,
 		struct media_pad *pads);
 void media_entity_cleanup(struct media_entity *entity);
-- 
2.4.3


^ permalink raw reply related	[flat|nested] 27+ messages in thread

* [PATCH v4 4/6] media: use media_graph_obj inside entities
  2015-08-14 14:56 [PATCH v4 0/6] MC preparation patches Mauro Carvalho Chehab
                   ` (2 preceding siblings ...)
  2015-08-14 14:56 ` [PATCH v4 3/6] media: add a common struct to be embed on media graph objects Mauro Carvalho Chehab
@ 2015-08-14 14:56 ` Mauro Carvalho Chehab
  2015-08-14 15:07   ` Hans Verkuil
  2015-08-14 22:12   ` Sakari Ailus
  2015-08-14 14:56 ` [PATCH v4 5/6] media: use media_graph_obj inside pads Mauro Carvalho Chehab
                   ` (2 subsequent siblings)
  6 siblings, 2 replies; 27+ messages in thread
From: Mauro Carvalho Chehab @ 2015-08-14 14:56 UTC (permalink / raw)
  To: Linux Media Mailing List; +Cc: Mauro Carvalho Chehab, Mauro Carvalho Chehab

As entities are graph elements, let's embeed media_graph_obj
on it. That ensures an unique ID for entities that can be
global along the entire media controller.

For now, we'll keep the already existing entity ID. Such
field need to be dropped on some point, but for now, let's
not do this, to avoid needing to review all drivers and
the userspace apps.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>

diff --git a/drivers/media/media-device.c b/drivers/media/media-device.c
index b9382f06044a..f06b08392007 100644
--- a/drivers/media/media-device.c
+++ b/drivers/media/media-device.c
@@ -377,7 +377,6 @@ int __must_check __media_device_register(struct media_device *mdev,
 	if (WARN_ON(mdev->dev == NULL || mdev->model[0] == 0))
 		return -EINVAL;
 
-	mdev->entity_id = 1;
 	INIT_LIST_HEAD(&mdev->entities);
 	spin_lock_init(&mdev->lock);
 	mutex_init(&mdev->graph_mutex);
@@ -431,11 +430,9 @@ int __must_check media_device_register_entity(struct media_device *mdev,
 	entity->parent = mdev;
 
 	spin_lock(&mdev->lock);
-	if (entity->id == 0)
-		entity->id = mdev->entity_id++;
-	else
-		mdev->entity_id = max(entity->id + 1, mdev->entity_id);
-	list_add_tail(&entity->list, &mdev->entities);
+	/* Initialize media_graph_obj embedded at the entity */
+	graph_obj_init(mdev, MEDIA_GRAPH_ENTITY, &entity->graph_obj);
+
 	spin_unlock(&mdev->lock);
 
 	return 0;
@@ -457,6 +454,7 @@ void media_device_unregister_entity(struct media_entity *entity)
 		return;
 
 	spin_lock(&mdev->lock);
+	graph_obj_remove(&entity->graph_obj);
 	list_del(&entity->list);
 	spin_unlock(&mdev->lock);
 	entity->parent = NULL;
diff --git a/drivers/media/media-entity.c b/drivers/media/media-entity.c
index 046f1fe40b50..c06546509a89 100644
--- a/drivers/media/media-entity.c
+++ b/drivers/media/media-entity.c
@@ -43,8 +43,12 @@ void graph_obj_init(struct media_device *mdev,
 			   enum media_graph_type type,
 			   struct media_graph_obj *gobj)
 {
-	/* An unique object ID will be provided on next patches */
+	/* Create a per-type unique object ID */
 	gobj->id = type << 24;
+	switch (type) {
+	case MEDIA_GRAPH_ENTITY:
+		gobj->id |= ++mdev->entity_id;
+	}
 }
 
 /**
diff --git a/include/media/media-device.h b/include/media/media-device.h
index 6e6db78f1ee2..35634c0da362 100644
--- a/include/media/media-device.h
+++ b/include/media/media-device.h
@@ -41,7 +41,7 @@ struct device;
  * @bus_info:	Unique and stable device location identifier
  * @hw_revision: Hardware device revision
  * @driver_version: Device driver version
- * @entity_id:	ID of the next entity to be registered
+ * @entity_id:	Unique ID used on the last entity registered
  * @entities:	List of registered entities
  * @lock:	Entities list lock
  * @graph_mutex: Entities graph operation lock
@@ -68,7 +68,9 @@ struct media_device {
 	u32 hw_revision;
 	u32 driver_version;
 
+	/* Unique object ID counter */
 	u32 entity_id;
+
 	struct list_head entities;
 
 	/* Protects the entities list */
diff --git a/include/media/media-entity.h b/include/media/media-entity.h
index 58938bb980fe..2c775f3ef24f 100644
--- a/include/media/media-entity.h
+++ b/include/media/media-entity.h
@@ -33,10 +33,10 @@
 /**
  * enum media_graph_type - type of a graph element
  *
+ * @MEDIA_GRAPH_ENTITY:		Identify a media entity
  */
 enum media_graph_type {
-	 /* FIXME: add the types here, as we embeed media_graph_obj */
-	MEDIA_GRAPH_NONE
+	MEDIA_GRAPH_ENTITY,
 };
 
 
@@ -88,10 +88,9 @@ struct media_entity_operations {
 };
 
 struct media_entity {
+	struct media_graph_obj graph_obj;
 	struct list_head list;
 	struct media_device *parent;	/* Media device this entity belongs to*/
-	u32 id;				/* Entity ID, unique in the parent media
-					 * device context */
 	const char *name;		/* Entity name */
 	u32 type;			/* Entity type (MEDIA_ENT_T_*) */
 	u32 revision;			/* Entity revision, driver specific */
@@ -153,7 +152,7 @@ struct media_entity_graph {
 	int top;
 };
 
-#define entity_id(entity) ((entity)->id)
+#define entity_id(entity) ((entity)->graph_obj.id)
 
 #define gobj_to_entity(gobj) \
 		container_of(gobj, struct media_entity, graph_obj)
-- 
2.4.3


^ permalink raw reply related	[flat|nested] 27+ messages in thread

* [PATCH v4 5/6] media: use media_graph_obj inside pads
  2015-08-14 14:56 [PATCH v4 0/6] MC preparation patches Mauro Carvalho Chehab
                   ` (3 preceding siblings ...)
  2015-08-14 14:56 ` [PATCH v4 4/6] media: use media_graph_obj inside entities Mauro Carvalho Chehab
@ 2015-08-14 14:56 ` Mauro Carvalho Chehab
  2015-08-14 15:10   ` Hans Verkuil
  2015-08-14 22:15   ` Sakari Ailus
  2015-08-14 14:56 ` [PATCH v4 6/6] media: use media_graph_obj inside links Mauro Carvalho Chehab
  2015-08-14 22:37 ` [PATCH v4 0/6] MC preparation patches Sakari Ailus
  6 siblings, 2 replies; 27+ messages in thread
From: Mauro Carvalho Chehab @ 2015-08-14 14:56 UTC (permalink / raw)
  To: Linux Media Mailing List; +Cc: Mauro Carvalho Chehab, Mauro Carvalho Chehab

PADs also need unique object IDs that won't conflict with
the entity object IDs.

The pad objects are currently created via media_entity_init()
and, once created, never change.

While this will likely change in the future in order to
suppory dynamic changes, for now we'll keep PADs as arrays
and initialize the media_graph_obj embeeded structs when
registering the entity.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>

diff --git a/drivers/media/media-device.c b/drivers/media/media-device.c
index f06b08392007..3ac5803b327e 100644
--- a/drivers/media/media-device.c
+++ b/drivers/media/media-device.c
@@ -425,6 +425,8 @@ EXPORT_SYMBOL_GPL(media_device_unregister);
 int __must_check media_device_register_entity(struct media_device *mdev,
 					      struct media_entity *entity)
 {
+	int i;
+
 	/* Warn if we apparently re-register an entity */
 	WARN_ON(entity->parent != NULL);
 	entity->parent = mdev;
@@ -433,6 +435,12 @@ int __must_check media_device_register_entity(struct media_device *mdev,
 	/* Initialize media_graph_obj embedded at the entity */
 	graph_obj_init(mdev, MEDIA_GRAPH_ENTITY, &entity->graph_obj);
 
+	/* Initialize objects at the pads */
+	for (i = 0; i < entity->num_pads; i++)
+		graph_obj_init(mdev, MEDIA_GRAPH_PAD,
+			       &entity->pads[i].graph_obj);
+
+	list_add_tail(&entity->list, &mdev->entities);
 	spin_unlock(&mdev->lock);
 
 	return 0;
@@ -448,6 +456,7 @@ EXPORT_SYMBOL_GPL(media_device_register_entity);
  */
 void media_device_unregister_entity(struct media_entity *entity)
 {
+	int i;
 	struct media_device *mdev = entity->parent;
 
 	if (mdev == NULL)
@@ -455,6 +464,8 @@ void media_device_unregister_entity(struct media_entity *entity)
 
 	spin_lock(&mdev->lock);
 	graph_obj_remove(&entity->graph_obj);
+	for (i = 0; i < entity->num_pads; i++)
+		graph_obj_remove(&entity->pads[i].graph_obj);
 	list_del(&entity->list);
 	spin_unlock(&mdev->lock);
 	entity->parent = NULL;
diff --git a/drivers/media/media-entity.c b/drivers/media/media-entity.c
index c06546509a89..d3dee6fc79d7 100644
--- a/drivers/media/media-entity.c
+++ b/drivers/media/media-entity.c
@@ -48,6 +48,8 @@ void graph_obj_init(struct media_device *mdev,
 	switch (type) {
 	case MEDIA_GRAPH_ENTITY:
 		gobj->id |= ++mdev->entity_id;
+	case MEDIA_GRAPH_PAD:
+		gobj->id |= ++mdev->pad_id;
 	}
 }
 
diff --git a/include/media/media-device.h b/include/media/media-device.h
index 35634c0da362..2a9d9260cccc 100644
--- a/include/media/media-device.h
+++ b/include/media/media-device.h
@@ -42,6 +42,7 @@ struct device;
  * @hw_revision: Hardware device revision
  * @driver_version: Device driver version
  * @entity_id:	Unique ID used on the last entity registered
+ * @pad_id:	Unique ID used on the last pad registered
  * @entities:	List of registered entities
  * @lock:	Entities list lock
  * @graph_mutex: Entities graph operation lock
@@ -70,6 +71,7 @@ struct media_device {
 
 	/* Unique object ID counter */
 	u32 entity_id;
+	u32 pad_id;
 
 	struct list_head entities;
 
diff --git a/include/media/media-entity.h b/include/media/media-entity.h
index 2c775f3ef24f..936f68f27bba 100644
--- a/include/media/media-entity.h
+++ b/include/media/media-entity.h
@@ -34,9 +34,11 @@
  * enum media_graph_type - type of a graph element
  *
  * @MEDIA_GRAPH_ENTITY:		Identify a media entity
+ * @MEDIA_GRAPH_PAD:		Identify a media pad
  */
 enum media_graph_type {
 	MEDIA_GRAPH_ENTITY,
+	MEDIA_GRAPH_PAD,
 };
 
 
@@ -66,6 +68,7 @@ struct media_link {
 };
 
 struct media_pad {
+	struct media_graph_obj graph_obj;
 	struct media_entity *entity;	/* Entity this pad belongs to */
 	u16 index;			/* Pad index in the entity pads array */
 	unsigned long flags;		/* Pad flags (MEDIA_PAD_FL_*) */
-- 
2.4.3


^ permalink raw reply related	[flat|nested] 27+ messages in thread

* [PATCH v4 6/6] media: use media_graph_obj inside links
  2015-08-14 14:56 [PATCH v4 0/6] MC preparation patches Mauro Carvalho Chehab
                   ` (4 preceding siblings ...)
  2015-08-14 14:56 ` [PATCH v4 5/6] media: use media_graph_obj inside pads Mauro Carvalho Chehab
@ 2015-08-14 14:56 ` Mauro Carvalho Chehab
  2015-08-14 15:18   ` Hans Verkuil
  2015-08-14 22:37 ` [PATCH v4 0/6] MC preparation patches Sakari Ailus
  6 siblings, 1 reply; 27+ messages in thread
From: Mauro Carvalho Chehab @ 2015-08-14 14:56 UTC (permalink / raw)
  To: Linux Media Mailing List; +Cc: Mauro Carvalho Chehab, Mauro Carvalho Chehab

Just like entities and pads, links also need to have unique
Object IDs along a given media controller.

So, let's add a media_graph_obj inside it and initialize
the object then a new link is created.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>

diff --git a/drivers/media/media-device.c b/drivers/media/media-device.c
index 3ac5803b327e..9f02939c2864 100644
--- a/drivers/media/media-device.c
+++ b/drivers/media/media-device.c
@@ -466,6 +466,8 @@ void media_device_unregister_entity(struct media_entity *entity)
 	graph_obj_remove(&entity->graph_obj);
 	for (i = 0; i < entity->num_pads; i++)
 		graph_obj_remove(&entity->pads[i].graph_obj);
+	for (i = 0; entity->num_links; i++)
+		graph_obj_remove(&entity->links[i].graph_obj);
 	list_del(&entity->list);
 	spin_unlock(&mdev->lock);
 	entity->parent = NULL;
diff --git a/drivers/media/media-entity.c b/drivers/media/media-entity.c
index d3dee6fc79d7..4f18bd10b162 100644
--- a/drivers/media/media-entity.c
+++ b/drivers/media/media-entity.c
@@ -50,6 +50,8 @@ void graph_obj_init(struct media_device *mdev,
 		gobj->id |= ++mdev->entity_id;
 	case MEDIA_GRAPH_PAD:
 		gobj->id |= ++mdev->pad_id;
+	case MEDIA_GRAPH_LINK:
+		gobj->id |= ++mdev->pad_id;
 	}
 }
 
@@ -469,6 +471,10 @@ static struct media_link *media_entity_add_link(struct media_entity *entity)
 		entity->links = links;
 	}
 
+	/* Initialize graph object embedded at the new link */
+	graph_obj_init(entity->parent, MEDIA_GRAPH_LINK,
+			&entity->links[entity->num_links].graph_obj);
+
 	return &entity->links[entity->num_links++];
 }
 
diff --git a/include/media/media-device.h b/include/media/media-device.h
index 2a9d9260cccc..2d9a050d46f7 100644
--- a/include/media/media-device.h
+++ b/include/media/media-device.h
@@ -43,6 +43,7 @@ struct device;
  * @driver_version: Device driver version
  * @entity_id:	Unique ID used on the last entity registered
  * @pad_id:	Unique ID used on the last pad registered
+ * @link_id:	Unique ID used on the last link registered
  * @entities:	List of registered entities
  * @lock:	Entities list lock
  * @graph_mutex: Entities graph operation lock
@@ -72,6 +73,7 @@ struct media_device {
 	/* Unique object ID counter */
 	u32 entity_id;
 	u32 pad_id;
+	u32 link_id;
 
 	struct list_head entities;
 
diff --git a/include/media/media-entity.h b/include/media/media-entity.h
index 936f68f27bba..30eaae47d72e 100644
--- a/include/media/media-entity.h
+++ b/include/media/media-entity.h
@@ -35,10 +35,12 @@
  *
  * @MEDIA_GRAPH_ENTITY:		Identify a media entity
  * @MEDIA_GRAPH_PAD:		Identify a media pad
+ * @MEDIA_GRAPH_LINK:		Identify a media link
  */
 enum media_graph_type {
 	MEDIA_GRAPH_ENTITY,
 	MEDIA_GRAPH_PAD,
+	MEDIA_GRAPH_LINK,
 };
 
 
@@ -61,6 +63,7 @@ struct media_pipeline {
 };
 
 struct media_link {
+	struct media_graph_obj graph_obj;
 	struct media_pad *source;	/* Source pad */
 	struct media_pad *sink;		/* Sink pad  */
 	struct media_link *reverse;	/* Link in the reverse direction */
-- 
2.4.3


^ permalink raw reply related	[flat|nested] 27+ messages in thread

* Re: [PATCH v4 1/6] media: get rid of unused "extra_links" param on media_entity_init()
  2015-08-14 14:56 ` [PATCH v4 1/6] media: get rid of unused "extra_links" param on media_entity_init() Mauro Carvalho Chehab
@ 2015-08-14 14:59   ` Hans Verkuil
  2015-08-14 15:16   ` Laurent Pinchart
  1 sibling, 0 replies; 27+ messages in thread
From: Hans Verkuil @ 2015-08-14 14:59 UTC (permalink / raw)
  To: Mauro Carvalho Chehab, Linux Media Mailing List
  Cc: Mauro Carvalho Chehab, Jonathan Corbet, Harry Wei, Hans Verkuil,
	Sakari Ailus, Lars-Peter Clausen, Laurent Pinchart, Kyungmin Park,
	Heungjun Kim, Prabhakar Lad, Andrzej Hajda, Mats Randgaard,
	Sylwester Nawrocki, Kukjin Kim, Krzysztof Kozlowski, Hyun Kwon,
	Michal Simek, Sören Brinkmann, Greg Kroah-Hartman,
	Joe Perches, Boris BREZILLON, Javier Martinez Canillas,
	Guennadi Liakhovetski, Ricardo Ribalda Delgado, Axel Lin,
	Scott Jiang, Bryan Wu, Jacek Anaszewski, Aya Mahfouz,
	Haneen Mohammed, Tapasweni Pathak, anuvazhayil, Mahati Chamarthy,
	Navya Sri Nizamkari, linux-doc, linux-kernel, linux-arm-kernel,
	linux-samsung-soc, linux-sh, devel

On 08/14/2015 04:56 PM, Mauro Carvalho Chehab wrote:
> Currently, media_entity_init() creates an array with the links,
> allocated at init time. It provides a parameter (extra_links)
> that would allocate more links than the current needs, but this
> is not used by any driver.
> 
> As we want to be able to do dynamic link allocation/removal,
> we'll need to change the implementation of the links. So,
> before doing that, let's first remove that extra unused
> parameter, in order to cleanup the interface first.
> 
> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
> Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>

Acked-by: Hans Verkuil <hans.verkuil@cisco.com>

Thanks!

	Hans

^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [PATCH v4 2/6] media: create a macro to get entity ID
  2015-08-14 14:56 ` [PATCH v4 2/6] media: create a macro to get entity ID Mauro Carvalho Chehab
@ 2015-08-14 15:02   ` Hans Verkuil
  2015-08-14 21:08   ` Sakari Ailus
  1 sibling, 0 replies; 27+ messages in thread
From: Hans Verkuil @ 2015-08-14 15:02 UTC (permalink / raw)
  To: Mauro Carvalho Chehab, Linux Media Mailing List
  Cc: Mauro Carvalho Chehab, Laurent Pinchart, linux-sh

On 08/14/2015 04:56 PM, Mauro Carvalho Chehab wrote:
> Instead of accessing direcly entity.id, let's create a macro,

s/direcly/directly/

> as this field will be moved into a common struct later on.
> 
> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>

Acked-by: Hans Verkuil <hans.verkuil@cisco.com>

Regards,

	Hans

> 
> diff --git a/drivers/media/media-device.c b/drivers/media/media-device.c
> index 7b39440192d6..b9382f06044a 100644
> --- a/drivers/media/media-device.c
> +++ b/drivers/media/media-device.c
> @@ -75,8 +75,8 @@ static struct media_entity *find_entity(struct media_device *mdev, u32 id)
>  	spin_lock(&mdev->lock);
>  
>  	media_device_for_each_entity(entity, mdev) {
> -		if ((entity->id == id && !next) ||
> -		    (entity->id > id && next)) {
> +		if (((entity_id(entity) == id) && !next) ||
> +		    ((entity_id(entity) > id) && next)) {
>  			spin_unlock(&mdev->lock);
>  			return entity;
>  		}
> @@ -102,7 +102,7 @@ static long media_device_enum_entities(struct media_device *mdev,
>  	if (ent == NULL)
>  		return -EINVAL;
>  
> -	u_ent.id = ent->id;
> +	u_ent.id = entity_id(ent);
>  	if (ent->name)
>  		strlcpy(u_ent.name, ent->name, sizeof(u_ent.name));
>  	u_ent.type = ent->type;
> @@ -120,7 +120,7 @@ static long media_device_enum_entities(struct media_device *mdev,
>  static void media_device_kpad_to_upad(const struct media_pad *kpad,
>  				      struct media_pad_desc *upad)
>  {
> -	upad->entity = kpad->entity->id;
> +	upad->entity = entity_id(kpad->entity);
>  	upad->index = kpad->index;
>  	upad->flags = kpad->flags;
>  }
> diff --git a/drivers/media/media-entity.c b/drivers/media/media-entity.c
> index 78440c7aad94..b8102bda664d 100644
> --- a/drivers/media/media-entity.c
> +++ b/drivers/media/media-entity.c
> @@ -141,10 +141,10 @@ void media_entity_graph_walk_start(struct media_entity_graph *graph,
>  	graph->stack[graph->top].entity = NULL;
>  	bitmap_zero(graph->entities, MEDIA_ENTITY_ENUM_MAX_ID);
>  
> -	if (WARN_ON(entity->id >= MEDIA_ENTITY_ENUM_MAX_ID))
> +	if (WARN_ON(entity_id(entity) >= MEDIA_ENTITY_ENUM_MAX_ID))
>  		return;
>  
> -	__set_bit(entity->id, graph->entities);
> +	__set_bit(entity_id(entity), graph->entities);
>  	stack_push(graph, entity);
>  }
>  EXPORT_SYMBOL_GPL(media_entity_graph_walk_start);
> @@ -185,11 +185,11 @@ media_entity_graph_walk_next(struct media_entity_graph *graph)
>  
>  		/* Get the entity in the other end of the link . */
>  		next = media_entity_other(entity, link);
> -		if (WARN_ON(next->id >= MEDIA_ENTITY_ENUM_MAX_ID))
> +		if (WARN_ON(entity_id(next) >= MEDIA_ENTITY_ENUM_MAX_ID))
>  			return NULL;
>  
>  		/* Has the entity already been visited? */
> -		if (__test_and_set_bit(next->id, graph->entities)) {
> +		if (__test_and_set_bit(entity_id(next), graph->entities)) {
>  			link_top(graph)++;
>  			continue;
>  		}
> diff --git a/drivers/media/platform/vsp1/vsp1_video.c b/drivers/media/platform/vsp1/vsp1_video.c
> index 17f08973f835..01bc3c48a2b4 100644
> --- a/drivers/media/platform/vsp1/vsp1_video.c
> +++ b/drivers/media/platform/vsp1/vsp1_video.c
> @@ -352,10 +352,10 @@ static int vsp1_pipeline_validate_branch(struct vsp1_pipeline *pipe,
>  			break;
>  
>  		/* Ensure the branch has no loop. */
> -		if (entities & (1 << entity->subdev.entity.id))
> +		if (entities & (1 << entity_id(&entity->subdev.entity)))
>  			return -EPIPE;
>  
> -		entities |= 1 << entity->subdev.entity.id;
> +		entities |= 1 << entity_id(&entity->subdev.entity);
>  
>  		/* UDS can't be chained. */
>  		if (entity->type == VSP1_ENTITY_UDS) {
> diff --git a/include/media/media-entity.h b/include/media/media-entity.h
> index 8b21a4d920d9..478d5cd56be9 100644
> --- a/include/media/media-entity.h
> +++ b/include/media/media-entity.h
> @@ -126,6 +126,8 @@ struct media_entity_graph {
>  	int top;
>  };
>  
> +#define entity_id(entity) ((entity)->id)
> +
>  int media_entity_init(struct media_entity *entity, u16 num_pads,
>  		struct media_pad *pads);
>  void media_entity_cleanup(struct media_entity *entity);
> 


^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [PATCH v4 3/6] media: add a common struct to be embed on media graph objects
  2015-08-14 14:56 ` [PATCH v4 3/6] media: add a common struct to be embed on media graph objects Mauro Carvalho Chehab
@ 2015-08-14 15:03   ` Hans Verkuil
  2015-08-14 21:25   ` Sakari Ailus
  1 sibling, 0 replies; 27+ messages in thread
From: Hans Verkuil @ 2015-08-14 15:03 UTC (permalink / raw)
  To: Mauro Carvalho Chehab, Linux Media Mailing List; +Cc: Mauro Carvalho Chehab

On 08/14/2015 04:56 PM, Mauro Carvalho Chehab wrote:
> Due to the MC API proposed changes, we'll need to have an unique
> object ID for all graph objects, and have some shared fields
> that will be common on all media graph objects.
> 
> Right now, the only common object is the object ID, but other
> fields will be added latter on.

s/latter/later/

> 
> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
> 
> diff --git a/drivers/media/media-entity.c b/drivers/media/media-entity.c
> index b8102bda664d..046f1fe40b50 100644
> --- a/drivers/media/media-entity.c
> +++ b/drivers/media/media-entity.c
> @@ -27,6 +27,39 @@
>  #include <media/media-device.h>
>  
>  /**
> + *  graph_obj_init - Initialize a graph object
> + *
> + * @mdev:	Pointer to the media_device that contains the object
> + * @type:	Type of the object
> + * @gobj:	Pointer to the object
> + *
> + * This routine initializes the embedded struct media_graph_obj inside a
> + * media graph object. It is called automatically if media_*_create()
> + * calls are used. However, if the object (entity, link, pad, interface)
> + * is embedded on some other object, this function should be called before
> + * registering the object at the media controller.
> + */
> +void graph_obj_init(struct media_device *mdev,
> +			   enum media_graph_type type,
> +			   struct media_graph_obj *gobj)
> +{
> +	/* An unique object ID will be provided on next patches */
> +	gobj->id = type << 24;
> +}
> +
> +/**
> + *  graph_obj_remove - Stop using a graph object on a media device
> + *
> + * @graph_obj:	Pointer to the object
> + *
> + * This should be called at media_device_unregister_*() routines
> + */
> +void graph_obj_remove(struct media_graph_obj *gobj)
> +{
> +	/* For now, nothing to do */
> +}
> +
> +/**
>   * media_entity_init - Initialize a media entity
>   *
>   * @num_pads: Total number of sink and source pads.
> diff --git a/include/media/media-entity.h b/include/media/media-entity.h
> index 478d5cd56be9..58938bb980fe 100644
> --- a/include/media/media-entity.h
> +++ b/include/media/media-entity.h
> @@ -28,6 +28,33 @@
>  #include <linux/list.h>
>  #include <linux/media.h>
>  
> +/* Enums used internally at the media controller to represent graphs */
> +
> +/**
> + * enum media_graph_type - type of a graph element
> + *
> + */
> +enum media_graph_type {
> +	 /* FIXME: add the types here, as we embeed media_graph_obj */

s/embeed/embed/

> +	MEDIA_GRAPH_NONE
> +};
> +
> +
> +/* Structs to represent the objects that belong to a media graph */
> +
> +/**
> + * struct media_graph_obj - Define a graph object.
> + *
> + * @id:		Non-zero object ID identifier. The ID should be unique
> + *		inside a media_device
> + *
> + * All elements on the media graph should have this struct embedded
> + */
> +struct media_graph_obj {
> +	u32			id;
> +};
> +
> +
>  struct media_pipeline {
>  };
>  
> @@ -128,6 +155,14 @@ struct media_entity_graph {
>  
>  #define entity_id(entity) ((entity)->id)
>  
> +#define gobj_to_entity(gobj) \
> +		container_of(gobj, struct media_entity, graph_obj)
> +
> +void graph_obj_init(struct media_device *mdev,
> +		    enum media_graph_type type,
> +		    struct media_graph_obj *gobj);
> +void graph_obj_remove(struct media_graph_obj *gobj);
> +
>  int media_entity_init(struct media_entity *entity, u16 num_pads,
>  		struct media_pad *pads);
>  void media_entity_cleanup(struct media_entity *entity);
> 

After fixing these small typos:

Acked-by: Hans Verkuil <hans.verkuil@cisco.com>

Regards,

	Hans

^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [PATCH v4 4/6] media: use media_graph_obj inside entities
  2015-08-14 14:56 ` [PATCH v4 4/6] media: use media_graph_obj inside entities Mauro Carvalho Chehab
@ 2015-08-14 15:07   ` Hans Verkuil
  2015-08-14 22:12   ` Sakari Ailus
  1 sibling, 0 replies; 27+ messages in thread
From: Hans Verkuil @ 2015-08-14 15:07 UTC (permalink / raw)
  To: Mauro Carvalho Chehab, Linux Media Mailing List; +Cc: Mauro Carvalho Chehab

On 08/14/2015 04:56 PM, Mauro Carvalho Chehab wrote:
> As entities are graph elements, let's embeed media_graph_obj

s/embeed/embed/

> on it. That ensures an unique ID for entities that can be
> global along the entire media controller.
> 
> For now, we'll keep the already existing entity ID. Such
> field need to be dropped on some point, but for now, let's

s/on/at/

> not do this, to avoid needing to review all drivers and
> the userspace apps.
> 
> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
> 
> diff --git a/drivers/media/media-device.c b/drivers/media/media-device.c
> index b9382f06044a..f06b08392007 100644
> --- a/drivers/media/media-device.c
> +++ b/drivers/media/media-device.c
> @@ -377,7 +377,6 @@ int __must_check __media_device_register(struct media_device *mdev,
>  	if (WARN_ON(mdev->dev == NULL || mdev->model[0] == 0))
>  		return -EINVAL;
>  
> -	mdev->entity_id = 1;
>  	INIT_LIST_HEAD(&mdev->entities);
>  	spin_lock_init(&mdev->lock);
>  	mutex_init(&mdev->graph_mutex);
> @@ -431,11 +430,9 @@ int __must_check media_device_register_entity(struct media_device *mdev,
>  	entity->parent = mdev;
>  
>  	spin_lock(&mdev->lock);
> -	if (entity->id == 0)
> -		entity->id = mdev->entity_id++;
> -	else
> -		mdev->entity_id = max(entity->id + 1, mdev->entity_id);
> -	list_add_tail(&entity->list, &mdev->entities);
> +	/* Initialize media_graph_obj embedded at the entity */
> +	graph_obj_init(mdev, MEDIA_GRAPH_ENTITY, &entity->graph_obj);
> +
>  	spin_unlock(&mdev->lock);
>  
>  	return 0;
> @@ -457,6 +454,7 @@ void media_device_unregister_entity(struct media_entity *entity)
>  		return;
>  
>  	spin_lock(&mdev->lock);
> +	graph_obj_remove(&entity->graph_obj);
>  	list_del(&entity->list);
>  	spin_unlock(&mdev->lock);
>  	entity->parent = NULL;
> diff --git a/drivers/media/media-entity.c b/drivers/media/media-entity.c
> index 046f1fe40b50..c06546509a89 100644
> --- a/drivers/media/media-entity.c
> +++ b/drivers/media/media-entity.c
> @@ -43,8 +43,12 @@ void graph_obj_init(struct media_device *mdev,
>  			   enum media_graph_type type,
>  			   struct media_graph_obj *gobj)
>  {
> -	/* An unique object ID will be provided on next patches */
> +	/* Create a per-type unique object ID */
>  	gobj->id = type << 24;
> +	switch (type) {
> +	case MEDIA_GRAPH_ENTITY:
> +		gobj->id |= ++mdev->entity_id;

Please add a break here.

> +	}
>  }
>  
>  /**
> diff --git a/include/media/media-device.h b/include/media/media-device.h
> index 6e6db78f1ee2..35634c0da362 100644
> --- a/include/media/media-device.h
> +++ b/include/media/media-device.h
> @@ -41,7 +41,7 @@ struct device;
>   * @bus_info:	Unique and stable device location identifier
>   * @hw_revision: Hardware device revision
>   * @driver_version: Device driver version
> - * @entity_id:	ID of the next entity to be registered
> + * @entity_id:	Unique ID used on the last entity registered
>   * @entities:	List of registered entities
>   * @lock:	Entities list lock
>   * @graph_mutex: Entities graph operation lock
> @@ -68,7 +68,9 @@ struct media_device {
>  	u32 hw_revision;
>  	u32 driver_version;
>  
> +	/* Unique object ID counter */
>  	u32 entity_id;
> +
>  	struct list_head entities;
>  
>  	/* Protects the entities list */
> diff --git a/include/media/media-entity.h b/include/media/media-entity.h
> index 58938bb980fe..2c775f3ef24f 100644
> --- a/include/media/media-entity.h
> +++ b/include/media/media-entity.h
> @@ -33,10 +33,10 @@
>  /**
>   * enum media_graph_type - type of a graph element
>   *
> + * @MEDIA_GRAPH_ENTITY:		Identify a media entity
>   */
>  enum media_graph_type {
> -	 /* FIXME: add the types here, as we embeed media_graph_obj */
> -	MEDIA_GRAPH_NONE
> +	MEDIA_GRAPH_ENTITY,
>  };
>  
>  
> @@ -88,10 +88,9 @@ struct media_entity_operations {
>  };
>  
>  struct media_entity {
> +	struct media_graph_obj graph_obj;
>  	struct list_head list;
>  	struct media_device *parent;	/* Media device this entity belongs to*/
> -	u32 id;				/* Entity ID, unique in the parent media
> -					 * device context */
>  	const char *name;		/* Entity name */
>  	u32 type;			/* Entity type (MEDIA_ENT_T_*) */
>  	u32 revision;			/* Entity revision, driver specific */
> @@ -153,7 +152,7 @@ struct media_entity_graph {
>  	int top;
>  };
>  
> -#define entity_id(entity) ((entity)->id)
> +#define entity_id(entity) ((entity)->graph_obj.id)
>  
>  #define gobj_to_entity(gobj) \
>  		container_of(gobj, struct media_entity, graph_obj)
> 

With the small items above fixed:

Acked-by: Hans Verkuil <hans.verkuil@cisco.com>

Regards,

	Hans

^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [PATCH v4 5/6] media: use media_graph_obj inside pads
  2015-08-14 14:56 ` [PATCH v4 5/6] media: use media_graph_obj inside pads Mauro Carvalho Chehab
@ 2015-08-14 15:10   ` Hans Verkuil
  2015-08-14 22:15   ` Sakari Ailus
  1 sibling, 0 replies; 27+ messages in thread
From: Hans Verkuil @ 2015-08-14 15:10 UTC (permalink / raw)
  To: Mauro Carvalho Chehab, Linux Media Mailing List; +Cc: Mauro Carvalho Chehab

On 08/14/2015 04:56 PM, Mauro Carvalho Chehab wrote:
> PADs also need unique object IDs that won't conflict with
> the entity object IDs.
> 
> The pad objects are currently created via media_entity_init()
> and, once created, never change.
> 
> While this will likely change in the future in order to
> suppory dynamic changes, for now we'll keep PADs as arrays

s/suppory/support/

> and initialize the media_graph_obj embeeded structs when

s/embeeded/embedded/

Hmm, I sense a pattern here :-)

> registering the entity.
> 
> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
> 
> diff --git a/drivers/media/media-device.c b/drivers/media/media-device.c
> index f06b08392007..3ac5803b327e 100644
> --- a/drivers/media/media-device.c
> +++ b/drivers/media/media-device.c
> @@ -425,6 +425,8 @@ EXPORT_SYMBOL_GPL(media_device_unregister);
>  int __must_check media_device_register_entity(struct media_device *mdev,
>  					      struct media_entity *entity)
>  {
> +	int i;
> +
>  	/* Warn if we apparently re-register an entity */
>  	WARN_ON(entity->parent != NULL);
>  	entity->parent = mdev;
> @@ -433,6 +435,12 @@ int __must_check media_device_register_entity(struct media_device *mdev,
>  	/* Initialize media_graph_obj embedded at the entity */
>  	graph_obj_init(mdev, MEDIA_GRAPH_ENTITY, &entity->graph_obj);
>  
> +	/* Initialize objects at the pads */
> +	for (i = 0; i < entity->num_pads; i++)
> +		graph_obj_init(mdev, MEDIA_GRAPH_PAD,
> +			       &entity->pads[i].graph_obj);
> +
> +	list_add_tail(&entity->list, &mdev->entities);
>  	spin_unlock(&mdev->lock);
>  
>  	return 0;
> @@ -448,6 +456,7 @@ EXPORT_SYMBOL_GPL(media_device_register_entity);
>   */
>  void media_device_unregister_entity(struct media_entity *entity)
>  {
> +	int i;
>  	struct media_device *mdev = entity->parent;
>  
>  	if (mdev == NULL)
> @@ -455,6 +464,8 @@ void media_device_unregister_entity(struct media_entity *entity)
>  
>  	spin_lock(&mdev->lock);
>  	graph_obj_remove(&entity->graph_obj);
> +	for (i = 0; i < entity->num_pads; i++)
> +		graph_obj_remove(&entity->pads[i].graph_obj);
>  	list_del(&entity->list);
>  	spin_unlock(&mdev->lock);
>  	entity->parent = NULL;
> diff --git a/drivers/media/media-entity.c b/drivers/media/media-entity.c
> index c06546509a89..d3dee6fc79d7 100644
> --- a/drivers/media/media-entity.c
> +++ b/drivers/media/media-entity.c
> @@ -48,6 +48,8 @@ void graph_obj_init(struct media_device *mdev,
>  	switch (type) {
>  	case MEDIA_GRAPH_ENTITY:
>  		gobj->id |= ++mdev->entity_id;

And that's why you should always add a break after a case: this now
falls through into the next case, and that's not what you want.

> +	case MEDIA_GRAPH_PAD:
> +		gobj->id |= ++mdev->pad_id;

Ditto: add a break.

>  	}
>  }
>  
> diff --git a/include/media/media-device.h b/include/media/media-device.h
> index 35634c0da362..2a9d9260cccc 100644
> --- a/include/media/media-device.h
> +++ b/include/media/media-device.h
> @@ -42,6 +42,7 @@ struct device;
>   * @hw_revision: Hardware device revision
>   * @driver_version: Device driver version
>   * @entity_id:	Unique ID used on the last entity registered
> + * @pad_id:	Unique ID used on the last pad registered
>   * @entities:	List of registered entities
>   * @lock:	Entities list lock
>   * @graph_mutex: Entities graph operation lock
> @@ -70,6 +71,7 @@ struct media_device {
>  
>  	/* Unique object ID counter */
>  	u32 entity_id;
> +	u32 pad_id;
>  
>  	struct list_head entities;
>  
> diff --git a/include/media/media-entity.h b/include/media/media-entity.h
> index 2c775f3ef24f..936f68f27bba 100644
> --- a/include/media/media-entity.h
> +++ b/include/media/media-entity.h
> @@ -34,9 +34,11 @@
>   * enum media_graph_type - type of a graph element
>   *
>   * @MEDIA_GRAPH_ENTITY:		Identify a media entity
> + * @MEDIA_GRAPH_PAD:		Identify a media pad
>   */
>  enum media_graph_type {
>  	MEDIA_GRAPH_ENTITY,
> +	MEDIA_GRAPH_PAD,
>  };
>  
>  
> @@ -66,6 +68,7 @@ struct media_link {
>  };
>  
>  struct media_pad {
> +	struct media_graph_obj graph_obj;
>  	struct media_entity *entity;	/* Entity this pad belongs to */
>  	u16 index;			/* Pad index in the entity pads array */
>  	unsigned long flags;		/* Pad flags (MEDIA_PAD_FL_*) */
> 

After these issues are fixed you can add my:

Acked-by: Hans Verkuil <hans.verkuil@cisco.com>

Regards,

	Hans

^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [PATCH v4 1/6] media: get rid of unused "extra_links" param on media_entity_init()
  2015-08-14 14:56 ` [PATCH v4 1/6] media: get rid of unused "extra_links" param on media_entity_init() Mauro Carvalho Chehab
  2015-08-14 14:59   ` Hans Verkuil
@ 2015-08-14 15:16   ` Laurent Pinchart
  1 sibling, 0 replies; 27+ messages in thread
From: Laurent Pinchart @ 2015-08-14 15:16 UTC (permalink / raw)
  To: Mauro Carvalho Chehab
  Cc: Linux Media Mailing List, Mauro Carvalho Chehab, Jonathan Corbet,
	Harry Wei, Hans Verkuil, Sakari Ailus, Lars-Peter Clausen,
	Kyungmin Park, Heungjun Kim, Prabhakar Lad, Andrzej Hajda,
	Mats Randgaard, Sylwester Nawrocki, Kukjin Kim,
	Krzysztof Kozlowski, Hyun Kwon, Michal Simek,
	Sören Brinkmann, Greg Kroah-Hartman, Joe Perches,
	Boris BREZILLON, Javier Martinez Canillas, Guennadi Liakhovetski,
	Ricardo Ribald a Delgado, Axel Lin, Scott Jiang, Bryan Wu,
	Jacek Anaszewski, Aya Mahfouz, Haneen Mohammed, Tapasweni Pathak,
	anuvazhayil, Mahati Chamarthy, Navya Sri Nizamkari, linux-doc,
	linux-kernel, linux-arm-kernel, linux-samsung-soc, linux-sh,
	devel

Hi Mauro,

Thank you for the patch.

On Friday 14 August 2015 11:56:38 Mauro Carvalho Chehab wrote:
> Currently, media_entity_init() creates an array with the links,
> allocated at init time. It provides a parameter (extra_links)
> that would allocate more links than the current needs, but this
> is not used by any driver.
> 
> As we want to be able to do dynamic link allocation/removal,
> we'll need to change the implementation of the links. So,
> before doing that, let's first remove that extra unused
> parameter, in order to cleanup the interface first.
> 
> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
> Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
> 
> diff --git a/Documentation/media-framework.txt
> b/Documentation/media-framework.txt index f552a75c0e70..2cc6019f7147 100644
> --- a/Documentation/media-framework.txt
> +++ b/Documentation/media-framework.txt
> @@ -104,7 +104,7 @@ although drivers can allocate entities directly.
>  Drivers initialize entities by calling
> 
>  	media_entity_init(struct media_entity *entity, u16 num_pads,
> -			  struct media_pad *pads, u16 extra_links);
> +			  struct media_pad *pads);
> 
>  The media_entity name, type, flags, revision and group_id fields can be
>  initialized before or after calling media_entity_init. Entities embedded in

The extra_links parameter is documented later on in this file. Could you 
replace the paragraph

"Unlike the number of pads, the total number of links isn't always known in
advance by the entity driver. As an initial estimate, media_entity_init
pre-allocates a number of links equal to the number of pads plus an optional
number of extra links. The links array will be reallocated if it grows beyond
the initial estimate."

with

"Unlike the number of pads, the total number of links isn't always known in
advance by the entity driver. As an initial estimate, media_entity_init
pre-allocates a number of links equal to the number of pads. The links array 
will be reallocated if it grows beyond the initial estimate."

?

[snip]

> diff --git a/drivers/media/media-entity.c b/drivers/media/media-entity.c
> index 4d8e01c7b1b2..78440c7aad94 100644
> --- a/drivers/media/media-entity.c
> +++ b/drivers/media/media-entity.c
> @@ -30,7 +30,6 @@
>   * media_entity_init - Initialize a media entity
>   *
>   * @num_pads: Total number of sink and source pads.
> - * @extra_links: Initial estimate of the number of extra links.
>   * @pads: Array of 'num_pads' pads.
>   *
>   * The total number of pads is an intrinsic property of entities known by
> the

Similarly here, I would rewrite the documentation as

 * The total number of pads is an intrinsic property of entities known by the
 * entity driver, while the total number of links depends on hardware design
 * and is an extrinsic property unknown to the entity driver. However, in most
 * use cases the number of links can safely be assumed to be equal to or
 * larger than the number of pads.
 *
 * For those reasons the links array can be preallocated based on the number
 * of pads and will be reallocated later if extra links need to be created.
 *
 * This function allocates a links array with enough space to hold at least
 * 'num_pads' elements. The media_entity::max_links field will be set to the
 * number of allocated elements.

With that fixed,

Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

And feel free to merge this patch for v4.3 independently of the rest.

> @@ -52,10 +51,10 @@
>   */
>  int
>  media_entity_init(struct media_entity *entity, u16 num_pads,
> -		  struct media_pad *pads, u16 extra_links)
> +		  struct media_pad *pads)
>  {
>  	struct media_link *links;
> -	unsigned int max_links = num_pads + extra_links;
> +	unsigned int max_links = num_pads;
>  	unsigned int i;
> 
>  	links = kzalloc(max_links * sizeof(links[0]), GFP_KERNEL);

-- 
Regards,

Laurent Pinchart


^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [PATCH v4 6/6] media: use media_graph_obj inside links
  2015-08-14 14:56 ` [PATCH v4 6/6] media: use media_graph_obj inside links Mauro Carvalho Chehab
@ 2015-08-14 15:18   ` Hans Verkuil
  2015-08-14 15:33     ` Hans Verkuil
  2015-08-14 16:15     ` Mauro Carvalho Chehab
  0 siblings, 2 replies; 27+ messages in thread
From: Hans Verkuil @ 2015-08-14 15:18 UTC (permalink / raw)
  To: Mauro Carvalho Chehab, Linux Media Mailing List; +Cc: Mauro Carvalho Chehab

On 08/14/2015 04:56 PM, Mauro Carvalho Chehab wrote:
> Just like entities and pads, links also need to have unique
> Object IDs along a given media controller.
> 
> So, let's add a media_graph_obj inside it and initialize
> the object then a new link is created.
> 
> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
> 
> diff --git a/drivers/media/media-device.c b/drivers/media/media-device.c
> index 3ac5803b327e..9f02939c2864 100644
> --- a/drivers/media/media-device.c
> +++ b/drivers/media/media-device.c
> @@ -466,6 +466,8 @@ void media_device_unregister_entity(struct media_entity *entity)
>  	graph_obj_remove(&entity->graph_obj);
>  	for (i = 0; i < entity->num_pads; i++)
>  		graph_obj_remove(&entity->pads[i].graph_obj);
> +	for (i = 0; entity->num_links; i++)
> +		graph_obj_remove(&entity->links[i].graph_obj);
>  	list_del(&entity->list);
>  	spin_unlock(&mdev->lock);
>  	entity->parent = NULL;
> diff --git a/drivers/media/media-entity.c b/drivers/media/media-entity.c
> index d3dee6fc79d7..4f18bd10b162 100644
> --- a/drivers/media/media-entity.c
> +++ b/drivers/media/media-entity.c
> @@ -50,6 +50,8 @@ void graph_obj_init(struct media_device *mdev,
>  		gobj->id |= ++mdev->entity_id;
>  	case MEDIA_GRAPH_PAD:
>  		gobj->id |= ++mdev->pad_id;
> +	case MEDIA_GRAPH_LINK:
> +		gobj->id |= ++mdev->pad_id;

Same issue with missing breaks. Also for links you want to use link_id, not
pad_id. Clearly a copy-and-paste mistake.

A bigger question is whether you actually need graph_obj for a link? Links are
*between* graph objects, but are they really graph objects in their own right?

Currently a link is identified by the source/sink objects and I think that is
all you need. I didn't realize that when reviewing the v3 patch series, but I'm
now wondering about it.

If you *don't* make links a graph_obj, will anything break or become difficult
to use? I don't think so, but let me know if I am overlooking something.

>  	}
>  }
>  
> @@ -469,6 +471,10 @@ static struct media_link *media_entity_add_link(struct media_entity *entity)
>  		entity->links = links;
>  	}
>  
> +	/* Initialize graph object embedded at the new link */
> +	graph_obj_init(entity->parent, MEDIA_GRAPH_LINK,
> +			&entity->links[entity->num_links].graph_obj);
> +
>  	return &entity->links[entity->num_links++];
>  }
>  
> diff --git a/include/media/media-device.h b/include/media/media-device.h
> index 2a9d9260cccc..2d9a050d46f7 100644
> --- a/include/media/media-device.h
> +++ b/include/media/media-device.h
> @@ -43,6 +43,7 @@ struct device;
>   * @driver_version: Device driver version
>   * @entity_id:	Unique ID used on the last entity registered
>   * @pad_id:	Unique ID used on the last pad registered
> + * @link_id:	Unique ID used on the last link registered
>   * @entities:	List of registered entities
>   * @lock:	Entities list lock
>   * @graph_mutex: Entities graph operation lock
> @@ -72,6 +73,7 @@ struct media_device {
>  	/* Unique object ID counter */
>  	u32 entity_id;
>  	u32 pad_id;
> +	u32 link_id;
>  
>  	struct list_head entities;
>  
> diff --git a/include/media/media-entity.h b/include/media/media-entity.h
> index 936f68f27bba..30eaae47d72e 100644
> --- a/include/media/media-entity.h
> +++ b/include/media/media-entity.h
> @@ -35,10 +35,12 @@
>   *
>   * @MEDIA_GRAPH_ENTITY:		Identify a media entity
>   * @MEDIA_GRAPH_PAD:		Identify a media pad
> + * @MEDIA_GRAPH_LINK:		Identify a media link
>   */
>  enum media_graph_type {
>  	MEDIA_GRAPH_ENTITY,
>  	MEDIA_GRAPH_PAD,
> +	MEDIA_GRAPH_LINK,
>  };
>  
>  
> @@ -61,6 +63,7 @@ struct media_pipeline {
>  };
>  
>  struct media_link {
> +	struct media_graph_obj graph_obj;
>  	struct media_pad *source;	/* Source pad */
>  	struct media_pad *sink;		/* Sink pad  */
>  	struct media_link *reverse;	/* Link in the reverse direction */
> 

Regards,

	Hans

^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [PATCH v4 6/6] media: use media_graph_obj inside links
  2015-08-14 15:18   ` Hans Verkuil
@ 2015-08-14 15:33     ` Hans Verkuil
  2015-08-14 16:19       ` Mauro Carvalho Chehab
  2015-08-14 16:15     ` Mauro Carvalho Chehab
  1 sibling, 1 reply; 27+ messages in thread
From: Hans Verkuil @ 2015-08-14 15:33 UTC (permalink / raw)
  To: Mauro Carvalho Chehab, Linux Media Mailing List; +Cc: Mauro Carvalho Chehab

On 08/14/2015 05:18 PM, Hans Verkuil wrote:
> On 08/14/2015 04:56 PM, Mauro Carvalho Chehab wrote:
>> Just like entities and pads, links also need to have unique
>> Object IDs along a given media controller.
>>
>> So, let's add a media_graph_obj inside it and initialize
>> the object then a new link is created.
>>
>> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
>>
>> diff --git a/drivers/media/media-device.c b/drivers/media/media-device.c
>> index 3ac5803b327e..9f02939c2864 100644
>> --- a/drivers/media/media-device.c
>> +++ b/drivers/media/media-device.c
>> @@ -466,6 +466,8 @@ void media_device_unregister_entity(struct media_entity *entity)
>>  	graph_obj_remove(&entity->graph_obj);
>>  	for (i = 0; i < entity->num_pads; i++)
>>  		graph_obj_remove(&entity->pads[i].graph_obj);
>> +	for (i = 0; entity->num_links; i++)
>> +		graph_obj_remove(&entity->links[i].graph_obj);
>>  	list_del(&entity->list);
>>  	spin_unlock(&mdev->lock);
>>  	entity->parent = NULL;
>> diff --git a/drivers/media/media-entity.c b/drivers/media/media-entity.c
>> index d3dee6fc79d7..4f18bd10b162 100644
>> --- a/drivers/media/media-entity.c
>> +++ b/drivers/media/media-entity.c
>> @@ -50,6 +50,8 @@ void graph_obj_init(struct media_device *mdev,
>>  		gobj->id |= ++mdev->entity_id;
>>  	case MEDIA_GRAPH_PAD:
>>  		gobj->id |= ++mdev->pad_id;
>> +	case MEDIA_GRAPH_LINK:
>> +		gobj->id |= ++mdev->pad_id;
> 
> Same issue with missing breaks. Also for links you want to use link_id, not
> pad_id. Clearly a copy-and-paste mistake.
> 
> A bigger question is whether you actually need graph_obj for a link? Links are
> *between* graph objects, but are they really graph objects in their own right?
> 
> Currently a link is identified by the source/sink objects and I think that is
> all you need. I didn't realize that when reviewing the v3 patch series, but I'm
> now wondering about it.
> 
> If you *don't* make links a graph_obj, will anything break or become difficult
> to use? I don't think so, but let me know if I am overlooking something.

Hmm, you probably want the list part of a graph_obj since you need to link the
links (so to speak) in a list. I'm not sure if you need unique IDs for a link
object, but it doesn't hurt either. Just ignore my comments about using the
graph_obj in media_link.

Regards,

	Hans

^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [PATCH v4 6/6] media: use media_graph_obj inside links
  2015-08-14 15:18   ` Hans Verkuil
  2015-08-14 15:33     ` Hans Verkuil
@ 2015-08-14 16:15     ` Mauro Carvalho Chehab
  1 sibling, 0 replies; 27+ messages in thread
From: Mauro Carvalho Chehab @ 2015-08-14 16:15 UTC (permalink / raw)
  To: Hans Verkuil; +Cc: Linux Media Mailing List, Mauro Carvalho Chehab

Em Fri, 14 Aug 2015 17:18:28 +0200
Hans Verkuil <hverkuil@xs4all.nl> escreveu:

> On 08/14/2015 04:56 PM, Mauro Carvalho Chehab wrote:
> > Just like entities and pads, links also need to have unique
> > Object IDs along a given media controller.
> > 
> > So, let's add a media_graph_obj inside it and initialize
> > the object then a new link is created.
> > 
> > Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
> > 
> > diff --git a/drivers/media/media-device.c b/drivers/media/media-device.c
> > index 3ac5803b327e..9f02939c2864 100644
> > --- a/drivers/media/media-device.c
> > +++ b/drivers/media/media-device.c
> > @@ -466,6 +466,8 @@ void media_device_unregister_entity(struct media_entity *entity)
> >  	graph_obj_remove(&entity->graph_obj);
> >  	for (i = 0; i < entity->num_pads; i++)
> >  		graph_obj_remove(&entity->pads[i].graph_obj);
> > +	for (i = 0; entity->num_links; i++)
> > +		graph_obj_remove(&entity->links[i].graph_obj);
> >  	list_del(&entity->list);
> >  	spin_unlock(&mdev->lock);
> >  	entity->parent = NULL;
> > diff --git a/drivers/media/media-entity.c b/drivers/media/media-entity.c
> > index d3dee6fc79d7..4f18bd10b162 100644
> > --- a/drivers/media/media-entity.c
> > +++ b/drivers/media/media-entity.c
> > @@ -50,6 +50,8 @@ void graph_obj_init(struct media_device *mdev,
> >  		gobj->id |= ++mdev->entity_id;
> >  	case MEDIA_GRAPH_PAD:
> >  		gobj->id |= ++mdev->pad_id;
> > +	case MEDIA_GRAPH_LINK:
> > +		gobj->id |= ++mdev->pad_id;
> 
> Same issue with missing breaks. Also for links you want to use link_id, not
> pad_id. Clearly a copy-and-paste mistake.

Fixed.

> A bigger question is whether you actually need graph_obj for a link? Links are
> *between* graph objects, but are they really graph objects in their own right?

Yes, a link is a graph object. See any CAD/CAM program and you'll see that
they're mapping as such on all I'm aware of. If we either need it here or not,
see below.

> Currently a link is identified by the source/sink objects and I think that is
> all you need. I didn't realize that when reviewing the v3 patch series, but I'm
> now wondering about it.
> 
> If you *don't* make links a graph_obj, will anything break or become difficult
> to use? I don't think so, but let me know if I am overlooking something.

There are several reasons why we want links to have a common object and
an unique ID. 

By having an unique ID, whenever we need to pass the link to, we can
use the ID (or, actually, a pointer to the common object).

Also, please remember that the type is now embedded with the ID.
So, in order to be able to check what graph element are used, we need
either the type or the ID.

A real case, Shuah mentioned via email is that, in order to properly lock
between ALSA, V4L and DVB, the pertinent drivers need to be notified when
some links, entities (and maybe interfaces) are created (or removed),
as the graph creation will be handle by multiple, indepentent drivers.

If we use an unique ID for the links, a single notify function can be
used to report if a new graph element is added.

For example, where both entities and link creation needs to be tracked,
such function would do be like:

static void notify_topology_change(struct media_graph_obj *gobj)
{
	enum media_graph_type type = gobj->id >> 24;

	switch (type) {
	case MEDIA_GRAPH_ENTITY:
	{
		struct media_entity *entity = gobj_to_entity(gobj);
		/* something */
		break;
	}
	case MEDIA_GRAPH_LINK:
	{
		struct media_link *link = gobj_to_link(gobj);
		/* something else */
		break;
	}
	default:
		/* do nothing */
	}
}

That's just the initial usecase. I'm pretty sure we'll need it when
we add support for dynamic creation/removal and, eventually, even
at the userspace API, but let's go by parts.

Regards,
Mauro

^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [PATCH v4 6/6] media: use media_graph_obj inside links
  2015-08-14 15:33     ` Hans Verkuil
@ 2015-08-14 16:19       ` Mauro Carvalho Chehab
  0 siblings, 0 replies; 27+ messages in thread
From: Mauro Carvalho Chehab @ 2015-08-14 16:19 UTC (permalink / raw)
  To: Hans Verkuil; +Cc: Linux Media Mailing List, Mauro Carvalho Chehab

Em Fri, 14 Aug 2015 17:33:28 +0200
Hans Verkuil <hverkuil@xs4all.nl> escreveu:

> On 08/14/2015 05:18 PM, Hans Verkuil wrote:
> > On 08/14/2015 04:56 PM, Mauro Carvalho Chehab wrote:
> >> Just like entities and pads, links also need to have unique
> >> Object IDs along a given media controller.
> >>
> >> So, let's add a media_graph_obj inside it and initialize
> >> the object then a new link is created.
> >>
> >> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
> >>
> >> diff --git a/drivers/media/media-device.c b/drivers/media/media-device.c
> >> index 3ac5803b327e..9f02939c2864 100644
> >> --- a/drivers/media/media-device.c
> >> +++ b/drivers/media/media-device.c
> >> @@ -466,6 +466,8 @@ void media_device_unregister_entity(struct media_entity *entity)
> >>  	graph_obj_remove(&entity->graph_obj);
> >>  	for (i = 0; i < entity->num_pads; i++)
> >>  		graph_obj_remove(&entity->pads[i].graph_obj);
> >> +	for (i = 0; entity->num_links; i++)
> >> +		graph_obj_remove(&entity->links[i].graph_obj);
> >>  	list_del(&entity->list);
> >>  	spin_unlock(&mdev->lock);
> >>  	entity->parent = NULL;
> >> diff --git a/drivers/media/media-entity.c b/drivers/media/media-entity.c
> >> index d3dee6fc79d7..4f18bd10b162 100644
> >> --- a/drivers/media/media-entity.c
> >> +++ b/drivers/media/media-entity.c
> >> @@ -50,6 +50,8 @@ void graph_obj_init(struct media_device *mdev,
> >>  		gobj->id |= ++mdev->entity_id;
> >>  	case MEDIA_GRAPH_PAD:
> >>  		gobj->id |= ++mdev->pad_id;
> >> +	case MEDIA_GRAPH_LINK:
> >> +		gobj->id |= ++mdev->pad_id;
> > 
> > Same issue with missing breaks. Also for links you want to use link_id, not
> > pad_id. Clearly a copy-and-paste mistake.
> > 
> > A bigger question is whether you actually need graph_obj for a link? Links are
> > *between* graph objects, but are they really graph objects in their own right?
> > 
> > Currently a link is identified by the source/sink objects and I think that is
> > all you need. I didn't realize that when reviewing the v3 patch series, but I'm
> > now wondering about it.
> > 
> > If you *don't* make links a graph_obj, will anything break or become difficult
> > to use? I don't think so, but let me know if I am overlooking something.
> 
> Hmm, you probably want the list part of a graph_obj since you need to link the
> links (so to speak) in a list. I'm not sure if you need unique IDs for a link
> object, but it doesn't hurt either. Just ignore my comments about using the
> graph_obj in media_link.

Yes. that's another reason.

As you said, it doesn't hurt to have an unique ID and we'll need it
soon enough (Shuah will need it).

Regards,
Mauro

^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [PATCH v4 2/6] media: create a macro to get entity ID
  2015-08-14 14:56 ` [PATCH v4 2/6] media: create a macro to get entity ID Mauro Carvalho Chehab
  2015-08-14 15:02   ` Hans Verkuil
@ 2015-08-14 21:08   ` Sakari Ailus
  2015-08-14 21:48     ` Laurent Pinchart
  1 sibling, 1 reply; 27+ messages in thread
From: Sakari Ailus @ 2015-08-14 21:08 UTC (permalink / raw)
  To: Mauro Carvalho Chehab
  Cc: Linux Media Mailing List, Mauro Carvalho Chehab, Laurent Pinchart,
	linux-sh

Hi Mauro,

On Fri, Aug 14, 2015 at 11:56:39AM -0300, Mauro Carvalho Chehab wrote:
...
> diff --git a/include/media/media-entity.h b/include/media/media-entity.h
> index 8b21a4d920d9..478d5cd56be9 100644
> --- a/include/media/media-entity.h
> +++ b/include/media/media-entity.h
> @@ -126,6 +126,8 @@ struct media_entity_graph {
>  	int top;
>  };
>  
> +#define entity_id(entity) ((entity)->id)
> +
>  int media_entity_init(struct media_entity *entity, u16 num_pads,
>  		struct media_pad *pads);
>  void media_entity_cleanup(struct media_entity *entity);

media-entity.h is a pretty widely included header file. Perhaps we should
think about the naming a bit.

All the other names in the header begin with media (or __media); I'd very
much prefer not changing that pattern.

-- 
Regards,

Sakari Ailus
e-mail: sakari.ailus@iki.fi	XMPP: sailus@retiisi.org.uk

^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [PATCH v4 3/6] media: add a common struct to be embed on media graph objects
  2015-08-14 14:56 ` [PATCH v4 3/6] media: add a common struct to be embed on media graph objects Mauro Carvalho Chehab
  2015-08-14 15:03   ` Hans Verkuil
@ 2015-08-14 21:25   ` Sakari Ailus
  2015-08-15 14:56     ` Mauro Carvalho Chehab
  1 sibling, 1 reply; 27+ messages in thread
From: Sakari Ailus @ 2015-08-14 21:25 UTC (permalink / raw)
  To: Mauro Carvalho Chehab; +Cc: Linux Media Mailing List, Mauro Carvalho Chehab

Hi Mauro,

On Fri, Aug 14, 2015 at 11:56:40AM -0300, Mauro Carvalho Chehab wrote:
> Due to the MC API proposed changes, we'll need to have an unique
> object ID for all graph objects, and have some shared fields
> that will be common on all media graph objects.
> 
> Right now, the only common object is the object ID, but other
> fields will be added latter on.
> 
> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
> 
> diff --git a/drivers/media/media-entity.c b/drivers/media/media-entity.c
> index b8102bda664d..046f1fe40b50 100644
> --- a/drivers/media/media-entity.c
> +++ b/drivers/media/media-entity.c
> @@ -27,6 +27,39 @@
>  #include <media/media-device.h>
>  
>  /**
> + *  graph_obj_init - Initialize a graph object
> + *
> + * @mdev:	Pointer to the media_device that contains the object
> + * @type:	Type of the object
> + * @gobj:	Pointer to the object
> + *
> + * This routine initializes the embedded struct media_graph_obj inside a
> + * media graph object. It is called automatically if media_*_create()
> + * calls are used. However, if the object (entity, link, pad, interface)
> + * is embedded on some other object, this function should be called before
> + * registering the object at the media controller.
> + */
> +void graph_obj_init(struct media_device *mdev,
> +			   enum media_graph_type type,
> +			   struct media_graph_obj *gobj)
> +{
> +	/* An unique object ID will be provided on next patches */
> +	gobj->id = type << 24;

Ugh. This will mean the object IDs are going to be huge to begin with,
ending up being a nuisance to work with as you often write them by hand. Do
we win anything by doing so?

> +}
> +
> +/**
> + *  graph_obj_remove - Stop using a graph object on a media device
> + *
> + * @graph_obj:	Pointer to the object
> + *
> + * This should be called at media_device_unregister_*() routines
> + */
> +void graph_obj_remove(struct media_graph_obj *gobj)
> +{
> +	/* For now, nothing to do */
> +}
> +
> +/**
>   * media_entity_init - Initialize a media entity
>   *
>   * @num_pads: Total number of sink and source pads.
> diff --git a/include/media/media-entity.h b/include/media/media-entity.h
> index 478d5cd56be9..58938bb980fe 100644
> --- a/include/media/media-entity.h
> +++ b/include/media/media-entity.h
> @@ -28,6 +28,33 @@
>  #include <linux/list.h>
>  #include <linux/media.h>
>  
> +/* Enums used internally at the media controller to represent graphs */
> +
> +/**
> + * enum media_graph_type - type of a graph element
> + *
> + */
> +enum media_graph_type {
> +	 /* FIXME: add the types here, as we embeed media_graph_obj */
> +	MEDIA_GRAPH_NONE
> +};
> +
> +
> +/* Structs to represent the objects that belong to a media graph */
> +
> +/**
> + * struct media_graph_obj - Define a graph object.
> + *
> + * @id:		Non-zero object ID identifier. The ID should be unique
> + *		inside a media_device
> + *
> + * All elements on the media graph should have this struct embedded
> + */
> +struct media_graph_obj {
> +	u32			id;
> +};
> +
> +
>  struct media_pipeline {
>  };
>  
> @@ -128,6 +155,14 @@ struct media_entity_graph {
>  
>  #define entity_id(entity) ((entity)->id)
>  
> +#define gobj_to_entity(gobj) \
> +		container_of(gobj, struct media_entity, graph_obj)
> +
> +void graph_obj_init(struct media_device *mdev,
> +		    enum media_graph_type type,
> +		    struct media_graph_obj *gobj);
> +void graph_obj_remove(struct media_graph_obj *gobj);
> +
>  int media_entity_init(struct media_entity *entity, u16 num_pads,
>  		struct media_pad *pads);
>  void media_entity_cleanup(struct media_entity *entity);

My previous comment on the naming applies on this patch as well. Please do
maintain the common prefix.

-- 
Kind regards,

Sakari Ailus
e-mail: sakari.ailus@iki.fi	XMPP: sailus@retiisi.org.uk

^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [PATCH v4 2/6] media: create a macro to get entity ID
  2015-08-14 21:08   ` Sakari Ailus
@ 2015-08-14 21:48     ` Laurent Pinchart
  0 siblings, 0 replies; 27+ messages in thread
From: Laurent Pinchart @ 2015-08-14 21:48 UTC (permalink / raw)
  To: Sakari Ailus
  Cc: Mauro Carvalho Chehab, Linux Media Mailing List,
	Mauro Carvalho Chehab, linux-sh

Hello,

On Saturday 15 August 2015 00:08:55 Sakari Ailus wrote:
> On Fri, Aug 14, 2015 at 11:56:39AM -0300, Mauro Carvalho Chehab wrote:
> ...
> 
> > diff --git a/include/media/media-entity.h b/include/media/media-entity.h
> > index 8b21a4d920d9..478d5cd56be9 100644
> > --- a/include/media/media-entity.h
> > +++ b/include/media/media-entity.h
> > @@ -126,6 +126,8 @@ struct media_entity_graph {
> >  	int top;
> >  };
> > 
> > +#define entity_id(entity) ((entity)->id)
> > +
> >  int media_entity_init(struct media_entity *entity, u16 num_pads,
> >  		struct media_pad *pads);
> >  
> >  void media_entity_cleanup(struct media_entity *entity);
> 
> media-entity.h is a pretty widely included header file. Perhaps we should
> think about the naming a bit.
> 
> All the other names in the header begin with media (or __media); I'd very
> much prefer not changing that pattern.

I'd prefer naming it media_entity_id() as well.

Slightly nitpicking, wouldn't it also be better to make it a static inline 
function instead of a macro to ensure type safety ? No strong preference 
though.

-- 
Regards,

Laurent Pinchart


^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [PATCH v4 4/6] media: use media_graph_obj inside entities
  2015-08-14 14:56 ` [PATCH v4 4/6] media: use media_graph_obj inside entities Mauro Carvalho Chehab
  2015-08-14 15:07   ` Hans Verkuil
@ 2015-08-14 22:12   ` Sakari Ailus
  1 sibling, 0 replies; 27+ messages in thread
From: Sakari Ailus @ 2015-08-14 22:12 UTC (permalink / raw)
  To: Mauro Carvalho Chehab; +Cc: Linux Media Mailing List, Mauro Carvalho Chehab

Hi Mauro,

On Fri, Aug 14, 2015 at 11:56:41AM -0300, Mauro Carvalho Chehab wrote:
> As entities are graph elements, let's embeed media_graph_obj
> on it. That ensures an unique ID for entities that can be
> global along the entire media controller.
> 
> For now, we'll keep the already existing entity ID. Such
> field need to be dropped on some point, but for now, let's
> not do this, to avoid needing to review all drivers and
> the userspace apps.
> 
> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
> 
> diff --git a/drivers/media/media-device.c b/drivers/media/media-device.c
> index b9382f06044a..f06b08392007 100644
> --- a/drivers/media/media-device.c
> +++ b/drivers/media/media-device.c
> @@ -377,7 +377,6 @@ int __must_check __media_device_register(struct media_device *mdev,
>  	if (WARN_ON(mdev->dev == NULL || mdev->model[0] == 0))
>  		return -EINVAL;
>  
> -	mdev->entity_id = 1;
>  	INIT_LIST_HEAD(&mdev->entities);
>  	spin_lock_init(&mdev->lock);
>  	mutex_init(&mdev->graph_mutex);
> @@ -431,11 +430,9 @@ int __must_check media_device_register_entity(struct media_device *mdev,
>  	entity->parent = mdev;
>  
>  	spin_lock(&mdev->lock);
> -	if (entity->id == 0)
> -		entity->id = mdev->entity_id++;
> -	else
> -		mdev->entity_id = max(entity->id + 1, mdev->entity_id);
> -	list_add_tail(&entity->list, &mdev->entities);
> +	/* Initialize media_graph_obj embedded at the entity */
> +	graph_obj_init(mdev, MEDIA_GRAPH_ENTITY, &entity->graph_obj);
> +
>  	spin_unlock(&mdev->lock);
>  
>  	return 0;
> @@ -457,6 +454,7 @@ void media_device_unregister_entity(struct media_entity *entity)
>  		return;
>  
>  	spin_lock(&mdev->lock);
> +	graph_obj_remove(&entity->graph_obj);
>  	list_del(&entity->list);
>  	spin_unlock(&mdev->lock);
>  	entity->parent = NULL;
> diff --git a/drivers/media/media-entity.c b/drivers/media/media-entity.c
> index 046f1fe40b50..c06546509a89 100644
> --- a/drivers/media/media-entity.c
> +++ b/drivers/media/media-entity.c
> @@ -43,8 +43,12 @@ void graph_obj_init(struct media_device *mdev,
>  			   enum media_graph_type type,
>  			   struct media_graph_obj *gobj)
>  {
> -	/* An unique object ID will be provided on next patches */
> +	/* Create a per-type unique object ID */
>  	gobj->id = type << 24;
> +	switch (type) {
> +	case MEDIA_GRAPH_ENTITY:
> +		gobj->id |= ++mdev->entity_id;
> +	}
>  }
>  
>  /**
> diff --git a/include/media/media-device.h b/include/media/media-device.h
> index 6e6db78f1ee2..35634c0da362 100644
> --- a/include/media/media-device.h
> +++ b/include/media/media-device.h
> @@ -41,7 +41,7 @@ struct device;
>   * @bus_info:	Unique and stable device location identifier
>   * @hw_revision: Hardware device revision
>   * @driver_version: Device driver version
> - * @entity_id:	ID of the next entity to be registered
> + * @entity_id:	Unique ID used on the last entity registered
>   * @entities:	List of registered entities
>   * @lock:	Entities list lock
>   * @graph_mutex: Entities graph operation lock
> @@ -68,7 +68,9 @@ struct media_device {
>  	u32 hw_revision;
>  	u32 driver_version;
>  
> +	/* Unique object ID counter */

I think the KernelDoc above should be enough.

>  	u32 entity_id;
> +
>  	struct list_head entities;
>  
>  	/* Protects the entities list */
> diff --git a/include/media/media-entity.h b/include/media/media-entity.h
> index 58938bb980fe..2c775f3ef24f 100644
> --- a/include/media/media-entity.h
> +++ b/include/media/media-entity.h
> @@ -33,10 +33,10 @@
>  /**
>   * enum media_graph_type - type of a graph element
>   *
> + * @MEDIA_GRAPH_ENTITY:		Identify a media entity
>   */
>  enum media_graph_type {
> -	 /* FIXME: add the types here, as we embeed media_graph_obj */
> -	MEDIA_GRAPH_NONE
> +	MEDIA_GRAPH_ENTITY,
>  };
>  
>  
> @@ -88,10 +88,9 @@ struct media_entity_operations {
>  };
>  
>  struct media_entity {
> +	struct media_graph_obj graph_obj;
>  	struct list_head list;
>  	struct media_device *parent;	/* Media device this entity belongs to*/
> -	u32 id;				/* Entity ID, unique in the parent media
> -					 * device context */
>  	const char *name;		/* Entity name */
>  	u32 type;			/* Entity type (MEDIA_ENT_T_*) */
>  	u32 revision;			/* Entity revision, driver specific */
> @@ -153,7 +152,7 @@ struct media_entity_graph {
>  	int top;
>  };
>  
> -#define entity_id(entity) ((entity)->id)
> +#define entity_id(entity) ((entity)->graph_obj.id)
>  
>  #define gobj_to_entity(gobj) \
>  		container_of(gobj, struct media_entity, graph_obj)

-- 
Regards,

Sakari Ailus
e-mail: sakari.ailus@iki.fi	XMPP: sailus@retiisi.org.uk

^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [PATCH v4 5/6] media: use media_graph_obj inside pads
  2015-08-14 14:56 ` [PATCH v4 5/6] media: use media_graph_obj inside pads Mauro Carvalho Chehab
  2015-08-14 15:10   ` Hans Verkuil
@ 2015-08-14 22:15   ` Sakari Ailus
  1 sibling, 0 replies; 27+ messages in thread
From: Sakari Ailus @ 2015-08-14 22:15 UTC (permalink / raw)
  To: Mauro Carvalho Chehab; +Cc: Linux Media Mailing List, Mauro Carvalho Chehab

Hi Mauro,

On Fri, Aug 14, 2015 at 11:56:42AM -0300, Mauro Carvalho Chehab wrote:
> @@ -448,6 +456,7 @@ EXPORT_SYMBOL_GPL(media_device_register_entity);
>   */
>  void media_device_unregister_entity(struct media_entity *entity)
>  {
> +	int i;

I'd declare temporary variables as last.

>  	struct media_device *mdev = entity->parent;
>  
>  	if (mdev == NULL)

-- 
Regards,

Sakari Ailus
e-mail: sakari.ailus@iki.fi	XMPP: sailus@retiisi.org.uk

^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [PATCH v4 0/6] MC preparation patches
  2015-08-14 14:56 [PATCH v4 0/6] MC preparation patches Mauro Carvalho Chehab
                   ` (5 preceding siblings ...)
  2015-08-14 14:56 ` [PATCH v4 6/6] media: use media_graph_obj inside links Mauro Carvalho Chehab
@ 2015-08-14 22:37 ` Sakari Ailus
  2015-08-14 23:27   ` Mauro Carvalho Chehab
  6 siblings, 1 reply; 27+ messages in thread
From: Sakari Ailus @ 2015-08-14 22:37 UTC (permalink / raw)
  To: Mauro Carvalho Chehab; +Cc: Linux Media Mailing List, Mauro Carvalho Chehab

Hi Mauro,

On Fri, Aug 14, 2015 at 11:56:37AM -0300, Mauro Carvalho Chehab wrote:
> Those are the initial patches from my previous series of MC changes.
> 
> The first patch removes an unused parameter when creating links.
> 
> The next 5 patches warrant that all object types (entities, pads and
> links) will have an unique ID, as agreed at the MC workshop.
> 
> They prepare for the addition of the media interfaces and interface
> links.

Having looked the set through, I don't think the patches in the set are
strictly necessary for adding media interfaces. Again, I need to stress I'd
very much prefer to keep things simple in order to get support for media
interfaces in soon, as I understand your intention is as well.

We could make things more dynamic later on, and represent associations using
links --- if there's a use case for that.

I don't as such object the patchset, but my question is: where will this all
lead to? I'd like to see that, or at least some more, before finally acking
the patches. I sense these should be closely related to supporting the
property API rather than media interfaces (or DVB), but unfortunately I
won't have time to work on the property API for the following ~ three weeks.

struct media_interface could be pointed to from entities using a statically
allocated array of pointers, a bit like links (except that they're not
pointers). I think we'd get quite far with this already while making much
fewer changes to the framework.

One thing that wasn't discussed at length in the meeting, but which I
understood was generally agreed on, was DMA engines as entities (vs. having
a pad for the sake of the interface in the video node entity, which is
ugly). IMHO a sound foundation is important for the proposed changes.

Just my one euro cent --- got some left from Italy. :-)

-- 
Kind regards,

Sakari Ailus
e-mail: sakari.ailus@iki.fi	XMPP: sailus@retiisi.org.uk

^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [PATCH v4 0/6] MC preparation patches
  2015-08-14 22:37 ` [PATCH v4 0/6] MC preparation patches Sakari Ailus
@ 2015-08-14 23:27   ` Mauro Carvalho Chehab
  0 siblings, 0 replies; 27+ messages in thread
From: Mauro Carvalho Chehab @ 2015-08-14 23:27 UTC (permalink / raw)
  To: Sakari Ailus; +Cc: Linux Media Mailing List, Mauro Carvalho Chehab

Em Sat, 15 Aug 2015 01:37:44 +0300
Sakari Ailus <sakari.ailus@iki.fi> escreveu:

> Hi Mauro,
> 
> On Fri, Aug 14, 2015 at 11:56:37AM -0300, Mauro Carvalho Chehab wrote:
> > Those are the initial patches from my previous series of MC changes.
> > 
> > The first patch removes an unused parameter when creating links.
> > 
> > The next 5 patches warrant that all object types (entities, pads and
> > links) will have an unique ID, as agreed at the MC workshop.
> > 
> > They prepare for the addition of the media interfaces and interface
> > links.
> 
> Having looked the set through, I don't think the patches in the set are
> strictly necessary for adding media interfaces. Again, I need to stress I'd
> very much prefer to keep things simple in order to get support for media
> interfaces in soon, as I understand your intention is as well.

Well, the new API we've agreed requires unique IDs. So, those patches are
a mandatory requirement. Also, the ID is a requirement for links (see
patch 9/16 and latter patches on my RFC v3).

> We could make things more dynamic later on, and represent associations using
> links --- if there's a use case for that.
> 
> I don't as such object the patchset, but my question is: where will this all
> lead to? I'd like to see that, or at least some more, before finally acking
> the patches. I sense these should be closely related to supporting the
> property API rather than media interfaces (or DVB), but unfortunately I
> won't have time to work on the property API for the following ~ three weeks.

Well my goals are different then yours and so my test environment.

Currently, I have only the hybrid PC-consumer TV devices handy for test
and my goal is to address what's needed for them to be properly and fully
supported. Nothing more, nothing less.

Yet, I'm aiming to future support TV sets and Set Top Boxes. Even the
simpler of such hardware would be at least 4x or 5x more complex than
a PC consumer devices. So, whenever I need to take some design decision,
I'll have those complex hardware in mind.

With regards to properties, I don't intend to touch on them. Those are
on your action items, so I'm counting that you'll be doing that ;)

I might need to add something to internally replace the entity->type on
some future patch, but I'm not there yet, and, if I need to do, I'll
try to do the minimal amount required for my patches to work.

> struct media_interface could be pointed to from entities using a statically
> allocated array of pointers, a bit like links (except that they're not
> pointers). I think we'd get quite far with this already while making much
> fewer changes to the framework.

No, I won't be coding links using arrays, nor using a different
struct to represent the links. We need dynamic link addition/removal.
Doing it using realloc would fragment the memory and cause lots of
harm.

So, my plan is do it right, in a way that will allow us to share the
same code and data model, and to future allow graph traversals though
interface links too. Graph traversal using both pad/pad and interface/entity
links is needed to properly address conflicts when multiple drivers and
multiple interfaces may control the same piece of the hardware.

> One thing that wasn't discussed at length in the meeting, but which I
> understood was generally agreed on, was DMA engines as entities (vs. having
> a pad for the sake of the interface in the video node entity, which is
> ugly). IMHO a sound foundation is important for the proposed changes.

Not sure if I understood. Anyway, the comments below are actually
unrelated to this patch series, and looks more like a RFC ;)

---

At the V4L2 case, DMA engines will be mapped as entities (on non-USB
hardware). We still need to agree how we'll name such entities.

It should be noticed that:

- On V4L2, the video/VBI stream output is not the DMA engine. The DMA
engine is actually linked to the USB EHCI/UHCI/xHCI driver. the
USB driver sends a block of data to the V4L2 driver, with decapsulate
the data packages and copy into a transfer buffer. Such buffer
is mapped to userspace or made available via I/O (read() sysctl).

- Some hardware may not provide a stream sink. This is the case of
  DVB devices that are compliant with the ETSI encryption standards.
  All userspace can do is to control the pipeline to direct the
  unencrypted streams to the GPU and to the ASoC hardware;

- On DVB, the DMA is internal to the Kernel, even on PCI/SoC
  hardware. The Kernel splits the Transport Stream data into
  several ring buffers. The ring buffers are sent to userspace -
  currently, only via I/O (read() sysctl. We're planning to improve
  it, but we need to keep supporting the old way, as several hardware
  can only work on that mode;

- On Radio, it may or may not have DMA. Some devices work via
  reading the audio samples on some register. This can even be done
  on some firmware inside the device. The radio output can be:
	- a wire from the radio board into the Motherboard's audio
	  card;
	- an I/O read() operation at ALSA.

So, I won't be calling the hardware that may or may not be doing
DMA as "DMA". I guess we can simply call it as:

For output:
	- video stream output
	- vbi stream output
	- TS stream output
	- audio stream playback

For input:
	- video stream capture
	- vbi stream capture
	- TS stream capture
	- audio stream capture

Or something equivalent.

Just my 2 euro cents ;)


> 
> Just my one euro cent --- got some left from Italy. :-)
> 

^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [PATCH v4 3/6] media: add a common struct to be embed on media graph objects
  2015-08-14 21:25   ` Sakari Ailus
@ 2015-08-15 14:56     ` Mauro Carvalho Chehab
  2015-08-15 16:42       ` Laurent Pinchart
  0 siblings, 1 reply; 27+ messages in thread
From: Mauro Carvalho Chehab @ 2015-08-15 14:56 UTC (permalink / raw)
  To: Sakari Ailus; +Cc: Linux Media Mailing List, Mauro Carvalho Chehab

Em Sat, 15 Aug 2015 00:25:15 +0300
Sakari Ailus <sakari.ailus@iki.fi> escreveu:

> Hi Mauro,
> 
> On Fri, Aug 14, 2015 at 11:56:40AM -0300, Mauro Carvalho Chehab wrote:
> > Due to the MC API proposed changes, we'll need to have an unique
> > object ID for all graph objects, and have some shared fields
> > that will be common on all media graph objects.
> > 
> > Right now, the only common object is the object ID, but other
> > fields will be added latter on.
> > 
> > Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
> > 
> > diff --git a/drivers/media/media-entity.c b/drivers/media/media-entity.c
> > index b8102bda664d..046f1fe40b50 100644
> > --- a/drivers/media/media-entity.c
> > +++ b/drivers/media/media-entity.c
> > @@ -27,6 +27,39 @@
> >  #include <media/media-device.h>
> >  
> >  /**
> > + *  graph_obj_init - Initialize a graph object
> > + *
> > + * @mdev:	Pointer to the media_device that contains the object
> > + * @type:	Type of the object
> > + * @gobj:	Pointer to the object
> > + *
> > + * This routine initializes the embedded struct media_graph_obj inside a
> > + * media graph object. It is called automatically if media_*_create()
> > + * calls are used. However, if the object (entity, link, pad, interface)
> > + * is embedded on some other object, this function should be called before
> > + * registering the object at the media controller.
> > + */
> > +void graph_obj_init(struct media_device *mdev,
> > +			   enum media_graph_type type,
> > +			   struct media_graph_obj *gobj)
> > +{
> > +	/* An unique object ID will be provided on next patches */
> > +	gobj->id = type << 24;
> 
> Ugh. This will mean the object IDs are going to be huge to begin with,
> ending up being a nuisance to work with as you often write them by hand. Do
> we win anything by doing so?

There is a problem on the current implementation of the graph: it uses
a bitmap in order to detect if the graph traversal entered inside a loop.
Also, one of the drivers (vsp1, I think) assumes that the maximum ID
for an entity is 31 (as it uses 1 << entity->id).

Due to that, we should have a separate range for entities starting from
0. 

That should not affect neither debug printks or userspace, provided that
the object type is known, as one could always do:

#define gobj_id(gobj) ( (gobj)->id & ( (1 << 25) - 1) )

dev_dbg(mdev->dev, "MC create: %s#%d\n",
        gobj_type[media_gobj_type(gobj)],
        gobj_id(gobj));


in order to report the ID into a reasonable range.

I'm actually doing that on some debug patches I'm writing right now
in order to allow me to test object creation/removal.

Regards,
Mauro

^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [PATCH v4 3/6] media: add a common struct to be embed on media graph objects
  2015-08-15 14:56     ` Mauro Carvalho Chehab
@ 2015-08-15 16:42       ` Laurent Pinchart
  2015-08-16 11:41         ` Mauro Carvalho Chehab
  0 siblings, 1 reply; 27+ messages in thread
From: Laurent Pinchart @ 2015-08-15 16:42 UTC (permalink / raw)
  To: Mauro Carvalho Chehab
  Cc: Sakari Ailus, Linux Media Mailing List, Mauro Carvalho Chehab

Hi Mauro,

On Saturday 15 August 2015 11:56:18 Mauro Carvalho Chehab wrote:
> Em Sat, 15 Aug 2015 00:25:15 +0300 Sakari Ailus escreveu:
> > On Fri, Aug 14, 2015 at 11:56:40AM -0300, Mauro Carvalho Chehab wrote:
> > > Due to the MC API proposed changes, we'll need to have an unique
> > > object ID for all graph objects, and have some shared fields
> > > that will be common on all media graph objects.
> > > 
> > > Right now, the only common object is the object ID, but other
> > > fields will be added latter on.
> > > 
> > > Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
> > > 
> > > diff --git a/drivers/media/media-entity.c b/drivers/media/media-entity.c
> > > index b8102bda664d..046f1fe40b50 100644
> > > --- a/drivers/media/media-entity.c
> > > +++ b/drivers/media/media-entity.c
> > > @@ -27,6 +27,39 @@
> > > 
> > >  #include <media/media-device.h>
> > >  
> > >  /**
> > > + *  graph_obj_init - Initialize a graph object
> > > + *
> > > + * @mdev:	Pointer to the media_device that contains the object
> > > + * @type:	Type of the object
> > > + * @gobj:	Pointer to the object
> > > + *
> > > + * This routine initializes the embedded struct media_graph_obj inside
> > > a
> > > + * media graph object. It is called automatically if media_*_create()
> > > + * calls are used. However, if the object (entity, link, pad,
> > > interface)
> > > + * is embedded on some other object, this function should be called
> > > before
> > > + * registering the object at the media controller.
> > > + */
> > > +void graph_obj_init(struct media_device *mdev,
> > > +			   enum media_graph_type type,
> > > +			   struct media_graph_obj *gobj)
> > > +{
> > > +	/* An unique object ID will be provided on next patches */
> > > +	gobj->id = type << 24;
> > 
> > Ugh. This will mean the object IDs are going to be huge to begin with,
> > ending up being a nuisance to work with as you often write them by hand.
> > Do we win anything by doing so?
> 
> There is a problem on the current implementation of the graph: it uses
> a bitmap in order to detect if the graph traversal entered inside a loop.
> Also, one of the drivers (vsp1, I think) assumes that the maximum ID
> for an entity is 31 (as it uses 1 << entity->id).

If core code or drivers do the wrong thing they should be fixed instead of 
working around the problem.

A fixed bitmap in the graph walk will just not scale when we'll add support 
for dynamically adding or removing entities. We thus need to change the 
algorithm anyway.

The OMAP3 ISP and VSP1 drivers could use fixed size bitmaps as they won't 
support dynamic addition or removal of entities, so the maximum ID will be 
known at init time.

For other drivers that have similar needs core helper functions would probably 
be helpful.

> Due to that, we should have a separate range for entities starting from
> 0.
> 
> That should not affect neither debug printks or userspace, provided that
> the object type is known, as one could always do:
> 
> #define gobj_id(gobj) ( (gobj)->id & ( (1 << 25) - 1) )
> 
> dev_dbg(mdev->dev, "MC create: %s#%d\n",
>         gobj_type[media_gobj_type(gobj)],
>         gobj_id(gobj));
> 
> 
> in order to report the ID into a reasonable range.
> 
> I'm actually doing that on some debug patches I'm writing right now
> in order to allow me to test object creation/removal.

-- 
Regards,

Laurent Pinchart


^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [PATCH v4 3/6] media: add a common struct to be embed on media graph objects
  2015-08-15 16:42       ` Laurent Pinchart
@ 2015-08-16 11:41         ` Mauro Carvalho Chehab
  0 siblings, 0 replies; 27+ messages in thread
From: Mauro Carvalho Chehab @ 2015-08-16 11:41 UTC (permalink / raw)
  To: Laurent Pinchart
  Cc: Sakari Ailus, Linux Media Mailing List, Mauro Carvalho Chehab

Em Sat, 15 Aug 2015 19:42:59 +0300
Laurent Pinchart <laurent.pinchart@ideasonboard.com> escreveu:

> Hi Mauro,
> 
> On Saturday 15 August 2015 11:56:18 Mauro Carvalho Chehab wrote:
> > Em Sat, 15 Aug 2015 00:25:15 +0300 Sakari Ailus escreveu:
> > > On Fri, Aug 14, 2015 at 11:56:40AM -0300, Mauro Carvalho Chehab wrote:
> > > > Due to the MC API proposed changes, we'll need to have an unique
> > > > object ID for all graph objects, and have some shared fields
> > > > that will be common on all media graph objects.
> > > > 
> > > > Right now, the only common object is the object ID, but other
> > > > fields will be added latter on.
> > > > 
> > > > Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
> > > > 
> > > > diff --git a/drivers/media/media-entity.c b/drivers/media/media-entity.c
> > > > index b8102bda664d..046f1fe40b50 100644
> > > > --- a/drivers/media/media-entity.c
> > > > +++ b/drivers/media/media-entity.c
> > > > @@ -27,6 +27,39 @@
> > > > 
> > > >  #include <media/media-device.h>
> > > >  
> > > >  /**
> > > > + *  graph_obj_init - Initialize a graph object
> > > > + *
> > > > + * @mdev:	Pointer to the media_device that contains the object
> > > > + * @type:	Type of the object
> > > > + * @gobj:	Pointer to the object
> > > > + *
> > > > + * This routine initializes the embedded struct media_graph_obj inside
> > > > a
> > > > + * media graph object. It is called automatically if media_*_create()
> > > > + * calls are used. However, if the object (entity, link, pad,
> > > > interface)
> > > > + * is embedded on some other object, this function should be called
> > > > before
> > > > + * registering the object at the media controller.
> > > > + */
> > > > +void graph_obj_init(struct media_device *mdev,
> > > > +			   enum media_graph_type type,
> > > > +			   struct media_graph_obj *gobj)
> > > > +{
> > > > +	/* An unique object ID will be provided on next patches */
> > > > +	gobj->id = type << 24;
> > > 
> > > Ugh. This will mean the object IDs are going to be huge to begin with,
> > > ending up being a nuisance to work with as you often write them by hand.
> > > Do we win anything by doing so?
> > 
> > There is a problem on the current implementation of the graph: it uses
> > a bitmap in order to detect if the graph traversal entered inside a loop.
> > Also, one of the drivers (vsp1, I think) assumes that the maximum ID
> > for an entity is 31 (as it uses 1 << entity->id).
> 
> If core code or drivers do the wrong thing they should be fixed instead of 
> working around the problem.
> 
> A fixed bitmap in the graph walk will just not scale when we'll add support 
> for dynamically adding or removing entities. We thus need to change the 
> algorithm anyway.

Yes, but such change can happen latter, when we add support for dynamic
entity add/removal.

> The OMAP3 ISP and VSP1 drivers could use fixed size bitmaps as they won't 
> support dynamic addition or removal of entities, so the maximum ID will be 
> known at init time.

This is true only if we keep the current ID range for entities, as my
patches are doing. If we use a global ID range for all element graphs, 
the risk of breaking OMAP3 and VSP1 are high.

So, at least for now, we need to preserve the current ID range for
entities.

This could be changed on some future patch, but the one doing such
change would need to have OMAP3 and VSP1 drivers in order to check if
the changes won't break them. If I were to do such changes there, I would
actually try to move those driver-specific graph traversal code to the core,
as having those spread on drivers make harder to do some core changes.

> For other drivers that have similar needs core helper functions would probably 
> be helpful.
> 
> > Due to that, we should have a separate range for entities starting from
> > 0.
> > 
> > That should not affect neither debug printks or userspace, provided that
> > the object type is known, as one could always do:
> > 
> > #define gobj_id(gobj) ( (gobj)->id & ( (1 << 25) - 1) )
> > 
> > dev_dbg(mdev->dev, "MC create: %s#%d\n",
> >         gobj_type[media_gobj_type(gobj)],
> >         gobj_id(gobj));
> > 
> > 
> > in order to report the ID into a reasonable range.
> > 
> > I'm actually doing that on some debug patches I'm writing right now
> > in order to allow me to test object creation/removal.
> 

^ permalink raw reply	[flat|nested] 27+ messages in thread

end of thread, other threads:[~2015-08-16 11:41 UTC | newest]

Thread overview: 27+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-08-14 14:56 [PATCH v4 0/6] MC preparation patches Mauro Carvalho Chehab
2015-08-14 14:56 ` [PATCH v4 1/6] media: get rid of unused "extra_links" param on media_entity_init() Mauro Carvalho Chehab
2015-08-14 14:59   ` Hans Verkuil
2015-08-14 15:16   ` Laurent Pinchart
2015-08-14 14:56 ` [PATCH v4 2/6] media: create a macro to get entity ID Mauro Carvalho Chehab
2015-08-14 15:02   ` Hans Verkuil
2015-08-14 21:08   ` Sakari Ailus
2015-08-14 21:48     ` Laurent Pinchart
2015-08-14 14:56 ` [PATCH v4 3/6] media: add a common struct to be embed on media graph objects Mauro Carvalho Chehab
2015-08-14 15:03   ` Hans Verkuil
2015-08-14 21:25   ` Sakari Ailus
2015-08-15 14:56     ` Mauro Carvalho Chehab
2015-08-15 16:42       ` Laurent Pinchart
2015-08-16 11:41         ` Mauro Carvalho Chehab
2015-08-14 14:56 ` [PATCH v4 4/6] media: use media_graph_obj inside entities Mauro Carvalho Chehab
2015-08-14 15:07   ` Hans Verkuil
2015-08-14 22:12   ` Sakari Ailus
2015-08-14 14:56 ` [PATCH v4 5/6] media: use media_graph_obj inside pads Mauro Carvalho Chehab
2015-08-14 15:10   ` Hans Verkuil
2015-08-14 22:15   ` Sakari Ailus
2015-08-14 14:56 ` [PATCH v4 6/6] media: use media_graph_obj inside links Mauro Carvalho Chehab
2015-08-14 15:18   ` Hans Verkuil
2015-08-14 15:33     ` Hans Verkuil
2015-08-14 16:19       ` Mauro Carvalho Chehab
2015-08-14 16:15     ` Mauro Carvalho Chehab
2015-08-14 22:37 ` [PATCH v4 0/6] MC preparation patches Sakari Ailus
2015-08-14 23:27   ` Mauro Carvalho Chehab

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).