From f033c0bcc53675562200680f4cb4a86710d9fbae Mon Sep 17 00:00:00 2001 From: Philipp Zabel Date: Mon, 1 Dec 2014 13:32:32 +0100 Subject: of: Decrement refcount of previous endpoint in of_graph_get_next_endpoint Decrementing the reference count of the previous endpoint node allows to use the of_graph_get_next_endpoint function in a for_each_... style macro. All current users of this function that pass a non-NULL prev parameter (that is, soc_camera and imx-drm) are changed to not decrement the passed prev argument's refcount themselves. Signed-off-by: Philipp Zabel Acked-by: Mauro Carvalho Chehab Acked-by: Mathieu Poirier Acked-by: Laurent Pinchart Acked-by: Tomi Valkeinen --- drivers/gpu/drm/imx/imx-drm-core.c | 11 +---------- drivers/gpu/drm/rcar-du/rcar_du_kms.c | 15 ++++----------- 2 files changed, 5 insertions(+), 21 deletions(-) (limited to 'drivers/gpu') diff --git a/drivers/gpu/drm/imx/imx-drm-core.c b/drivers/gpu/drm/imx/imx-drm-core.c index a002f53aab0e..84cf99f8d957 100644 --- a/drivers/gpu/drm/imx/imx-drm-core.c +++ b/drivers/gpu/drm/imx/imx-drm-core.c @@ -431,15 +431,6 @@ int imx_drm_encoder_parse_of(struct drm_device *drm, } EXPORT_SYMBOL_GPL(imx_drm_encoder_parse_of); -static struct device_node *imx_drm_of_get_next_endpoint( - const struct device_node *parent, struct device_node *prev) -{ - struct device_node *node = of_graph_get_next_endpoint(parent, prev); - - of_node_put(prev); - return node; -} - /* * @node: device tree node containing encoder input ports * @encoder: drm_encoder @@ -457,7 +448,7 @@ int imx_drm_encoder_get_mux_id(struct device_node *node, return -EINVAL; do { - ep = imx_drm_of_get_next_endpoint(node, ep); + ep = of_graph_get_next_endpoint(node, ep); if (!ep) break; diff --git a/drivers/gpu/drm/rcar-du/rcar_du_kms.c b/drivers/gpu/drm/rcar-du/rcar_du_kms.c index cc9136e8ee9c..68dab2601bf5 100644 --- a/drivers/gpu/drm/rcar-du/rcar_du_kms.c +++ b/drivers/gpu/drm/rcar-du/rcar_du_kms.c @@ -206,7 +206,7 @@ static int rcar_du_encoders_init_one(struct rcar_du_device *rcdu, enum rcar_du_encoder_type enc_type = RCAR_DU_ENCODER_NONE; struct device_node *connector = NULL; struct device_node *encoder = NULL; - struct device_node *prev = NULL; + struct device_node *ep_node = NULL; struct device_node *entity_ep_node; struct device_node *entity; int ret; @@ -225,11 +225,7 @@ static int rcar_du_encoders_init_one(struct rcar_du_device *rcdu, entity_ep_node = of_parse_phandle(ep->local_node, "remote-endpoint", 0); while (1) { - struct device_node *ep_node; - - ep_node = of_graph_get_next_endpoint(entity, prev); - of_node_put(prev); - prev = ep_node; + ep_node = of_graph_get_next_endpoint(entity, ep_node); if (!ep_node) break; @@ -300,7 +296,7 @@ static int rcar_du_encoders_init_one(struct rcar_du_device *rcdu, static int rcar_du_encoders_init(struct rcar_du_device *rcdu) { struct device_node *np = rcdu->dev->of_node; - struct device_node *prev = NULL; + struct device_node *ep_node = NULL; unsigned int num_encoders = 0; /* @@ -308,15 +304,12 @@ static int rcar_du_encoders_init(struct rcar_du_device *rcdu) * pipeline. */ while (1) { - struct device_node *ep_node; enum rcar_du_output output; struct of_endpoint ep; unsigned int i; int ret; - ep_node = of_graph_get_next_endpoint(np, prev); - of_node_put(prev); - prev = ep_node; + ep_node = of_graph_get_next_endpoint(np, ep_node); if (ep_node == NULL) break; -- cgit v1.2.3