1 From 4d4703e0199fb3556c37694e4d951785abca22fd Mon Sep 17 00:00:00 2001
2 From: Bruce Ashfield <bruce.ashfield@gmail.com>
3 Date: Wed, 19 Jan 2022 12:46:42 -0500
4 Subject: [PATCH] Revert "libfdt: overlay: make overlay_get_target() public"
6 This reverts commit 45f3d1a095dd3440578d5c6313eba555a791f3fb.
8 Upstream-Status: Inappropriate [embedded specific]
11 libfdt/fdt_overlay.c | 29 ++++++++++++++++++++++-------
12 libfdt/libfdt.h | 18 ------------------
13 libfdt/version.lds | 1 -
14 3 files changed, 22 insertions(+), 26 deletions(-)
16 diff --git a/libfdt/fdt_overlay.c b/libfdt/fdt_overlay.c
17 index 5c0c398..d217e79 100644
18 --- a/libfdt/fdt_overlay.c
19 +++ b/libfdt/fdt_overlay.c
20 @@ -40,22 +40,37 @@ static uint32_t overlay_get_target_phandle(const void *fdto, int fragment)
21 return fdt32_to_cpu(*val);
24 -int fdt_overlay_target_offset(const void *fdt, const void *fdto,
25 - int fragment_offset, char const **pathp)
27 + * overlay_get_target - retrieves the offset of a fragment's target
28 + * @fdt: Base device tree blob
29 + * @fdto: Device tree overlay blob
30 + * @fragment: node offset of the fragment in the overlay
31 + * @pathp: pointer which receives the path of the target (or NULL)
33 + * overlay_get_target() retrieves the target offset in the base
34 + * device tree of a fragment, no matter how the actual targeting is
35 + * done (through a phandle or a path)
38 + * the targeted node offset in the base device tree
39 + * Negative error code on error
41 +static int overlay_get_target(const void *fdt, const void *fdto,
42 + int fragment, char const **pathp)
45 const char *path = NULL;
46 int path_len = 0, ret;
48 /* Try first to do a phandle based lookup */
49 - phandle = overlay_get_target_phandle(fdto, fragment_offset);
50 + phandle = overlay_get_target_phandle(fdto, fragment);
51 if (phandle == (uint32_t)-1)
52 return -FDT_ERR_BADPHANDLE;
54 /* no phandle, try path */
56 /* And then a path based lookup */
57 - path = fdt_getprop(fdto, fragment_offset, "target-path", &path_len);
58 + path = fdt_getprop(fdto, fragment, "target-path", &path_len);
60 ret = fdt_path_offset(fdt, path);
62 @@ -621,7 +636,7 @@ static int overlay_merge(void *fdt, void *fdto)
66 - target = fdt_overlay_target_offset(fdt, fdto, fragment, NULL);
67 + target = overlay_get_target(fdt, fdto, fragment, NULL);
71 @@ -764,7 +779,7 @@ static int overlay_symbol_update(void *fdt, void *fdto)
72 return -FDT_ERR_BADOVERLAY;
74 /* get the target of the fragment */
75 - ret = fdt_overlay_target_offset(fdt, fdto, fragment, &target_path);
76 + ret = overlay_get_target(fdt, fdto, fragment, &target_path);
80 @@ -786,7 +801,7 @@ static int overlay_symbol_update(void *fdt, void *fdto)
83 /* again in case setprop_placeholder changed it */
84 - ret = fdt_overlay_target_offset(fdt, fdto, fragment, &target_path);
85 + ret = overlay_get_target(fdt, fdto, fragment, &target_path);
89 diff --git a/libfdt/libfdt.h b/libfdt/libfdt.h
90 index a7f432c..7f117e8 100644
93 @@ -2116,24 +2116,6 @@ int fdt_del_node(void *fdt, int nodeoffset);
95 int fdt_overlay_apply(void *fdt, void *fdto);
98 - * fdt_overlay_target_offset - retrieves the offset of a fragment's target
99 - * @fdt: Base device tree blob
100 - * @fdto: Device tree overlay blob
101 - * @fragment_offset: node offset of the fragment in the overlay
102 - * @pathp: pointer which receives the path of the target (or NULL)
104 - * fdt_overlay_target_offset() retrieves the target offset in the base
105 - * device tree of a fragment, no matter how the actual targeting is
106 - * done (through a phandle or a path)
109 - * the targeted node offset in the base device tree
110 - * Negative error code on error
112 -int fdt_overlay_target_offset(const void *fdt, const void *fdto,
113 - int fragment_offset, char const **pathp);
115 /**********************************************************************/
116 /* Debugging / informational functions */
117 /**********************************************************************/
118 diff --git a/libfdt/version.lds b/libfdt/version.lds
119 index cbce5d4..7ab85f1 100644
120 --- a/libfdt/version.lds
121 +++ b/libfdt/version.lds
122 @@ -77,7 +77,6 @@ LIBFDT_1.2 {
123 fdt_appendprop_addrrange;
124 fdt_setprop_inplace_namelen_partial;
125 fdt_create_with_flags;
126 - fdt_overlay_target_offset;