linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 00/10] [media] Some cleanup and fixes for MC next gen patches
@ 2015-12-11 17:16 Javier Martinez Canillas
  2015-12-11 17:16 ` [PATCH 01/10] [media] omap3isp: remove per ISP module link creation functions Javier Martinez Canillas
                   ` (9 more replies)
  0 siblings, 10 replies; 11+ messages in thread
From: Javier Martinez Canillas @ 2015-12-11 17:16 UTC (permalink / raw)
  To: linux-kernel
  Cc: Mauro Carvalho Chehab, Shuah Khan, Sakari Ailus,
	Laurent Pinchart, Hans Verkuil, linux-media,
	Javier Martinez Canillas

Hello,

This series contains some cleanup and fixes for the MC next gen patches [0].

These addresses all the issues pointed out by Laurent and Sakari in patches
authored by me:

d125aeaa74da [media] media: don't try to empty links list in media_entity_cleanup()
46b30ba56a89 [media] uvcvideo: create pad links after subdev registration
eb9e99898333 [media] v4l: vsp1: separate links creation from entities init
5929e3a39544 [media] staging: omap4iss: separate links creation from entities init
f7cc083b0f0d [media] omap3isp: create links after all subdevs have been bound
bc36b30fe06b [media] omap3isp: separate links creation from entities init

and also for one issue in patch (authored by Mauro):

86ee417578a2 [media] media: convert links from array to list

The sha-1 ids are from the media_tree's media-controller branch [1].

This is not the full of the fixes since Mauro is going to post his patches
too but I tested rebasing on top of his media-controller-rc3 branch [3] and
there are no conflicts so it should be safe to post separately.

The patches were tested on an OMAP3 IGEPv2 that has a TVP5151 video encoder
and an Exynos5800 Peach Pi Chromebook that contains a UVC WebCam. For each
patch, the topology was retrieved with media-ctl -p and video capture was
tested using the yavta tool.

NOTE: I'm leaving for holidays tonight and I'll be back on December 20th so
I may not be able to answer and address any feedback before that day, sorry
about that.

[0]: https://www.mail-archive.com/linux-media@vger.kernel.org/msg94222.html
[1]: http://git.linuxtv.org/media_tree.git/log/?h=media-controller
[2]: http://git.linuxtv.org/mchehab/experimental.git/log/?h=media-controller-rc3

Best regards,
Javier


Javier Martinez Canillas (10):
  [media] omap3isp: remove per ISP module link creation functions
  [media] omap3isp: remove pads prefix from isp_create_pads_links()
  [media] omap3isp: rename single labels to just error
  [media] omap3isp: consistently use v4l2_dev var in complete notifier
  [media] staging: omap4iss: remove pads prefix from
    *_create_pads_links()
  [media] v4l: vsp1: remove pads prefix from *_create_pads_links()
  [media] v4l: vsp1: use else if instead of continue when creating links
  [media] uvcvideo: remove pads prefix from uvc_mc_create_pads_links()
  [media] uvcvideo: register entity subdev on init
  [media] media-entity: remove unneded enclosing parenthesis

 drivers/media/media-entity.c                 |  4 +-
 drivers/media/platform/omap3isp/isp.c        | 70 +++++++++++++++++-----------
 drivers/media/platform/omap3isp/ispccdc.c    | 18 +------
 drivers/media/platform/omap3isp/ispccdc.h    |  1 -
 drivers/media/platform/omap3isp/ispccp2.c    | 18 +------
 drivers/media/platform/omap3isp/ispccp2.h    |  1 -
 drivers/media/platform/omap3isp/ispcsi2.c    | 14 ------
 drivers/media/platform/omap3isp/ispcsi2.h    |  1 -
 drivers/media/platform/omap3isp/isppreview.c | 20 --------
 drivers/media/platform/omap3isp/isppreview.h |  1 -
 drivers/media/platform/omap3isp/ispresizer.c | 20 --------
 drivers/media/platform/omap3isp/ispresizer.h |  1 -
 drivers/media/platform/vsp1/vsp1_drv.c       | 18 +++----
 drivers/media/platform/vsp1/vsp1_rpf.c       |  4 +-
 drivers/media/platform/vsp1/vsp1_rwpf.h      |  4 +-
 drivers/media/platform/vsp1/vsp1_wpf.c       |  4 +-
 drivers/media/usb/uvc/uvc_entity.c           | 39 +++++-----------
 drivers/staging/media/omap4iss/iss.c         | 12 ++---
 drivers/staging/media/omap4iss/iss_csi2.c    |  4 +-
 drivers/staging/media/omap4iss/iss_csi2.h    |  2 +-
 drivers/staging/media/omap4iss/iss_ipipeif.c |  4 +-
 drivers/staging/media/omap4iss/iss_ipipeif.h |  2 +-
 drivers/staging/media/omap4iss/iss_resizer.c |  4 +-
 drivers/staging/media/omap4iss/iss_resizer.h |  2 +-
 24 files changed, 90 insertions(+), 178 deletions(-)

-- 
2.4.3


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

* [PATCH 01/10] [media] omap3isp: remove per ISP module link creation functions
  2015-12-11 17:16 [PATCH 00/10] [media] Some cleanup and fixes for MC next gen patches Javier Martinez Canillas
