Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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>

authored by

Stephen Boyd and committed by
Rob Herring
9b4d2b63 253a41c6

+5 -43
+5 -32
drivers/of/fdt.c
··· 38 38 * memory entries in the /memory node. This function may be called 39 39 * any time after initial_boot_param is set. 40 40 */ 41 - void of_fdt_limit_memory(int limit) 41 + void __init of_fdt_limit_memory(int limit) 42 42 { 43 43 int memory; 44 44 int len; ··· 110 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 - */ 122 - bool 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 - 132 113 static bool of_fdt_device_is_available(const void *blob, unsigned long node) 133 114 { 134 115 const char *status = fdt_getprop(blob, node, "status", NULL); ··· 126 145 /** 127 146 * of_fdt_match - Return true if node matches a list of compatible values 128 147 */ 129 - int of_fdt_match(const void *blob, unsigned long node, 130 - const char *const *compat) 148 + static int __init of_fdt_match(const void *blob, unsigned long node, 149 + const char *const *compat) 131 150 { 132 151 unsigned int tmp, score = 0; 133 152 ··· 739 758 * @return offset of the subnode, or -FDT_ERR_NOTFOUND if there is none 740 759 */ 741 760 742 - int of_get_flat_dt_subnode_by_name(unsigned long node, const char *uname) 761 + int __init of_get_flat_dt_subnode_by_name(unsigned long node, const char *uname) 743 762 { 744 763 return fdt_subnode_offset(initial_boot_params, node, uname); 745 764 } ··· 750 769 unsigned long __init of_get_flat_dt_root(void) 751 770 { 752 771 return 0; 753 - } 754 - 755 - /** 756 - * of_get_flat_dt_size - Return the total size of the FDT 757 - */ 758 - int __init of_get_flat_dt_size(void) 759 - { 760 - return fdt_totalsize(initial_boot_params); 761 772 } 762 773 763 774 /** ··· 777 804 /** 778 805 * of_flat_dt_match - Return true if node matches a list of compatible values 779 806 */ 780 - int __init of_flat_dt_match(unsigned long node, const char *const *compat) 807 + static int __init of_flat_dt_match(unsigned long node, const char *const *compat) 781 808 { 782 809 return of_fdt_match(initial_boot_params, node, compat); 783 810 }
-11
include/linux/of_fdt.h
··· 23 23 struct device_node; 24 24 25 25 /* For scanning an arbitrary device-tree at any time */ 26 - extern char *of_fdt_get_string(const void *blob, u32 offset); 27 - extern void *of_fdt_get_property(const void *blob, 28 - unsigned long node, 29 - const char *name, 30 - int *size); 31 - extern bool of_fdt_is_big_endian(const void *blob, 32 - unsigned long node); 33 - extern int of_fdt_match(const void *blob, unsigned long node, 34 - const char *const *compat); 35 26 extern void *of_fdt_unflatten_tree(const unsigned long *blob, 36 27 struct device_node *dad, 37 28 struct device_node **mynodes); ··· 55 64 extern const void *of_get_flat_dt_prop(unsigned long node, const char *name, 56 65 int *size); 57 66 extern int of_flat_dt_is_compatible(unsigned long node, const char *name); 58 - extern int of_flat_dt_match(unsigned long node, const char *const *matches); 59 67 extern unsigned long of_get_flat_dt_root(void); 60 - extern int of_get_flat_dt_size(void); 61 68 extern uint32_t of_get_flat_dt_phandle(unsigned long node); 62 69 63 70 extern int early_init_dt_scan_chosen(unsigned long node, const char *uname,