Skip to content

Commit 78cd57b

Browse files
morimotorobherring
authored andcommitted
fbdev: omapfb: use new of_graph functions
Now we can use new port related functions for port parsing. Use it. Signed-off-by: Kuninori Morimoto <[email protected]> Acked-by: Helge Deller <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Rob Herring (Arm) <[email protected]>
1 parent c005d37 commit 78cd57b

File tree

5 files changed

+13
-87
lines changed

5 files changed

+13
-87
lines changed

drivers/video/fbdev/omap2/omapfb/dss/dpi.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
#include <linux/regulator/consumer.h>
2121
#include <linux/string.h>
2222
#include <linux/of.h>
23+
#include <linux/of_graph.h>
2324
#include <linux/clk.h>
2425
#include <linux/component.h>
2526

@@ -845,7 +846,7 @@ int dpi_init_port(struct platform_device *pdev, struct device_node *port)
845846
if (!dpi)
846847
return -ENOMEM;
847848

848-
ep = omapdss_of_get_next_endpoint(port, NULL);
849+
ep = of_graph_get_next_port_endpoint(port, NULL);
849850
if (!ep)
850851
return 0;
851852

drivers/video/fbdev/omap2/omapfb/dss/dss-of.c

Lines changed: 0 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -15,72 +15,6 @@
1515

1616
#include "dss.h"
1717

18-
struct device_node *
19-
omapdss_of_get_next_port(const struct device_node *parent,
20-
struct device_node *prev)
21-
{
22-
struct device_node *port = NULL;
23-
24-
if (!parent)
25-
return NULL;
26-
27-
if (!prev) {
28-
struct device_node *ports;
29-
/*
30-
* It's the first call, we have to find a port subnode
31-
* within this node or within an optional 'ports' node.
32-
*/
33-
ports = of_get_child_by_name(parent, "ports");
34-
if (ports)
35-
parent = ports;
36-
37-
port = of_get_child_by_name(parent, "port");
38-
39-
/* release the 'ports' node */
40-
of_node_put(ports);
41-
} else {
42-
struct device_node *ports;
43-
44-
ports = of_get_parent(prev);
45-
if (!ports)
46-
return NULL;
47-
48-
do {
49-
port = of_get_next_child(ports, prev);
50-
if (!port) {
51-
of_node_put(ports);
52-
return NULL;
53-
}
54-
prev = port;
55-
} while (!of_node_name_eq(port, "port"));
56-
57-
of_node_put(ports);
58-
}
59-
60-
return port;
61-
}
62-
EXPORT_SYMBOL_GPL(omapdss_of_get_next_port);
63-
64-
struct device_node *
65-
omapdss_of_get_next_endpoint(const struct device_node *parent,
66-
struct device_node *prev)
67-
{
68-
struct device_node *ep = NULL;
69-
70-
if (!parent)
71-
return NULL;
72-
73-
do {
74-
ep = of_get_next_child(parent, prev);
75-
if (!ep)
76-
return NULL;
77-
prev = ep;
78-
} while (!of_node_name_eq(ep, "endpoint"));
79-
80-
return ep;
81-
}
82-
EXPORT_SYMBOL_GPL(omapdss_of_get_next_endpoint);
83-
8418
struct device_node *dss_of_port_get_parent_device(struct device_node *port)
8519
{
8620
struct device_node *np;

drivers/video/fbdev/omap2/omapfb/dss/dss.c

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
#include <linux/mfd/syscon.h>
2727
#include <linux/regmap.h>
2828
#include <linux/of.h>
29+
#include <linux/of_graph.h>
2930
#include <linux/regulator/consumer.h>
3031
#include <linux/suspend.h>
3132
#include <linux/component.h>
@@ -919,10 +920,7 @@ static int dss_init_ports(struct platform_device *pdev)
919920
struct device_node *port;
920921
int r, ret = 0;
921922

922-
if (parent == NULL)
923-
return 0;
924-
925-
port = omapdss_of_get_next_port(parent, NULL);
923+
port = of_graph_get_next_port(parent, NULL);
926924
if (!port)
927925
return 0;
928926

@@ -952,8 +950,9 @@ static int dss_init_ports(struct platform_device *pdev)
952950
default:
953951
break;
954952
}
955-
} while (!ret &&
956-
(port = omapdss_of_get_next_port(parent, port)) != NULL);
953+
954+
port = of_graph_get_next_port(parent, port);
955+
} while (!ret && port);
957956

958957
if (ret)
959958
dss_uninit_ports(pdev);
@@ -966,10 +965,7 @@ static void dss_uninit_ports(struct platform_device *pdev)
966965
struct device_node *parent = pdev->dev.of_node;
967966
struct device_node *port;
968967

969-
if (parent == NULL)
970-
return;
971-
972-
port = omapdss_of_get_next_port(parent, NULL);
968+
port = of_graph_get_next_port(parent, NULL);
973969
if (!port)
974970
return;
975971

@@ -1000,7 +996,9 @@ static void dss_uninit_ports(struct platform_device *pdev)
1000996
default:
1001997
break;
1002998
}
1003-
} while ((port = omapdss_of_get_next_port(parent, port)) != NULL);
999+
1000+
port = of_graph_get_next_port(parent, port);
1001+
} while (port);
10041002
}
10051003

10061004
static int dss_video_pll_probe(struct platform_device *pdev)

drivers/video/fbdev/omap2/omapfb/dss/sdi.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
#include <linux/platform_device.h>
1717
#include <linux/string.h>
1818
#include <linux/of.h>
19+
#include <linux/of_graph.h>
1920
#include <linux/component.h>
2021

2122
#include <video/omapfb_dss.h>
@@ -405,7 +406,7 @@ int sdi_init_port(struct platform_device *pdev, struct device_node *port)
405406
u32 datapairs;
406407
int r;
407408

408-
ep = omapdss_of_get_next_endpoint(port, NULL);
409+
ep = of_graph_get_next_port_endpoint(port, NULL);
409410
if (!ep)
410411
return 0;
411412

include/video/omapfb_dss.h

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -811,14 +811,6 @@ static inline bool omapdss_device_is_enabled(struct omap_dss_device *dssdev)
811811
return dssdev->state == OMAP_DSS_DISPLAY_ACTIVE;
812812
}
813813

814-
struct device_node *
815-
omapdss_of_get_next_port(const struct device_node *parent,
816-
struct device_node *prev);
817-
818-
struct device_node *
819-
omapdss_of_get_next_endpoint(const struct device_node *parent,
820-
struct device_node *prev);
821-
822814
struct omap_dss_device *
823815
omapdss_of_find_source_for_first_ep(struct device_node *node);
824816
#else

0 commit comments

Comments
 (0)