summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStephen Boyd <swboyd@chromium.org>2019-05-14 16:40:52 -0400
committerRob Herring <robh@kernel.org>2019-05-24 17:39:14 -0400
commit9b4d2b635bd0cf8dfc45223f66fd85792fd2dc7b (patch)
tree22d5b2c6245a0c39e3e5b6cfe3856ae2da072644
parent253a41c6fbadd1305e25f84ffc455f2b4d57439c (diff)
of/fdt: Remove dead code and mark functions with __init
Some functions in here are never called, and others are only called during __init. Remove the dead code and some dead exports for functions that don't exist (I'm looking at you of_fdt_get_string!). Mark some functions with __init so we can throw them away after we boot up and poke at the FDT blob too. Cc: Hsin-Yi Wang <hsinyi@chromium.org> Signed-off-by: Stephen Boyd <swboyd@chromium.org> Signed-off-by: Rob Herring <robh@kernel.org>
-rw-r--r--drivers/of/fdt.c37
-rw-r--r--include/linux/of_fdt.h11
2 files changed, 5 insertions, 43 deletions
diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c
index de893c9616a1..918098c9f72a 100644
--- a/drivers/of/fdt.c
+++ b/drivers/of/fdt.c
@@ -38,7 +38,7 @@
38 * memory entries in the /memory node. This function may be called 38 * memory entries in the /memory node. This function may be called
39 * any time after initial_boot_param is set. 39 * any time after initial_boot_param is set.
40 */ 40 */
41void of_fdt_limit_memory(int limit) 41void __init of_fdt_limit_memory(int limit)
42{ 42{
43 int memory; 43 int memory;
44 int len; 44 int len;
@@ -110,25 +110,6 @@ static int of_fdt_is_compatible(const void *blob,
110 return 0; 110 return 0;
111} 111}
112 112
113/**
114 * of_fdt_is_big_endian - Return true if given node needs BE MMIO accesses
115 * @blob: A device tree blob
116 * @node: node to test
117 *
118 * Returns true if the node has a "big-endian" property, or if the kernel
119 * was compiled for BE *and* the node has a "native-endian" property.
120 * Returns false otherwise.
121 */
122bool of_fdt_is_big_endian(const void *blob, unsigned long node)
123{
124 if (fdt_getprop(blob, node, "big-endian", NULL))
125 return true;
126 if (IS_ENABLED(CONFIG_CPU_BIG_ENDIAN) &&
127 fdt_getprop(blob, node, "native-endian", NULL))
128 return true;
129 return false;
130}
131
132static bool of_fdt_device_is_available(const void *blob, unsigned long node) 113static bool of_fdt_device_is_available(const void *blob, unsigned long node)
133{ 114{
134 const char *status = fdt_getprop(blob, node, "status", NULL); 115 const char *status = fdt_getprop(blob, node, "status", NULL);
@@ -145,8 +126,8 @@ static bool of_fdt_device_is_available(const void *blob, unsigned long node)
145/** 126/**
146 * of_fdt_match - Return true if node matches a list of compatible values 127 * of_fdt_match - Return true if node matches a list of compatible values
147 */ 128 */
148int of_fdt_match(const void *blob, unsigned long node, 129static int __init of_fdt_match(const void *blob, unsigned long node,
149 const char *const *compat) 130 const char *const *compat)
150{ 131{
151 unsigned int tmp, score = 0; 132 unsigned int tmp, score = 0;
152 133
@@ -758,7 +739,7 @@ int __init of_scan_flat_dt_subnodes(unsigned long parent,
758 * @return offset of the subnode, or -FDT_ERR_NOTFOUND if there is none 739 * @return offset of the subnode, or -FDT_ERR_NOTFOUND if there is none
759 */ 740 */
760 741
761int of_get_flat_dt_subnode_by_name(unsigned long node, const char *uname) 742int __init of_get_flat_dt_subnode_by_name(unsigned long node, const char *uname)
762{ 743{
763 return fdt_subnode_offset(initial_boot_params, node, uname); 744 return fdt_subnode_offset(initial_boot_params, node, uname);
764} 745}
@@ -772,14 +753,6 @@ unsigned long __init of_get_flat_dt_root(void)
772} 753}
773 754
774/** 755/**
775 * of_get_flat_dt_size - Return the total size of the FDT
776 */
777int __init of_get_flat_dt_size(void)
778{
779 return fdt_totalsize(initial_boot_params);
780}
781
782/**
783 * of_get_flat_dt_prop - Given a node in the flat blob, return the property ptr 756 * of_get_flat_dt_prop - Given a node in the flat blob, return the property ptr
784 * 757 *
785 * This function can be used within scan_flattened_dt callback to get 758 * This function can be used within scan_flattened_dt callback to get
@@ -804,7 +777,7 @@ int __init of_flat_dt_is_compatible(unsigned long node, const char *compat)
804/** 777/**
805 * of_flat_dt_match - Return true if node matches a list of compatible values 778 * of_flat_dt_match - Return true if node matches a list of compatible values
806 */ 779 */
807int __init of_flat_dt_match(unsigned long node, const char *const *compat) 780static int __init of_flat_dt_match(unsigned long node, const char *const *compat)
808{ 781{
809 return of_fdt_match(initial_boot_params, node, compat); 782 return of_fdt_match(initial_boot_params, node, compat);
810} 783}
diff --git a/include/linux/of_fdt.h b/include/linux/of_fdt.h
index a713e5d156d8..acf820e88952 100644
--- a/include/linux/of_fdt.h
+++ b/include/linux/of_fdt.h
@@ -23,15 +23,6 @@
23struct device_node; 23struct device_node;
24 24
25/* For scanning an arbitrary device-tree at any time */ 25/* For scanning an arbitrary device-tree at any time */
26extern char *of_fdt_get_string(const void *blob, u32 offset);
27extern void *of_fdt_get_property(const void *blob,
28 unsigned long node,
29 const char *name,
30 int *size);
31extern bool of_fdt_is_big_endian(const void *blob,
32 unsigned long node);
33extern int of_fdt_match(const void *blob, unsigned long node,
34 const char *const *compat);
35extern void *of_fdt_unflatten_tree(const unsigned long *blob, 26extern void *of_fdt_unflatten_tree(const unsigned long *blob,
36 struct device_node *dad, 27 struct device_node *dad,
37 struct device_node **mynodes); 28 struct device_node **mynodes);
@@ -64,9 +55,7 @@ extern int of_get_flat_dt_subnode_by_name(unsigned long node,
64extern const void *of_get_flat_dt_prop(unsigned long node, const char *name, 55extern const void *of_get_flat_dt_prop(unsigned long node, const char *name,
65 int *size); 56 int *size);
66extern int of_flat_dt_is_compatible(unsigned long node, const char *name); 57extern int of_flat_dt_is_compatible(unsigned long node, const char *name);
67extern int of_flat_dt_match(unsigned long node, const char *const *matches);
68extern unsigned long of_get_flat_dt_root(void); 58extern unsigned long of_get_flat_dt_root(void);
69extern int of_get_flat_dt_size(void);
70extern uint32_t of_get_flat_dt_phandle(unsigned long node); 59extern uint32_t of_get_flat_dt_phandle(unsigned long node);
71 60
72extern int early_init_dt_scan_chosen(unsigned long node, const char *uname, 61extern int early_init_dt_scan_chosen(unsigned long node, const char *uname,