@ 2015-12-11 17:16 ` Javier Martinez Canillas
  2015-12-11 17:16 ` [PATCH 02/10] [media] omap3isp: remove pads prefix from isp_create_pads_links() Javier Martinez Canillas
                   ` (8 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: Javier Martinez Canillas @ 2015-12-11 17:16 UTC (permalink / raw)
  To: linux-kernel
  Cc: Mauro Carvalho Chehab, Shuah Khan, Sakari Ailus,
	Laurent Pinchart, Hans Verkuil, linux-media,
	Javier Martinez Canillas

The entities to video nodes links were created on separate functions for
each ISP module but since the only thing that these functions do is to
call media_create_pad_link(), there's no need for that indirection level
and all link creation logic can be just inlined in the caller function.

Also, since the only possible failure for the link creation is a memory
allocation, there is no need for error messages since the core already
reports a very verbose message in that case.

Suggested-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com>

---

This patch addresses 3 of the issues Laurent pointed in patch [0]:

1- Inline entity to video node links creation in the caller.
2- Remove error messages if links creation failed.
3- Replace comment for links between entities.

[0]: https://patchwork.linuxtv.org/patch/31147/

 drivers/media/platform/omap3isp/isp.c        | 56 +++++++++++++++++-----------
 drivers/media/platform/omap3isp/ispccdc.c    | 14 -------
 drivers/media/platform/omap3isp/ispccdc.h    |  1 -
 drivers/media/platform/omap3isp/ispccp2.c    | 14 -------
 drivers/media/platform/omap3isp/ispccp2.h    |  1 -
 drivers/media/platform/omap3isp/ispcsi2.c    | 14 -------
 drivers/media/platform/omap3isp/ispcsi2.h    |  1 -
 drivers/media/platform/omap3isp/isppreview.c | 20 ----------
 drivers/media/platform/omap3isp/isppreview.h |  1 -
 drivers/media/platform/omap3isp/ispresizer.c | 20 ----------
 drivers/media/platform/omap3isp/ispresizer.h |  1 -
 11 files changed, 35 insertions(+), 108 deletions(-)

diff --git a/drivers/media/platform/omap3isp/isp.c b/drivers/media/platform/omap3isp/isp.c
index cb8ac90086c1..40aee11805c7 100644
--- a/drivers/media/platform/omap3isp/isp.c
+++ b/drivers/media/platform/omap3isp/isp.c
@@ -1940,37 +1940,51 @@ static int isp_create_pads_links(struct isp_device *isp)
 {
 	int ret;
 
-	ret = omap3isp_csi2_create_pads_links(isp);
-	if (ret < 0) {
-		dev_err(isp->dev, "CSI2 pads links creation failed\n");
+	/* Create links between entities and video nodes. */
+	ret = media_create_pad_link(
+			&isp->isp_csi2a.subdev.entity, CSI2_PAD_SOURCE,
+			&isp->isp_csi2a.video_out.video.entity, 0, 0);
+	if (ret < 0)
 		return ret;
-	}
 
-	ret = omap3isp_ccp2_create_pads_links(isp);
-	if (ret < 0) {
-		dev_err(isp->dev, "CCP2 pads links creation failed\n");
+	ret = media_create_pad_link(
+			&isp->isp_ccp2.video_in.video.entity, 0,
+			&isp->isp_ccp2.subdev.entity, CCP2_PAD_SINK, 0);
+	if (ret < 0)
 		return ret;
-	}
 
-	ret = omap3isp_ccdc_create_pads_links(isp);
-	if (ret < 0) {
-		dev_err(isp->dev, "CCDC pads links creation failed\n");
+	ret = media_create_pad_link(
+			&isp->isp_ccdc.subdev.entity, CCDC_PAD_SOURCE_OF,
+			&isp->isp_ccdc.video_out.video.entity, 0, 0);
+	if (ret < 0)
 		return ret;
-	}
 
-	ret = omap3isp_preview_create_pads_links(isp);
-	if (ret < 0) {
-		dev_err(isp->dev, "Preview pads links creation failed\n");
+	ret = media_create_pad_link(
+			&isp->isp_prev.video_in.video.entity, 0,
+			&isp->isp_prev.subdev.entity, PREV_PAD_SINK, 0);
+	if (ret < 0)
 		return ret;
-	}
 
-	ret = omap3isp_resizer_create_pads_links(isp);
-	if (ret < 0) {
-		dev_err(isp->dev, "Resizer pads links creation failed\n");
+	ret = media_create_pad_link(
+			&isp->isp_prev.subdev.entity, PREV_PAD_SOURCE,
+			&isp->isp_prev.video_out.video.entity, 0, 0);
+	if (ret < 0)
+		return ret;
+
+	ret = media_create_pad_link(
+			&isp->isp_res.video_in.video.entity, 0,
+			&isp->isp_res.subdev.entity, RESZ_PAD_SINK, 0);
+	if (ret < 0)
+		return ret;
+
+	ret = media_create_pad_link(
+			&isp->isp_res.subdev.entity, RESZ_PAD_SOURCE,
+			&isp->isp_res.video_out.video.entity, 0, 0);
+
+	if (ret < 0)
 		return ret;
-	}
 
-	/* Connect the submodules. */
+	/* Create links between entities. */
 	ret = media_create_pad_link(
 			&isp->isp_csi2a.subdev.entity, CSI2_PAD_SOURCE,
 			&isp->isp_ccdc.subdev.entity, CCDC_PAD_SINK, 0);
diff --git a/drivers/media/platform/omap3isp/ispccdc.c b/drivers/media/platform/omap3isp/ispccdc.c
index 749462c1af8e..5e16b5f594b7 100644
--- a/drivers/media/platform/omap3isp/ispccdc.c
+++ b/drivers/media/platform/omap3isp/ispccdc.c
@@ -2718,20 +2718,6 @@ int omap3isp_ccdc_init(struct isp_device *isp)
 }
 
 /*
- * omap3isp_ccdc_create_pads_links - CCDC pads links creation
- * @isp : Pointer to ISP device
- * return negative error code or zero on success
- */
-int omap3isp_ccdc_create_pads_links(struct isp_device *isp)
-{
-	struct isp_ccdc_device *ccdc = &isp->isp_ccdc;
-
-	/* Connect the CCDC subdev to the video node. */
-	return media_create_pad_link(&ccdc->subdev.entity, CCDC_PAD_SOURCE_OF,
-				     &ccdc->video_out.video.entity, 0, 0);
-}
-
-/*
  * omap3isp_ccdc_cleanup - CCDC module cleanup.
  * @isp: Device pointer specific to the OMAP3 ISP.
  */
diff --git a/drivers/media/platform/omap3isp/ispccdc.h b/drivers/media/platform/omap3isp/ispccdc.h
index 2128203ef6fb..3440a7097940 100644
--- a/drivers/media/platform/omap3isp/ispccdc.h
+++ b/drivers/media/platform/omap3isp/ispccdc.h
@@ -163,7 +163,6 @@ struct isp_ccdc_device {
 struct isp_device;
 
 int omap3isp_ccdc_init(struct isp_device *isp);
-int omap3isp_ccdc_create_pads_links(struct isp_device *isp);
 void omap3isp_ccdc_cleanup(struct isp_device *isp);
 int omap3isp_ccdc_register_entities(struct isp_ccdc_device *ccdc,
 	struct v4l2_device *vdev);
diff --git a/drivers/media/platform/omap3isp/ispccp2.c b/drivers/media/platform/omap3isp/ispccp2.c
index 59686dd1bb0a..27f5fe4edefc 100644
--- a/drivers/media/platform/omap3isp/ispccp2.c
+++ b/drivers/media/platform/omap3isp/ispccp2.c
@@ -1154,20 +1154,6 @@ int omap3isp_ccp2_init(struct isp_device *isp)
 }
 
 /*
- * omap3isp_ccp2_create_pads_links - CCP2 pads links creation
- * @isp : Pointer to ISP device
- * return negative error code or zero on success
- */
-int omap3isp_ccp2_create_pads_links(struct isp_device *isp)
-{
-	struct isp_ccp2_device *ccp2 = &isp->isp_ccp2;
-
-	/* Connect the video node to the ccp2 subdev. */
-	return media_create_pad_link(&ccp2->video_in.video.entity, 0,
-				     &ccp2->subdev.entity, CCP2_PAD_SINK, 0);
-}
-
-/*
  * omap3isp_ccp2_cleanup - CCP2 un-initialization
  * @isp : Pointer to ISP device
  */
diff --git a/drivers/media/platform/omap3isp/ispccp2.h b/drivers/media/platform/omap3isp/ispccp2.h
index fb74bc67878b..4662bffa79e3 100644
--- a/drivers/media/platform/omap3isp/ispccp2.h
+++ b/drivers/media/platform/omap3isp/ispccp2.h
@@ -79,7 +79,6 @@ struct isp_ccp2_device {
 
 /* Function declarations */
 int omap3isp_ccp2_init(struct isp_device *isp);
-int omap3isp_ccp2_create_pads_links(struct isp_device *isp);
 void omap3isp_ccp2_cleanup(struct isp_device *isp);
 int omap3isp_ccp2_register_entities(struct isp_ccp2_device *ccp2,
 			struct v4l2_device *vdev);
diff --git a/drivers/media/platform/omap3isp/ispcsi2.c b/drivers/media/platform/omap3isp/ispcsi2.c
index 886f148755b0..f75a1be29d84 100644
--- a/drivers/media/platform/omap3isp/ispcsi2.c
+++ b/drivers/media/platform/omap3isp/ispcsi2.c
@@ -1311,20 +1311,6 @@ int omap3isp_csi2_init(struct isp_device *isp)
 }
 
 /*
- * omap3isp_csi2_create_pads_links - CSI2 pads links creation
- * @isp : Pointer to ISP device
- * return negative error code or zero on success
- */
-int omap3isp_csi2_create_pads_links(struct isp_device *isp)
-{
-	struct isp_csi2_device *csi2a = &isp->isp_csi2a;
-
-	/* Connect the CSI2 subdev to the video node. */
-	return media_create_pad_link(&csi2a->subdev.entity, CSI2_PAD_SOURCE,
-				     &csi2a->video_out.video.entity, 0, 0);
-}
-
-/*
  * omap3isp_csi2_cleanup - Routine for module driver cleanup
  */
 void omap3isp_csi2_cleanup(struct isp_device *isp)
diff --git a/drivers/media/platform/omap3isp/ispcsi2.h b/drivers/media/platform/omap3isp/ispcsi2.h
index 452ee239c7d7..453ed62fe394 100644
--- a/drivers/media/platform/omap3isp/ispcsi2.h
+++ b/drivers/media/platform/omap3isp/ispcsi2.h
@@ -148,7 +148,6 @@ struct isp_csi2_device {
 void omap3isp_csi2_isr(struct isp_csi2_device *csi2);
 int omap3isp_csi2_reset(struct isp_csi2_device *csi2);
 int omap3isp_csi2_init(struct isp_device *isp);
-int omap3isp_csi2_create_pads_links(struct isp_device *isp);
 void omap3isp_csi2_cleanup(struct isp_device *isp);
 void omap3isp_csi2_unregister_entities(struct isp_csi2_device *csi2);
 int omap3isp_csi2_register_entities(struct isp_csi2_device *csi2,
diff --git a/drivers/media/platform/omap3isp/isppreview.c b/drivers/media/platform/omap3isp/isppreview.c
index e15ad4133632..84a96670e2e7 100644
--- a/drivers/media/platform/omap3isp/isppreview.c
+++ b/drivers/media/platform/omap3isp/isppreview.c
@@ -2341,26 +2341,6 @@ int omap3isp_preview_init(struct isp_device *isp)
 	return preview_init_entities(prev);
 }
 
-/*
- * omap3isp_preview_create_pads_links - Previewer pads links creation
- * @isp : Pointer to ISP device
- * return negative error code or zero on success
- */
-int omap3isp_preview_create_pads_links(struct isp_device *isp)
-{
-	struct isp_prev_device *prev = &isp->isp_prev;
-	int ret;
-
-	/* Connect the video nodes to the previewer subdev. */
-	ret = media_create_pad_link(&prev->video_in.video.entity, 0,
-			&prev->subdev.entity, PREV_PAD_SINK, 0);
-	if (ret < 0)
-		return ret;
-
-	return media_create_pad_link(&prev->subdev.entity, PREV_PAD_SOURCE,
-				     &prev->video_out.video.entity, 0, 0);
-}
-
 void omap3isp_preview_cleanup(struct isp_device *isp)
 {
 	struct isp_prev_device *prev = &isp->isp_prev;
diff --git a/drivers/media/platform/omap3isp/isppreview.h b/drivers/media/platform/omap3isp/isppreview.h
index f3593b7cecc7..16fdc03a3d43 100644
--- a/drivers/media/platform/omap3isp/isppreview.h
+++ b/drivers/media/platform/omap3isp/isppreview.h
@@ -148,7 +148,6 @@ struct isp_prev_device {
 struct isp_device;
 
 int omap3isp_preview_init(struct isp_device *isp);
-int omap3isp_preview_create_pads_links(struct isp_device *isp);
 void omap3isp_preview_cleanup(struct isp_device *isp);
 
 int omap3isp_preview_register_entities(struct isp_prev_device *prv,
diff --git a/drivers/media/platform/omap3isp/ispresizer.c b/drivers/media/platform/omap3isp/ispresizer.c
index 20b98d876d7e..0b6a87508584 100644
--- a/drivers/media/platform/omap3isp/ispresizer.c
+++ b/drivers/media/platform/omap3isp/ispresizer.c
@@ -1785,26 +1785,6 @@ int omap3isp_resizer_init(struct isp_device *isp)
 	return resizer_init_entities(res);
 }
 
-/*
- * omap3isp_resizer_create_pads_links - Resizer pads links creation
- * @isp : Pointer to ISP device
- * return negative error code or zero on success
- */
-int omap3isp_resizer_create_pads_links(struct isp_device *isp)
-{
-	struct isp_res_device *res = &isp->isp_res;
-	int ret;
-
-	/* Connect the video nodes to the resizer subdev. */
-	ret = media_create_pad_link(&res->video_in.video.entity, 0,
-				    &res->subdev.entity, RESZ_PAD_SINK, 0);
-	if (ret < 0)
-		return ret;
-
-	return media_create_pad_link(&res->subdev.entity, RESZ_PAD_SOURCE,
-				     &res->video_out.video.entity, 0, 0);
-}
-
 void omap3isp_resizer_cleanup(struct isp_device *isp)
 {
 	struct isp_res_device *res = &isp->isp_res;
diff --git a/drivers/media/platform/omap3isp/ispresizer.h b/drivers/media/platform/omap3isp/ispresizer.h
index 8b9fdcdab73d..5414542912e2 100644
--- a/drivers/media/platform/omap3isp/ispresizer.h
+++ b/drivers/media/platform/omap3isp/ispresizer.h
@@ -119,7 +119,6 @@ struct isp_res_device {
 struct isp_device;
 
 int omap3isp_resizer_init(struct isp_device *isp);
-int omap3isp_resizer_create_pads_links(struct isp_device *isp);
 void omap3isp_resizer_cleanup(struct isp_device *isp);
 
 int omap3isp_resizer_register_entities(struct isp_res_device *res,
-- 
2.4.3


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

* [PATCH 02/10] [media] omap3isp: remove pads prefix from isp_create_pads_links()
  2015-12-11 17:16 [PATCH 00/10] [media] Some cleanup and fixes for MC next gen patches Javier Martinez Canillas
  2015-12-11 17:16 ` [PATCH 01/10] [media] omap3isp: remove per ISP module link creation functions Javier Martinez Canillas
