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: Constify struct device_node function arguments

Functions which don't change the refcount or otherwise modify struct
device_node can make struct device_node const.

Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Link: https://lore.kernel.org/r/20241010-dt-const-v1-3-87a51f558425@kernel.org
Signed-off-by: Rob Herring (Arm) <robh@kernel.org>

+33 -33
+5 -5
drivers/of/address.c
··· 147 147 * PCI bus specific translator 148 148 */ 149 149 150 - static bool of_node_is_pcie(struct device_node *np) 150 + static bool of_node_is_pcie(const struct device_node *np) 151 151 { 152 152 bool is_pcie = of_node_name_eq(np, "pcie"); 153 153 ··· 230 230 * To guard against that we try to register the IO range first. 231 231 * If that fails we know that pci_address_to_pio() will do too. 232 232 */ 233 - int of_pci_range_to_resource(struct of_pci_range *range, 234 - struct device_node *np, struct resource *res) 233 + int of_pci_range_to_resource(const struct of_pci_range *range, 234 + const struct device_node *np, struct resource *res) 235 235 { 236 236 u64 start; 237 237 int err; ··· 399 399 return NULL; 400 400 } 401 401 402 - static int of_empty_ranges_quirk(struct device_node *np) 402 + static int of_empty_ranges_quirk(const struct device_node *np) 403 403 { 404 404 if (IS_ENABLED(CONFIG_PPC)) { 405 405 /* To save cycles, we cache the result for global "Mac" setting */ ··· 1030 1030 * This is currently only enabled on builds that support Apple ARM devices, as 1031 1031 * an optimization. 1032 1032 */ 1033 - static bool of_mmio_is_nonposted(struct device_node *np) 1033 + static bool of_mmio_is_nonposted(const struct device_node *np) 1034 1034 { 1035 1035 if (!IS_ENABLED(CONFIG_ARCH_APPLE)) 1036 1036 return false;
+4 -4
drivers/of/base.c
··· 771 771 } 772 772 EXPORT_SYMBOL(of_get_child_by_name); 773 773 774 - struct device_node *__of_find_node_by_path(struct device_node *parent, 774 + struct device_node *__of_find_node_by_path(const struct device_node *parent, 775 775 const char *path) 776 776 { 777 777 struct device_node *child; ··· 1840 1840 * 1841 1841 * Return: The alias id if found. 1842 1842 */ 1843 - int of_alias_get_id(struct device_node *np, const char *stem) 1843 + int of_alias_get_id(const struct device_node *np, const char *stem) 1844 1844 { 1845 1845 struct alias_prop *app; 1846 1846 int id = -ENODEV; ··· 1898 1898 * 1899 1899 * Return: TRUE if console successfully setup. Otherwise return FALSE. 1900 1900 */ 1901 - bool of_console_check(struct device_node *dn, char *name, int index) 1901 + bool of_console_check(const struct device_node *dn, char *name, int index) 1902 1902 { 1903 1903 if (!dn || dn != of_stdout || console_set_on_cmdline) 1904 1904 return false; ··· 1986 1986 * 1987 1987 * Return: 0 on success or a standard error code on failure. 1988 1988 */ 1989 - int of_map_id(struct device_node *np, u32 id, 1989 + int of_map_id(const struct device_node *np, u32 id, 1990 1990 const char *map_name, const char *map_mask_name, 1991 1991 struct device_node **target, u32 *id_out) 1992 1992 {
+1 -1
drivers/of/cpu.c
··· 188 188 * Return: An idle state node if found at @index. The refcount is incremented 189 189 * for it, so call of_node_put() on it when done. Returns NULL if not found. 190 190 */ 191 - struct device_node *of_get_cpu_state_node(struct device_node *cpu_node, 191 + struct device_node *of_get_cpu_state_node(const struct device_node *cpu_node, 192 192 int index) 193 193 { 194 194 struct of_phandle_args args;
+2 -2
drivers/of/irq.c
··· 720 720 * Returns: the MSI domain for this device (or NULL on failure). 721 721 */ 722 722 struct irq_domain *of_msi_get_domain(struct device *dev, 723 - struct device_node *np, 723 + const struct device_node *np, 724 724 enum irq_domain_bus_token token) 725 725 { 726 726 struct of_phandle_iterator it; ··· 742 742 * @dev: device structure to associate with an MSI irq domain 743 743 * @np: device node for that device 744 744 */ 745 - void of_msi_configure(struct device *dev, struct device_node *np) 745 + void of_msi_configure(struct device *dev, const struct device_node *np) 746 746 { 747 747 dev_set_msi_domain(dev, 748 748 of_msi_get_domain(dev, np, DOMAIN_BUS_PLATFORM_MSI));
+1 -1
drivers/of/of_private.h
··· 127 127 struct device_node *__of_node_dup(const struct device_node *np, 128 128 const char *full_name); 129 129 130 - struct device_node *__of_find_node_by_path(struct device_node *parent, 130 + struct device_node *__of_find_node_by_path(const struct device_node *parent, 131 131 const char *path); 132 132 struct device_node *__of_find_node_by_full_path(struct device_node *node, 133 133 const char *path);
+7 -7
drivers/of/overlay.c
··· 398 398 * invalid @overlay. 399 399 */ 400 400 static int add_changeset_node(struct overlay_changeset *ovcs, 401 - struct target *target, struct device_node *node) 401 + struct target *target, const struct device_node *node) 402 402 { 403 403 const char *node_kbasename; 404 404 const __be32 *phandle; ··· 675 675 * 1) "target" property containing the phandle of the target 676 676 * 2) "target-path" property containing the path of the target 677 677 */ 678 - static struct device_node *find_target(struct device_node *info_node, 679 - struct device_node *target_base) 678 + static struct device_node *find_target(const struct device_node *info_node, 679 + const struct device_node *target_base) 680 680 { 681 681 struct device_node *node; 682 682 char *target_path; ··· 735 735 * init_overlay_changeset() must call free_overlay_changeset(). 736 736 */ 737 737 static int init_overlay_changeset(struct overlay_changeset *ovcs, 738 - struct device_node *target_base) 738 + const struct device_node *target_base) 739 739 { 740 740 struct device_node *node, *overlay_node; 741 741 struct fragment *fragment; ··· 910 910 */ 911 911 912 912 static int of_overlay_apply(struct overlay_changeset *ovcs, 913 - struct device_node *base) 913 + const struct device_node *base) 914 914 { 915 915 int ret = 0, ret_revert, ret_tmp; 916 916 ··· 978 978 */ 979 979 980 980 int of_overlay_fdt_apply(const void *overlay_fdt, u32 overlay_fdt_size, 981 - int *ret_ovcs_id, struct device_node *base) 981 + int *ret_ovcs_id, const struct device_node *base) 982 982 { 983 983 void *new_fdt; 984 984 void *new_fdt_align; ··· 1074 1074 * 1075 1075 * Returns 1 if @np is @tree or is contained in @tree, else 0 1076 1076 */ 1077 - static int find_node(struct device_node *tree, struct device_node *np) 1077 + static int find_node(const struct device_node *tree, struct device_node *np) 1078 1078 { 1079 1079 if (tree == np) 1080 1080 return 1;
+2 -2
drivers/of/resolver.c
··· 147 147 * of offsets of the phandle reference(s) within the respective property 148 148 * value(s). The values at these offsets will be fixed up. 149 149 */ 150 - static int adjust_local_phandle_references(struct device_node *local_fixups, 151 - struct device_node *overlay, int phandle_delta) 150 + static int adjust_local_phandle_references(const struct device_node *local_fixups, 151 + const struct device_node *overlay, int phandle_delta) 152 152 { 153 153 struct device_node *overlay_child; 154 154 struct property *prop_fix, *prop;
+7 -7
include/linux/of.h
··· 357 357 extern struct device_node *of_cpu_device_node_get(int cpu); 358 358 extern int of_cpu_node_to_id(struct device_node *np); 359 359 extern struct device_node *of_get_next_cpu_node(struct device_node *prev); 360 - extern struct device_node *of_get_cpu_state_node(struct device_node *cpu_node, 360 + extern struct device_node *of_get_cpu_state_node(const struct device_node *cpu_node, 361 361 int index); 362 362 extern u64 of_get_cpu_hwid(struct device_node *cpun, unsigned int thread); 363 363 ··· 395 395 int size); 396 396 397 397 extern void of_alias_scan(void * (*dt_alloc)(u64 size, u64 align)); 398 - extern int of_alias_get_id(struct device_node *np, const char *stem); 398 + extern int of_alias_get_id(const struct device_node *np, const char *stem); 399 399 extern int of_alias_get_highest_id(const char *stem); 400 400 401 401 bool of_machine_compatible_match(const char *const *compats); ··· 446 446 */ 447 447 const char *of_prop_next_string(struct property *prop, const char *cur); 448 448 449 - bool of_console_check(struct device_node *dn, char *name, int index); 449 + bool of_console_check(const struct device_node *dn, char *name, int index); 450 450 451 - int of_map_id(struct device_node *np, u32 id, 451 + int of_map_id(const struct device_node *np, u32 id, 452 452 const char *map_name, const char *map_mask_name, 453 453 struct device_node **target, u32 *id_out); 454 454 ··· 871 871 { 872 872 } 873 873 874 - static inline int of_map_id(struct device_node *np, u32 id, 874 + static inline int of_map_id(const struct device_node *np, u32 id, 875 875 const char *map_name, const char *map_mask_name, 876 876 struct device_node **target, u32 *id_out) 877 877 { ··· 1734 1734 #ifdef CONFIG_OF_OVERLAY 1735 1735 1736 1736 int of_overlay_fdt_apply(const void *overlay_fdt, u32 overlay_fdt_size, 1737 - int *ovcs_id, struct device_node *target_base); 1737 + int *ovcs_id, const struct device_node *target_base); 1738 1738 int of_overlay_remove(int *ovcs_id); 1739 1739 int of_overlay_remove_all(void); 1740 1740 ··· 1744 1744 #else 1745 1745 1746 1746 static inline int of_overlay_fdt_apply(const void *overlay_fdt, u32 overlay_fdt_size, 1747 - int *ovcs_id, struct device_node *target_base) 1747 + int *ovcs_id, const struct device_node *target_base) 1748 1748 { 1749 1749 return -ENOTSUPP; 1750 1750 }
+2 -2
include/linux/of_address.h
··· 83 83 struct of_pci_range *range); 84 84 extern int of_pci_address_to_resource(struct device_node *dev, int bar, 85 85 struct resource *r); 86 - extern int of_pci_range_to_resource(struct of_pci_range *range, 87 - struct device_node *np, 86 + extern int of_pci_range_to_resource(const struct of_pci_range *range, 87 + const struct device_node *np, 88 88 struct resource *res); 89 89 extern int of_range_to_resource(struct device_node *np, int index, 90 90 struct resource *res);
+2 -2
include/linux/of_irq.h
··· 48 48 struct resource *res, int nr_irqs); 49 49 extern struct device_node *of_irq_find_parent(struct device_node *child); 50 50 extern struct irq_domain *of_msi_get_domain(struct device *dev, 51 - struct device_node *np, 51 + const struct device_node *np, 52 52 enum irq_domain_bus_token token); 53 53 extern struct irq_domain *of_msi_map_get_device_domain(struct device *dev, 54 54 u32 id, 55 55 u32 bus_token); 56 - extern void of_msi_configure(struct device *dev, struct device_node *np); 56 + extern void of_msi_configure(struct device *dev, const struct device_node *np); 57 57 u32 of_msi_map_id(struct device *dev, struct device_node *msi_np, u32 id_in); 58 58 #else 59 59 static inline void of_irq_init(const struct of_device_id *matches)