summaryrefslogtreecommitdiff
path: root/drivers/gpu
diff options
context:
space:
mode:
authorRob Herring <robh@kernel.org>2015-03-25 00:41:08 -0500
committerRob Herring <robh@kernel.org>2015-03-25 00:41:08 -0500
commit8147e2e8f13d823307e1edf2add5a8df84180cca (patch)
tree476eae8727d98c56027ca1036a8f61ff261c9c51 /drivers/gpu
parentbc465aa9d045feb0e13b4a8f32cc33c1943f62d6 (diff)
parentbfe446e37c4efd8ade454911e8f80414bcbfc10d (diff)
Merge tag 'of-graph-for-4.0' of git://git.pengutronix.de/git/pza/linux into for-next
Pull of-graph helpers from Philipp Zabel: of: Add of-graph helpers to loop over endpoints and find ports by id This series converts of_graph_get_next_endpoint to decrement the refcount of the passed prev parameter. This allows to add a for_each_endpoint_of_node helper macro to loop over all endpoints in a device tree node. The of_graph_get_port_by_id function is added to retrieve a port by its known port id (contained in the reg property) from the device tree.
Diffstat (limited to 'drivers/gpu')
-rw-r--r--drivers/gpu/drm/imx/imx-drm-core.c11
-rw-r--r--drivers/gpu/drm/rcar-du/rcar_du_kms.c15
2 files changed, 5 insertions, 21 deletions
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;