@ 2015-12-11 17:16 ` Javier Martinez Canillas
  2015-12-11 17:16 ` [PATCH 03/10] [media] omap3isp: rename single labels to just error Javier Martinez Canillas
                   ` (7 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: Javier Martinez Canillas @ 2015-12-11 17:16 UTC (permalink / raw)
  To: linux-kernel
  Cc: Mauro Carvalho Chehab, Shuah Khan, Sakari Ailus,
	Laurent Pinchart, Hans Verkuil, linux-media,
	Javier Martinez Canillas

The function that creates the links between ISP internal and external
entities is called isp_create_pads_links() but the "pads" prefix is
redundant since the driver doesn't handle any other kind of link so
it can just be removed.

While being there, fix the function's kernel-doc since is not using
a proper format.

Suggested-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com>

---

This patch addresses 2 remaining issues Laurent pointed in patch [0]:

1- Rename isp_create_pads_links() to isp_create_links().
2- Fix kernel-doc for the same function.

[0]: https://patchwork.linuxtv.org/patch/31147/

 drivers/media/platform/omap3isp/isp.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/drivers/media/platform/omap3isp/isp.c b/drivers/media/platform/omap3isp/isp.c
index 40aee11805c7..fb17746e4209 100644
--- a/drivers/media/platform/omap3isp/isp.c
+++ b/drivers/media/platform/omap3isp/isp.c
@@ -1932,11 +1932,15 @@ done:
 }
 
 /*
- * isp_create_pads_links - Pads links creation for the subdevices
+ * isp_create_links() - Create links for internal and external ISP entities
  * @isp : Pointer to ISP device
- * return negative error code or zero on success
+ *
+ * This function creates all links between ISP internal and external entities.
+ *
+ * Return: A negative error code on failure or zero on success. Possible error
+ * codes are those returned by media_create_pad_link().
  */
-static int isp_create_pads_links(struct isp_device *isp)
+static int isp_create_links(struct isp_device *isp)
 {
 	int ret;
 
@@ -2527,7 +2531,7 @@ static int isp_probe(struct platform_device *pdev)
 	if (ret < 0)
 		goto error_modules;
 
-	ret = isp_create_pads_links(isp);
+	ret = isp_create_links(isp);
 	if (ret < 0)
 		goto error_register_entities;
 
-- 
2.4.3


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

* [PATCH 03/10] [media] omap3isp: rename single labels to just error
  2015-12-11 17:16 [PATCH 00/10] [media] Some cleanup and fixes for MC next gen patches Javier Martinez Canillas
  2015-12-11 17:16 ` [PATCH 01/10] [media] omap3isp: remove per ISP module link creation functions Javier Martinez Canillas
  2015-12-11 17:16 ` [PATCH 02/10] [media] omap3isp: remove pads prefix from isp_create_pads_links() Javier Martinez Canillas
@ 2015-12-11 17:16 ` Javier Martinez Canillas
  2015-12-11 17:16 ` [PATCH 04/10] [media] omap3isp: consistently use v4l2_dev var in complete notifier Javier Martinez Canillas
                   ` (6 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: Javier Martinez Canillas @ 2015-12-11 17:16 UTC (permalink / raw)
  To: linux-kernel
  Cc: Mauro Carvalho Chehab, Shuah Khan, Sakari Ailus,
	Laurent Pinchart, Hans Verkuil, linux-media,
	Javier Martinez Canillas

Commit bc36b30fe06b ("[media] omap3isp: separate links creation from
entities init") moved the link creation logic from the entities init
functions and so removed the error_link labels from the error paths.

But after that, some functions have a single error label so it makes
more sense to rename the label to just "error" in thi case.

Suggested-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com>

---

This patch addresses the last remaining issue Laurent pointed in patch [0]:

1- Rename label to just "error" if there is a single error label.

[0]: https://patchwork.linuxtv.org/patch/31147/

 drivers/media/platform/omap3isp/ispccdc.c | 4 ++--
 drivers/media/platform/omap3isp/ispccp2.c | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/media/platform/omap3isp/ispccdc.c b/drivers/media/platform/omap3isp/ispccdc.c
index 5e16b5f594b7..4eaf926d6073 100644
--- a/drivers/media/platform/omap3isp/ispccdc.c
+++ b/drivers/media/platform/omap3isp/ispccdc.c
@@ -2669,11 +2669,11 @@ static int ccdc_init_entities(struct isp_ccdc_device *ccdc)
 
 	ret = omap3isp_video_init(&ccdc->video_out, "CCDC");
 	if (ret < 0)
-		goto error_video;
+		goto error;
 
 	return 0;
 
-error_video:
+error:
 	media_entity_cleanup(me);
 	return ret;
 }
diff --git a/drivers/media/platform/omap3isp/ispccp2.c b/drivers/media/platform/omap3isp/ispccp2.c
index 27f5fe4edefc..ca095238510d 100644
--- a/drivers/media/platform/omap3isp/ispccp2.c
+++ b/drivers/media/platform/omap3isp/ispccp2.c
@@ -1102,11 +1102,11 @@ static int ccp2_init_entities(struct isp_ccp2_device *ccp2)
 
 	ret = omap3isp_video_init(&ccp2->video_in, "CCP2");
 	if (ret < 0)
-		goto error_video;
+		goto error;
 
 	return 0;
 
-error_video:
+error:
 	media_entity_cleanup(&ccp2->subdev.entity);
 	return ret;
 }
