diff options
| author | Dave Airlie <airlied@redhat.com> | 2015-04-13 03:28:16 -0400 |
|---|---|---|
| committer | Dave Airlie <airlied@redhat.com> | 2015-04-13 03:28:16 -0400 |
| commit | bb1dc08c94ead1b98e750caf535422f79363c1a2 (patch) | |
| tree | 8e1db4d7b2de470223c7a98aca3e2f47d6d5ed83 /drivers/gpu/drm | |
| parent | a7d6883619584c2dbeeb5f6a1cf86cde6a3993de (diff) | |
| parent | ecaa4902222fd4d28692203bec028513fbac29c7 (diff) | |
Merge tag 'of-graph-drm-2015-04-08' of git://git.pengutronix.de/git/pza/linux into drm-next
drm: Use of-graph helpers to loop over endpoints
Convert all drm callers that use of_graph_get_next_endpoint to loop over
of-graph endpoints to the newly introduced for_each_endpoint_of_node
helper macro.
* tag 'of-graph-drm-2015-04-08' of git://git.pengutronix.de/git/pza/linux:
drm/rockchip: use for_each_endpoint_of_node macro, drop endpoint reference on break
drm/rcar-du: use for_each_endpoint_of_node macro
drm/imx: use for_each_endpoint_of_node macro in imx_drm_encoder_get_mux_id
drm: use for_each_endpoint_of_node macro in drm_of_find_possible_crtcs
of: Explicitly include linux/types.h in of_graph.h
dt-bindings: brcm: rationalize Broadcom documentation naming
of/unittest: replace 'selftest' with 'unittest'
Documentation: rename of_selftest.txt to of_unittest.txt
Documentation: update the of_selftest.txt
dt: OF_UNITTEST make dependency broken
MAINTAINERS: Pantelis Antoniou device tree overlay maintainer
of: Add of_graph_get_port_by_id function
of: Add for_each_endpoint_of_node helper macro
of: Decrement refcount of previous endpoint in of_graph_get_next_endpoint
Diffstat (limited to 'drivers/gpu/drm')
| -rw-r--r-- | drivers/gpu/drm/drm_of.c | 10 | ||||
| -rw-r--r-- | drivers/gpu/drm/imx/imx-drm-core.c | 20 | ||||
| -rw-r--r-- | drivers/gpu/drm/rcar-du/rcar_du_kms.c | 25 | ||||
| -rw-r--r-- | drivers/gpu/drm/rockchip/rockchip_drm_drv.c | 11 |
4 files changed, 15 insertions, 51 deletions
diff --git a/drivers/gpu/drm/drm_of.c b/drivers/gpu/drm/drm_of.c index 16150a00c237..aaa130736bf8 100644 --- a/drivers/gpu/drm/drm_of.c +++ b/drivers/gpu/drm/drm_of.c | |||
| @@ -43,14 +43,10 @@ static uint32_t drm_crtc_port_mask(struct drm_device *dev, | |||
| 43 | uint32_t drm_of_find_possible_crtcs(struct drm_device *dev, | 43 | uint32_t drm_of_find_possible_crtcs(struct drm_device *dev, |
| 44 | struct device_node *port) | 44 | struct device_node *port) |
| 45 | { | 45 | { |
| 46 | struct device_node *remote_port, *ep = NULL; | 46 | struct device_node *remote_port, *ep; |
| 47 | uint32_t possible_crtcs = 0; | 47 | uint32_t possible_crtcs = 0; |
| 48 | 48 | ||
| 49 | do { | 49 | for_each_endpoint_of_node(port, ep) { |
| 50 | ep = of_graph_get_next_endpoint(port, ep); | ||
| 51 | if (!ep) | ||
| 52 | break; | ||
| 53 | |||
| 54 | remote_port = of_graph_get_remote_port(ep); | 50 | remote_port = of_graph_get_remote_port(ep); |
| 55 | if (!remote_port) { | 51 | if (!remote_port) { |
| 56 | of_node_put(ep); | 52 | of_node_put(ep); |
| @@ -60,7 +56,7 @@ uint32_t drm_of_find_possible_crtcs(struct drm_device *dev, | |||
| 60 | possible_crtcs |= drm_crtc_port_mask(dev, remote_port); | 56 | possible_crtcs |= drm_crtc_port_mask(dev, remote_port); |
| 61 | 57 | ||
| 62 | of_node_put(remote_port); | 58 | of_node_put(remote_port); |
| 63 | } while (1); | 59 | } |
| 64 | 60 | ||
| 65 | return possible_crtcs; | 61 | return possible_crtcs; |
| 66 | } | 62 | } |
diff --git a/drivers/gpu/drm/imx/imx-drm-core.c b/drivers/gpu/drm/imx/imx-drm-core.c index a002f53aab0e..db2f5a739e05 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, | |||
| 431 | } | 431 | } |
| 432 | EXPORT_SYMBOL_GPL(imx_drm_encoder_parse_of); | 432 | EXPORT_SYMBOL_GPL(imx_drm_encoder_parse_of); |
| 433 | 433 | ||
| 434 | static struct device_node *imx_drm_of_get_next_endpoint( | ||
| 435 | const struct device_node *parent, struct device_node *prev) | ||
| 436 | { | ||
| 437 | struct device_node *node = of_graph_get_next_endpoint(parent, prev); | ||
| 438 | |||
| 439 | of_node_put(prev); | ||
| 440 | return node; | ||
| 441 | } | ||
| 442 | |||
| 443 | /* | 434 | /* |
| 444 | * @node: device tree node containing encoder input ports | 435 | * @node: device tree node containing encoder input ports |
| 445 | * @encoder: drm_encoder | 436 | * @encoder: drm_encoder |
| @@ -448,7 +439,7 @@ int imx_drm_encoder_get_mux_id(struct device_node *node, | |||
| 448 | struct drm_encoder *encoder) | 439 | struct drm_encoder *encoder) |
| 449 | { | 440 | { |
| 450 | struct imx_drm_crtc *imx_crtc = imx_drm_find_crtc(encoder->crtc); | 441 | struct imx_drm_crtc *imx_crtc = imx_drm_find_crtc(encoder->crtc); |
| 451 | struct device_node *ep = NULL; | 442 | struct device_node *ep; |
| 452 | struct of_endpoint endpoint; | 443 | struct of_endpoint endpoint; |
| 453 | struct device_node *port; | 444 | struct device_node *port; |
| 454 | int ret; | 445 | int ret; |
| @@ -456,18 +447,15 @@ int imx_drm_encoder_get_mux_id(struct device_node *node, | |||
| 456 | if (!node || !imx_crtc) | 447 | if (!node || !imx_crtc) |
| 457 | return -EINVAL; | 448 | return -EINVAL; |
| 458 | 449 | ||
| 459 | do { | 450 | for_each_endpoint_of_node(node, ep) { |
| 460 | ep = imx_drm_of_get_next_endpoint(node, ep); | ||
| 461 | if (!ep) | ||
| 462 | break; | ||
| 463 | |||
| 464 | port = of_graph_get_remote_port(ep); | 451 | port = of_graph_get_remote_port(ep); |
| 465 | of_node_put(port); | 452 | of_node_put(port); |
| 466 | if (port == imx_crtc->crtc->port) { | 453 | if (port == imx_crtc->crtc->port) { |
| 467 | ret = of_graph_parse_endpoint(ep, &endpoint); | 454 | ret = of_graph_parse_endpoint(ep, &endpoint); |
| 455 | of_node_put(ep); | ||
| 468 | return ret ? ret : endpoint.port; | 456 | return ret ? ret : endpoint.port; |
| 469 | } | 457 | } |
| 470 | } while (ep); | 458 | } |
| 471 | 459 | ||
| 472 | return -EINVAL; | 460 | return -EINVAL; |
| 473 | } | 461 | } |
diff --git a/drivers/gpu/drm/rcar-du/rcar_du_kms.c b/drivers/gpu/drm/rcar-du/rcar_du_kms.c index fb052bca574f..93117f159a3b 100644 --- a/drivers/gpu/drm/rcar-du/rcar_du_kms.c +++ b/drivers/gpu/drm/rcar-du/rcar_du_kms.c | |||
| @@ -509,7 +509,7 @@ static int rcar_du_encoders_init_one(struct rcar_du_device *rcdu, | |||
| 509 | enum rcar_du_encoder_type enc_type = RCAR_DU_ENCODER_NONE; | 509 | enum rcar_du_encoder_type enc_type = RCAR_DU_ENCODER_NONE; |
| 510 | struct device_node *connector = NULL; | 510 | struct device_node *connector = NULL; |
| 511 | struct device_node *encoder = NULL; | 511 | struct device_node *encoder = NULL; |
| 512 | struct device_node *prev = NULL; | 512 | struct device_node *ep_node = NULL; |
| 513 | struct device_node *entity_ep_node; | 513 | struct device_node *entity_ep_node; |
| 514 | struct device_node *entity; | 514 | struct device_node *entity; |
| 515 | int ret; | 515 | int ret; |
| @@ -527,16 +527,7 @@ static int rcar_du_encoders_init_one(struct rcar_du_device *rcdu, | |||
| 527 | 527 | ||
| 528 | entity_ep_node = of_parse_phandle(ep->local_node, "remote-endpoint", 0); | 528 | entity_ep_node = of_parse_phandle(ep->local_node, "remote-endpoint", 0); |
| 529 | 529 | ||
| 530 | while (1) { | 530 | for_each_endpoint_of_node(entity, ep_node) { |
| 531 | struct device_node *ep_node; | ||
| 532 | |||
| 533 | ep_node = of_graph_get_next_endpoint(entity, prev); | ||
| 534 | of_node_put(prev); | ||
| 535 | prev = ep_node; | ||
| 536 | |||
| 537 | if (!ep_node) | ||
| 538 | break; | ||
| 539 | |||
| 540 | if (ep_node == entity_ep_node) | 531 | if (ep_node == entity_ep_node) |
| 541 | continue; | 532 | continue; |
| 542 | 533 | ||
| @@ -603,27 +594,19 @@ static int rcar_du_encoders_init_one(struct rcar_du_device *rcdu, | |||
| 603 | static int rcar_du_encoders_init(struct rcar_du_device *rcdu) | 594 | static int rcar_du_encoders_init(struct rcar_du_device *rcdu) |
| 604 | { | 595 | { |
| 605 | struct device_node *np = rcdu->dev->of_node; | 596 | struct device_node *np = rcdu->dev->of_node; |
| 606 | struct device_node *prev = NULL; | 597 | struct device_node *ep_node; |
| 607 | unsigned int num_encoders = 0; | 598 | unsigned int num_encoders = 0; |
| 608 | 599 | ||
| 609 | /* | 600 | /* |
| 610 | * Iterate over the endpoints and create one encoder for each output | 601 | * Iterate over the endpoints and create one encoder for each output |
| 611 | * pipeline. | 602 | * pipeline. |
| 612 | */ | 603 | */ |
| 613 | while (1) { | 604 | for_each_endpoint_of_node(np, ep_node) { |
| 614 | struct device_node *ep_node; | ||
| 615 | enum rcar_du_output output; | 605 | enum rcar_du_output output; |
| 616 | struct of_endpoint ep; | 606 | struct of_endpoint ep; |
| 617 | unsigned int i; | 607 | unsigned int i; |
| 618 | int ret; | 608 | int ret; |
| 619 | 609 | ||
| 620 | ep_node = of_graph_get_next_endpoint(np, prev); | ||
| 621 | of_node_put(prev); | ||
| 622 | prev = ep_node; | ||
| 623 | |||
| 624 | if (ep_node == NULL) | ||
| 625 | break; | ||
| 626 | |||
| 627 | ret = of_graph_parse_endpoint(ep_node, &ep); | 610 | ret = of_graph_parse_endpoint(ep_node, &ep); |
| 628 | if (ret < 0) { | 611 | if (ret < 0) { |
| 629 | of_node_put(ep_node); | 612 | of_node_put(ep_node); |
diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_drv.c b/drivers/gpu/drm/rockchip/rockchip_drm_drv.c index 30da7813d53e..3962176ee713 100644 --- a/drivers/gpu/drm/rockchip/rockchip_drm_drv.c +++ b/drivers/gpu/drm/rockchip/rockchip_drm_drv.c | |||
| @@ -385,7 +385,7 @@ static const struct dev_pm_ops rockchip_drm_pm_ops = { | |||
| 385 | int rockchip_drm_encoder_get_mux_id(struct device_node *node, | 385 | int rockchip_drm_encoder_get_mux_id(struct device_node *node, |
| 386 | struct drm_encoder *encoder) | 386 | struct drm_encoder *encoder) |
| 387 | { | 387 | { |
| 388 | struct device_node *ep = NULL; | 388 | struct device_node *ep; |
| 389 | struct drm_crtc *crtc = encoder->crtc; | 389 | struct drm_crtc *crtc = encoder->crtc; |
| 390 | struct of_endpoint endpoint; | 390 | struct of_endpoint endpoint; |
| 391 | struct device_node *port; | 391 | struct device_node *port; |
| @@ -394,18 +394,15 @@ int rockchip_drm_encoder_get_mux_id(struct device_node *node, | |||
| 394 | if (!node || !crtc) | 394 | if (!node || !crtc) |
| 395 | return -EINVAL; | 395 | return -EINVAL; |
| 396 | 396 | ||
| 397 | do { | 397 | for_each_endpoint_of_node(node, ep) { |
| 398 | ep = of_graph_get_next_endpoint(node, ep); | ||
| 399 | if (!ep) | ||
| 400 | break; | ||
| 401 | |||
| 402 | port = of_graph_get_remote_port(ep); | 398 | port = of_graph_get_remote_port(ep); |
| 403 | of_node_put(port); | 399 | of_node_put(port); |
| 404 | if (port == crtc->port) { | 400 | if (port == crtc->port) { |
| 405 | ret = of_graph_parse_endpoint(ep, &endpoint); | 401 | ret = of_graph_parse_endpoint(ep, &endpoint); |
| 402 | of_node_put(ep); | ||
| 406 | return ret ?: endpoint.id; | 403 | return ret ?: endpoint.id; |
| 407 | } | 404 | } |
| 408 | } while (ep); | 405 | } |
| 409 | 406 | ||
| 410 | return -EINVAL; | 407 | return -EINVAL; |
| 411 | } | 408 | } |