-- 
2.4.3


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

* [PATCH 04/10] [media] omap3isp: consistently use v4l2_dev var in complete notifier
  2015-12-11 17:16 [PATCH 00/10] [media] Some cleanup and fixes for MC next gen patches Javier Martinez Canillas
                   ` (2 preceding siblings ...)
  2015-12-11 17:16 ` [PATCH 03/10] [media] omap3isp: rename single labels to just error Javier Martinez Canillas
@ 2015-12-11 17:16 ` Javier Martinez Canillas
  2015-12-11 17:16 ` [PATCH 05/10] [media] staging: omap4iss: remove pads prefix from *_create_pads_links() Javier Martinez Canillas
                   ` (5 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: Javier Martinez Canillas @ 2015-12-11 17:16 UTC (permalink / raw)
  To: linux-kernel
  Cc: Mauro Carvalho Chehab, Shuah Khan, Sakari Ailus,
	Laurent Pinchart, Hans Verkuil, linux-media,
	Javier Martinez Canillas

The isp_subdev_notifier_complete() complete callback defines a struct
v4l2_device *v4l2_dev to avoid needing two level of indirections to
access the V4L2 subdevs but the var is not always used when possible
as when calling v4l2_device_register_subdev_nodes().

So change that to consistently use the defined v4l2_dev pointer var.

Suggested-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com>


This patch addresses an issue pointed out by Sakari in patch [0]:

- Don't mix struct v4l2_device *v4l2_dev and &isp->v4l2_dev usage.

[0]: http://linuxtv.org/pipermail/media-workshop/2015-October/000928.html
END

---

 drivers/media/platform/omap3isp/isp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/media/platform/omap3isp/isp.c b/drivers/media/platform/omap3isp/isp.c
index fb17746e4209..8226eca83327 100644
--- a/drivers/media/platform/omap3isp/isp.c
+++ b/drivers/media/platform/omap3isp/isp.c
@@ -2365,7 +2365,7 @@ static int isp_subdev_notifier_complete(struct v4l2_async_notifier *async)
 		}
 	}
 
-	return v4l2_device_register_subdev_nodes(&isp->v4l2_dev);
+	return v4l2_device_register_subdev_nodes(v4l2_dev);
 }
 
 /*
-- 
2.4.3


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

* [PATCH 05/10] [media] staging: omap4iss: remove pads prefix from *_create_pads_links()
  2015-12-11 17:16 [PATCH 00/10] [media] Some cleanup and fixes for MC next gen patches Javier Martinez Canillas
                   ` (3 preceding siblings ...)
  2015-12-11 17:16 ` [PATCH 04/10] [media] omap3isp: consistently use v4l2_dev var in complete notifier Javier Martinez Canillas
@ 2015-12-11 17:16 ` Javier Martinez Canillas
  2015-12-11 17:16 ` [PATCH 06/10] [media] v4l: vsp1: " Javier Martinez Canillas
                   ` (4 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: Javier Martinez Canillas @ 2015-12-11 17:16 UTC (permalink / raw)
  To: linux-kernel
  Cc: Mauro Carvalho Chehab, Shuah Khan, Sakari Ailus,
	Laurent Pinchart, Hans Verkuil, linux-media,
	Javier Martinez Canillas

The functions that create ISS internal and external entities links are
called *_create_pads_links() but the "pads" prefix is redundant since
the driver doesn't handle any other kind of link so it can be removed.

Suggested-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com>

---

This patch addresses an issue Laurent pointed in patch [0]:

- Could you please s/pads_links/links/ and s/pads links/links/

[0]: https://lkml.org/lkml/2015/12/5/256

 drivers/staging/media/omap4iss/iss.c         | 12 ++++++------
 drivers/staging/media/omap4iss/iss_csi2.c    |  4 ++--
 drivers/staging/media/omap4iss/iss_csi2.h    |  2 +-
 drivers/staging/media/omap4iss/iss_ipipeif.c |  4 ++--
 drivers/staging/media/omap4iss/iss_ipipeif.h |  2 +-
 drivers/staging/media/omap4iss/iss_resizer.c |  4 ++--
 drivers/staging/media/omap4iss/iss_resizer.h |  2 +-
 7 files changed, 15 insertions(+), 15 deletions(-)

diff --git a/drivers/staging/media/omap4iss/iss.c b/drivers/staging/media/omap4iss/iss.c
index 28e4d16544eb..7209b92b1f86 100644
--- a/drivers/staging/media/omap4iss/iss.c
+++ b/drivers/staging/media/omap4iss/iss.c
@@ -1273,28 +1273,28 @@ done:
 }
 
 /*
- * iss_create_pads_links() - Pads links creation for the subdevices
+ * iss_create_links() - Pads links creation for the subdevices
  * @iss : Pointer to ISS device
  *
  * return negative error code or zero on success
  */
-static int iss_create_pads_links(struct iss_device *iss)
+static int iss_create_links(struct iss_device *iss)
 {
 	int ret;
 
-	ret = omap4iss_csi2_create_pads_links(iss);
+	ret = omap4iss_csi2_create_links(iss);
 	if (ret < 0) {
 		dev_err(iss->dev, "CSI2 pads links creation failed\n");
 		return ret;
 	}
 
-	ret = omap4iss_ipipeif_create_pads_links(iss);
+	ret = omap4iss_ipipeif_create_links(iss);
 	if (ret < 0) {
 		dev_err(iss->dev, "ISP IPIPEIF pads links creation failed\n");
 		return ret;
 	}
 
-	ret = omap4iss_resizer_create_pads_links(iss);
+	ret = omap4iss_resizer_create_links(iss);
 	if (ret < 0) {
 		dev_err(iss->dev, "ISP RESIZER pads links creation failed\n");
 		return ret;
@@ -1491,7 +1491,7 @@ static int iss_probe(struct platform_device *pdev)
 	if (ret < 0)
 		goto error_modules;
 
-	ret = iss_create_pads_links(iss);
+	ret = iss_create_links(iss);
 	if (ret < 0)
 		goto error_entities;
 
diff --git a/drivers/staging/media/omap4iss/iss_csi2.c b/drivers/staging/media/omap4iss/iss_csi2.c
index f0fa037ce173..aaca39d751a5 100644
--- a/drivers/staging/media/omap4iss/iss_csi2.c
+++ b/drivers/staging/media/omap4iss/iss_csi2.c
@@ -1339,12 +1339,12 @@ int omap4iss_csi2_init(struct iss_device *iss)
 }
 
 /*
- * omap4iss_csi2_create_pads_links() - CSI2 pads links creation
+ * omap4iss_csi2_create_links() - CSI2 pads links creation
  * @iss: Pointer to ISS device
  *
  * return negative error code or zero on success
  */
-int omap4iss_csi2_create_pads_links(struct iss_device *iss)
+int omap4iss_csi2_create_links(struct iss_device *iss)
 {
 	struct iss_csi2_device *csi2a = &iss->csi2a;
 	struct iss_csi2_device *csi2b = &iss->csi2b;
diff --git a/drivers/staging/media/omap4iss/iss_csi2.h b/drivers/staging/media/omap4iss/iss_csi2.h
index 1d5a0d8222a9..24ab378d469f 100644
--- a/drivers/staging/media/omap4iss/iss_csi2.h
+++ b/drivers/staging/media/omap4iss/iss_csi2.h
@@ -151,7 +151,7 @@ struct iss_csi2_device {
 void omap4iss_csi2_isr(struct iss_csi2_device *csi2);
 int omap4iss_csi2_reset(struct iss_csi2_device *csi2);
 int omap4iss_csi2_init(struct iss_device *iss);
-int omap4iss_csi2_create_pads_links(struct iss_device *iss);
+int omap4iss_csi2_create_links(struct iss_device *iss);
 void omap4iss_csi2_cleanup(struct iss_device *iss);
 void omap4iss_csi2_unregister_entities(struct iss_csi2_device *csi2);
 int omap4iss_csi2_register_entities(struct iss_csi2_device *csi2,
diff --git a/drivers/staging/media/omap4iss/iss_ipipeif.c b/drivers/staging/media/omap4iss/iss_ipipeif.c
index 88b22f7f8b13..23de8330731d 100644
--- a/drivers/staging/media/omap4iss/iss_ipipeif.c
+++ b/drivers/staging/media/omap4iss/iss_ipipeif.c
@@ -815,12 +815,12 @@ int omap4iss_ipipeif_init(struct iss_device *iss)
 }
 
 /*
- * omap4iss_ipipeif_create_pads_links() - IPIPEIF pads links creation
+ * omap4iss_ipipeif_create_links() - IPIPEIF pads links creation
  * @iss: Pointer to ISS device
  *
  * return negative error code or zero on success
  */
-int omap4iss_ipipeif_create_pads_links(struct iss_device *iss)
+int omap4iss_ipipeif_create_links(struct iss_device *iss)
 {
 	struct iss_ipipeif_device *ipipeif = &iss->ipipeif;
 
diff --git a/drivers/staging/media/omap4iss/iss_ipipeif.h b/drivers/staging/media/omap4iss/iss_ipipeif.h
index dd906b41cf9b..bad32b1d6ad8 100644
--- a/drivers/staging/media/omap4iss/iss_ipipeif.h
+++ b/drivers/staging/media/omap4iss/iss_ipipeif.h
@@ -78,7 +78,7 @@ struct iss_ipipeif_device {
 struct iss_device;
 
 int omap4iss_ipipeif_init(struct iss_device *iss);
-int omap4iss_ipipeif_create_pads_links(struct iss_device *iss);
+int omap4iss_ipipeif_create_links(struct iss_device *iss);
 void omap4iss_ipipeif_cleanup(struct iss_device *iss);
 int omap4iss_ipipeif_register_entities(struct iss_ipipeif_device *ipipeif,
 				       struct v4l2_device *vdev);
diff --git a/drivers/staging/media/omap4iss/iss_resizer.c b/drivers/staging/media/omap4iss/iss_resizer.c
index fe7b253bb0d3..f1d352c711d5 100644
--- a/drivers/staging/media/omap4iss/iss_resizer.c
+++ b/drivers/staging/media/omap4iss/iss_resizer.c
@@ -857,12 +857,12 @@ int omap4iss_resizer_init(struct iss_device *iss)
 }
 
 /*
- * omap4iss_resizer_create_pads_links() - RESIZER pads links creation
+ * omap4iss_resizer_create_links() - RESIZER pads links creation
  * @iss: Pointer to ISS device
  *
  * return negative error code or zero on success
  */
-int omap4iss_resizer_create_pads_links(struct iss_device *iss)
+int omap4iss_resizer_create_links(struct iss_device *iss)
 {
 	struct iss_resizer_device *resizer = &iss->resizer;
 
diff --git a/drivers/staging/media/omap4iss/iss_resizer.h b/drivers/staging/media/omap4iss/iss_resizer.h
index 98ab950253d0..8b7c5fe9ffed 100644
--- a/drivers/staging/media/omap4iss/iss_resizer.h
+++ b/drivers/staging/media/omap4iss/iss_resizer.h
@@ -61,7 +61,7 @@ struct iss_resizer_device {
 struct iss_device;
 
 int omap4iss_resizer_init(struct iss_device *iss);
-int omap4iss_resizer_create_pads_links(struct iss_device *iss);
+int omap4iss_resizer_create_links(struct iss_device *iss);
 void omap4iss_resizer_cleanup(struct iss_device *iss);
 int omap4iss_resizer_register_entities(struct iss_resizer_device *resizer,
 				       struct v4l2_device *vdev);
-- 
2.4.3


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

* [PATCH 06/10] [media] v4l: vsp1: remove pads prefix from *_create_pads_links()
  2015-12-11 17:16 [PATCH 00/10] [media] Some cleanup and fixes for MC next gen patches Javier Martinez Canillas
                   ` (4 preceding siblings ...)
  2015-12-11 17:16 ` [PATCH 05/10] [media] staging: omap4iss: remove pads prefix from *_create_pads_links() Javier Martinez Canillas
@ 2015-12-11 17:16 ` Javier Martinez Canillas
  2015-12-11 17:16 ` [PATCH 07/10] [media] v4l: vsp1: use else if instead of continue when creating links Javier Martinez Canillas
                   ` (3 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: Javier Martinez Canillas @ 2015-12-11 17:16 UTC (permalink / raw)
  To: linux-kernel
  Cc: Mauro Carvalho Chehab, Shuah Khan, Sakari Ailus,
	Laurent Pinchart, Hans Verkuil, linux-media,
	Javier Martinez Canillas

The functions that create entities links are called *_create_pads_links()
but the "pads" prefix is redundant since the driver doesn't handle any
other kind of link so it can be removed.

Suggested-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com>


This patch addresses an issue Laurent pointed in patch [0]:

- Could you please s/pads_links/links/ and s/pads links/links/

[0]: http://www.spinics.net/lists/linux-media/msg95316.html
END

---

 drivers/media/platform/vsp1/vsp1_drv.c  | 4 ++--
 drivers/media/platform/vsp1/vsp1_rpf.c  | 4 ++--
 drivers/media/platform/vsp1/vsp1_rwpf.h | 4 ++--
 drivers/media/platform/vsp1/vsp1_wpf.c  | 4 ++--
 4 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/media/platform/vsp1/vsp1_drv.c b/drivers/media/platform/vsp1/vsp1_drv.c
index 8f995d267646..4209d8615f72 100644
--- a/drivers/media/platform/vsp1/vsp1_drv.c
+++ b/drivers/media/platform/vsp1/vsp1_drv.c
@@ -261,14 +261,14 @@ static int vsp1_create_entities(struct vsp1_device *vsp1)
 	/* Create links. */
 	list_for_each_entry(entity, &vsp1->entities, list_dev) {
 		if (entity->type == VSP1_ENTITY_LIF) {
-			ret = vsp1_wpf_create_pads_links(vsp1, entity);
+			ret = vsp1_wpf_create_links(vsp1, entity);
 			if (ret < 0)
 				goto done;
 			continue;
 		}
 
 		if (entity->type == VSP1_ENTITY_RPF) {
-			ret = vsp1_rpf_create_pads_links(vsp1, entity);
+			ret = vsp1_rpf_create_links(vsp1, entity);
 			if (ret < 0)
 				goto done;
 			continue;
diff --git a/drivers/media/platform/vsp1/vsp1_rpf.c b/drivers/media/platform/vsp1/vsp1_rpf.c
index 847fb6d01a5a..924538223d3e 100644
--- a/drivers/media/platform/vsp1/vsp1_rpf.c
+++ b/drivers/media/platform/vsp1/vsp1_rpf.c
@@ -285,13 +285,13 @@ error:
 }
 
 /*
- * vsp1_rpf_create_pads_links_create_pads_links() - RPF pads links creation
+ * vsp1_rpf_create_links() - RPF pads links creation
  * @vsp1: Pointer to VSP1 device
  * @entity: Pointer to VSP1 entity
  *
  * return negative error code or zero on success
  */
-int vsp1_rpf_create_pads_links(struct vsp1_device *vsp1,
+int vsp1_rpf_create_links(struct vsp1_device *vsp1,
 			       struct vsp1_entity *entity)
 {
 	struct vsp1_rwpf *rpf = to_rwpf(&entity->subdev);
diff --git a/drivers/media/platform/vsp1/vsp1_rwpf.h b/drivers/media/platform/vsp1/vsp1_rwpf.h
index 6638b3587369..731d36e5258d 100644
--- a/drivers/media/platform/vsp1/vsp1_rwpf.h
+++ b/drivers/media/platform/vsp1/vsp1_rwpf.h
@@ -50,9 +50,9 @@ static inline struct vsp1_rwpf *to_rwpf(struct v4l2_subdev *subdev)
 struct vsp1_rwpf *vsp1_rpf_create(struct vsp1_device *vsp1, unsigned int index);
 struct vsp1_rwpf *vsp1_wpf_create(struct vsp1_device *vsp1, unsigned int index);
 
-int vsp1_rpf_create_pads_links(struct vsp1_device *vsp1,
+int vsp1_rpf_create_links(struct vsp1_device *vsp1,
 			       struct vsp1_entity *entity);
-int vsp1_wpf_create_pads_links(struct vsp1_device *vsp1,
+int vsp1_wpf_create_links(struct vsp1_device *vsp1,
 			       struct vsp1_entity *entity);
 
 int vsp1_rwpf_enum_mbus_code(struct v4l2_subdev *subdev,
diff --git a/drivers/media/platform/vsp1/vsp1_wpf.c b/drivers/media/platform/vsp1/vsp1_wpf.c
index 969278bc1d41..cbf514a6582d 100644
--- a/drivers/media/platform/vsp1/vsp1_wpf.c
+++ b/drivers/media/platform/vsp1/vsp1_wpf.c
@@ -285,13 +285,13 @@ error:
 }
 
 /*
- * vsp1_wpf_create_pads_links_create_pads_links() - RPF pads links creation
+ * vsp1_wpf_create_links() - RPF pads links creation
  * @vsp1: Pointer to VSP1 device
  * @entity: Pointer to VSP1 entity
  *
  * return negative error code or zero on success
  */
-int vsp1_wpf_create_pads_links(struct vsp1_device *vsp1,
+int vsp1_wpf_create_links(struct vsp1_device *vsp1,
 			       struct vsp1_entity *entity)
 {
 	struct vsp1_rwpf *wpf = to_rwpf(&entity->subdev);
-- 
2.4.3


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

* [PATCH 07/10] [media] v4l: vsp1: use else if instead of continue when creating links
  2015-12-11 17:16 [PATCH 00/10] [media] Some cleanup and fixes for MC next gen patches Javier Martinez Canillas
                   ` (5 preceding siblings ...)
  2015-12-11 17:16 ` [PATCH 06/10] [media] v4l: vsp1: " Javier Martinez Canillas
@ 2015-12-11 17:16 ` Javier Martinez Canillas
  2015-12-11 17:16 ` [PATCH 08/10] [media] uvcvideo: remove pads prefix from uvc_mc_create_pads_links() Javier Martinez Canillas
                   ` (2 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: Javier Martinez Canillas @ 2015-12-11 17:16 UTC (permalink / raw)
  To: linux-kernel
  Cc: Mauro Carvalho Chehab, Shuah Khan, Sakari Ailus,
	Laurent Pinchart, Hans Verkuil, linux-media,
	Javier Martinez Canillas

The for loop in the vsp1_create_entities() function that create the links,
checks the entity type and call the proper link creation function but then
it uses continue to force the next iteration of the loop to take place and
skipping code in between that creates links for different entities types.

It is more readable and easier to understand if the if else constructs is
used instead of the continue statement.

Suggested-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com>


This patch addresses an issue pointed out by Laurent in patch [0]:

- Use if else instead of continue.

[0]: http://www.spinics.net/lists/linux-media/msg95316.html
END

---

 drivers/media/platform/vsp1/vsp1_drv.c | 14 +++++---------
 1 file changed, 5 insertions(+), 9 deletions(-)

diff --git a/drivers/media/platform/vsp1/vsp1_drv.c b/drivers/media/platform/vsp1/vsp1_drv.c
index 4209d8615f72..0b251147bfff 100644
--- a/drivers/media/platform/vsp1/vsp1_drv.c
+++ b/drivers/media/platform/vsp1/vsp1_drv.c
@@ -264,19 +264,15 @@ static int vsp1_create_entities(struct vsp1_device *vsp1)
 			ret = vsp1_wpf_create_links(vsp1, entity);
 			if (ret < 0)
 				goto done;
-			continue;
-		}
-
-		if (entity->type == VSP1_ENTITY_RPF) {
+		} else if (entity->type == VSP1_ENTITY_RPF) {
 			ret = vsp1_rpf_create_links(vsp1, entity);
 			if (ret < 0)
 				goto done;
-			continue;
+		} else {
+			ret = vsp1_create_links(vsp1, entity);
+			if (ret < 0)
+				goto done;
 		}
-
-		ret = vsp1_create_links(vsp1, entity);
-		if (ret < 0)
-			goto done;
 	}
 
 	if (vsp1->pdata.features & VSP1_HAS_LIF) {
-- 
2.4.3


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

* [PATCH 08/10] [media] uvcvideo: remove pads prefix from uvc_mc_create_pads_links()
  2015-12-11 17:16 [PATCH 00/10] [media] Some cleanup and fixes for MC next gen patches Javier Martinez Canillas
                   ` (6 preceding siblings ...)
  2015-12-11 17:16 ` [PATCH 07/10] [media] v4l: vsp1: use else if instead of continue when creating links Javier Martinez Canillas
@ 2015-12-11 17:16 ` Javier Martinez Canillas
  2015-12-11 17:16 ` [PATCH 09/10] [media] uvcvideo: register entity subdev on init Javier Martinez Canillas
  2015-12-11 17:16 ` [PATCH 10/10] [media] media-entity: remove unneded enclosing parenthesis Javier Martinez Canillas
  9 siblings, 0 replies; 11+ messages in thread
From: Javier Martinez Canillas @ 2015-12-11 17:16 UTC (permalink / raw)
  To: linux-kernel
  Cc: Mauro Carvalho Chehab, Shuah Khan, Sakari Ailus,
	Laurent Pinchart, Hans Verkuil, linux-media,
	Javier Martinez Canillas

The function uvc_mc_create_pads_links() creates entities links but the
"pads" prefix is redundant since the driver doesn't handle any other
kind of link, so it can be removed.

Suggested-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com>

---

This patch addresses an issue Laurent pointed in patch [0]:

- You can call this uvc_mc_create_links(), there's no other type of links.

[0]: https://lkml.org/lkml/2015/12/5/253

 drivers/media/usb/uvc/uvc_entity.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/media/usb/uvc/uvc_entity.c b/drivers/media/usb/uvc/uvc_entity.c
index 38e893a1408b..33119dcb7cec 100644
--- a/drivers/media/usb/uvc/uvc_entity.c
+++ b/drivers/media/usb/uvc/uvc_entity.c
@@ -32,7 +32,7 @@ static int uvc_mc_register_entity(struct uvc_video_chain *chain,
 	return v4l2_device_register_subdev(&chain->dev->vdev, &entity->subdev);
 }
 
-static int uvc_mc_create_pads_links(struct uvc_video_chain *chain,
+static int uvc_mc_create_links(struct uvc_video_chain *chain,
 				    struct uvc_entity *entity)
 {
 	const u32 flags = MEDIA_LNK_FL_ENABLED | MEDIA_LNK_FL_IMMUTABLE;
@@ -131,9 +131,9 @@ int uvc_mc_register_entities(struct uvc_video_chain *chain)
 	}
 
 	list_for_each_entry(entity, &chain->entities, chain) {
-		ret = uvc_mc_create_pads_links(chain, entity);
+		ret = uvc_mc_create_links(chain, entity);
 		if (ret < 0) {
-			uvc_printk(KERN_INFO, "Failed to create pads links for "
+			uvc_printk(KERN_INFO, "Failed to create links for "
 				   "entity %u\n", entity->id);
 			return ret;
 		}
-- 
2.4.3


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

* [PATCH 09/10] [media] uvcvideo: register entity subdev on init
  2015-12-11 17:16 [PATCH 00/10] [media] Some cleanup and fixes for MC next gen patches Javier Martinez Canillas
                   ` (7 preceding siblings ...)
  2015-12-11 17:16 ` [PATCH 08/10] [media] uvcvideo: remove pads prefix from uvc_mc_create_pads_links() Javier Martinez Canillas
@ 2015-12-11 17:16 ` Javier Martinez Canillas
  2015-12-11 17:16 ` [PATCH 10/10] [media] media-entity: remove unneded enclosing parenthesis Javier Martinez Canillas
  9 siblings, 0 replies; 11+ messages in thread
From: Javier Martinez Canillas @ 2015-12-11 17:16 UTC (permalink / raw)
  To: linux-kernel
  Cc: Mauro Carvalho Chehab, Shuah Khan, Sakari Ailus,
	Laurent Pinchart, Hans Verkuil, linux-media,
	Javier Martinez Canillas

The uvc_mc_register_entities() function iterated over the entities three
times to initialize the entities, register the subdev for the ones whose
type was UVC_TT_STREAMING and to create the entities links.

But this can be simplied by merging the init and registration logic in a
single loop.

Suggested-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com>

---

This patch addresses an issue Laurent pointed in patch [0]:

- Move the  v4l2_device_register_subdev() call to uvc_mc_init_entity().

[0]: https://lkml.org/lkml/2015/12/5/253

 drivers/media/usb/uvc/uvc_entity.c | 33 +++++++++------------------------
 1 file changed, 9 insertions(+), 24 deletions(-)

diff --git a/drivers/media/usb/uvc/uvc_entity.c b/drivers/media/usb/uvc/uvc_entity.c
index 33119dcb7cec..ac386bb547e6 100644
--- a/drivers/media/usb/uvc/uvc_entity.c
+++ b/drivers/media/usb/uvc/uvc_entity.c
@@ -19,19 +19,6 @@
 
 #include "uvcvideo.h"
 
-/* ------------------------------------------------------------------------
- * Video subdevices registration and unregistration
- */
-
-static int uvc_mc_register_entity(struct uvc_video_chain *chain,
-	struct uvc_entity *entity)
-{
-	if (UVC_ENTITY_TYPE(entity) == UVC_TT_STREAMING)
-		return 0;
-
-	return v4l2_device_register_subdev(&chain->dev->vdev, &entity->subdev);
-}
-
 static int uvc_mc_create_links(struct uvc_video_chain *chain,
 				    struct uvc_entity *entity)
 {
@@ -85,7 +72,8 @@ void uvc_mc_cleanup_entity(struct uvc_entity *entity)
 		media_entity_cleanup(&entity->vdev->entity);
 }
 
-static int uvc_mc_init_entity(struct uvc_entity *entity)
+static int uvc_mc_init_entity(struct uvc_video_chain *chain,
+			      struct uvc_entity *entity)
 {
 	int ret;
 
@@ -96,6 +84,12 @@ static int uvc_mc_init_entity(struct uvc_entity *entity)
 
 		ret = media_entity_pads_init(&entity->subdev.entity,
 					entity->num_pads, entity->pads);
+
+		if (ret < 0)
+			return ret;
+
+		ret = v4l2_device_register_subdev(&chain->dev->vdev,
+						  &entity->subdev);
 	} else if (entity->vdev != NULL) {
 		ret = media_entity_pads_init(&entity->vdev->entity,
 					entity->num_pads, entity->pads);
@@ -113,7 +107,7 @@ int uvc_mc_register_entities(struct uvc_video_chain *chain)
 	int ret;
 
 	list_for_each_entry(entity, &chain->entities, chain) {
-		ret = uvc_mc_init_entity(entity);
+		ret = uvc_mc_init_entity(chain, entity);
 		if (ret < 0) {
 			uvc_printk(KERN_INFO, "Failed to initialize entity for "
 				   "entity %u\n", entity->id);
@@ -122,15 +116,6 @@ int uvc_mc_register_entities(struct uvc_video_chain *chain)
 	}
 
 	list_for_each_entry(entity, &chain->entities, chain) {
-		ret = uvc_mc_register_entity(chain, entity);
-		if (ret < 0) {
-			uvc_printk(KERN_INFO, "Failed to register entity for "
-				   "entity %u\n", entity->id);
-			return ret;
-		}
-	}
-
-	list_for_each_entry(entity, &chain->entities, chain) {
 		ret = uvc_mc_create_links(chain, entity);
 		if (ret < 0) {
 			uvc_printk(KERN_INFO, "Failed to create links for "
-- 
2.4.3


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

* [PATCH 10/10] [media] media-entity: remove unneded enclosing parenthesis
  2015-12-11 17:16 [PATCH 00/10] [media] Some cleanup and fixes for MC next gen patches Javier Martinez Canillas
                   ` (8 preceding siblings ...)
  2015-12-11 17:16 ` [PATCH 09/10] [media] uvcvideo: register entity subdev on init Javier Martinez Canillas
@ 2015-12-11 17:16 ` Javier Martinez Canillas
  9 siblings, 0 replies; 11+ messages in thread
From: Javier Martinez Canillas @ 2015-12-11 17:16 UTC (permalink / raw)
  To: linux-kernel
  Cc: Mauro Carvalho Chehab, Shuah Khan, Sakari Ailus,
	Laurent Pinchart, Hans Verkuil, linux-media,
	Javier Martinez Canillas

Commit 86ee417578a2 ("[media] media: convert links from array to list")
had many changes that were automated using coccinelle but the semantic
patch was not smart enough to rely on operators precedence and avoid
using unnecessary enclosing parenthesis.

This patch removes them since are not needed.

Suggested-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com>

---

This patch addresses an issue Laurent pointed in patch [0]:

- No need for parentheses

[0]: [media-workshop] [PATCH v8.4 24/83] [media] media: convert links
from array to list

(unfortunately I didn't find a public archive for the media-workshop ML).

 drivers/media/media-entity.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/media/media-entity.c b/drivers/media/media-entity.c
index ada2b44ea4e1..181ca0de6e52 100644
--- a/drivers/media/media-entity.c
+++ b/drivers/media/media-entity.c
@@ -225,7 +225,7 @@ static void stack_push(struct media_entity_graph *graph,
 		return;
 	}
 	graph->top++;
-	graph->stack[graph->top].link = (&entity->links)->next;
+	graph->stack[graph->top].link = entity->links.next;
 	graph->stack[graph->top].entity = entity;
 }
 
@@ -268,7 +268,7 @@ media_entity_graph_walk_next(struct media_entity_graph *graph)
 	 * top of the stack until no more entities on the level can be
 	 * found.
 	 */
-	while (link_top(graph) != &(stack_top(graph)->links)) {
+	while (link_top(graph) != &stack_top(graph)->links) {
 		struct media_entity *entity = stack_top(graph);
 		struct media_link *link;
 		struct media_entity *next;
-- 
2.4.3


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

end of thread, other threads:[~2015-12-11 17:19 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-12-11 17:16 [PATCH 00/10] [media] Some cleanup and fixes for MC next gen patches Javier Martinez Canillas
2015-12-11 17:16 ` [PATCH 01/10] [media] omap3isp: remove per ISP module link creation functions Javier Martinez Canillas
2015-12-11 17:16 ` [PATCH 02/10] [media] omap3isp: remove pads prefix from isp_create_pads_links() Javier Martinez Canillas
2015-12-11 17:16 ` [PATCH 03/10] [media] omap3isp: rename single labels to just error Javier Martinez Canillas
2015-12-11 17:16 ` [PATCH 04/10] [media] omap3isp: consistently use v4l2_dev var in complete notifier Javier Martinez Canillas
2015-12-11 17:16 ` [PATCH 05/10] [media] staging: omap4iss: remove pads prefix from *_create_pads_links() Javier Martinez Canillas
2015-12-11 17:16 ` [PATCH 06/10] [media] v4l: vsp1: " Javier Martinez Canillas
2015-12-11 17:16 ` [PATCH 07/10] [media] v4l: vsp1: use else if instead of continue when creating links Javier Martinez Canillas
2015-12-11 17:16 ` [PATCH 08/10] [media] uvcvideo: remove pads prefix from uvc_mc_create_pads_links() Javier Martinez Canillas
2015-12-11 17:16 ` [PATCH 09/10] [media] uvcvideo: register entity subdev on init Javier Martinez Canillas
2015-12-11 17:16 ` [PATCH 10/10] [media] media-entity: remove unneded enclosing parenthesis Javier Martinez Canillas

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).