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

net: wan: framer: constify of_phandle_args in xlate

The xlate callbacks are supposed to translate of_phandle_args to proper
provider without modifying the of_phandle_args. Make the argument
pointer to const for code safety and readability.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Reviewed-by: Simon Horman <horms@kernel.org>
Link: https://lore.kernel.org/r/20240217100306.86740-1-krzysztof.kozlowski@linaro.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

authored by

Krzysztof Kozlowski and committed by
Jakub Kicinski
2f3bfa8e f4d3e595

+12 -11
+5 -4
drivers/net/wan/framer/framer-core.c
··· 384 384 return ERR_PTR(-EPROBE_DEFER); 385 385 } 386 386 387 - static struct framer *framer_of_get_from_provider(struct of_phandle_args *args) 387 + static struct framer *framer_of_get_from_provider(const struct of_phandle_args *args) 388 388 { 389 389 struct framer_provider *framer_provider; 390 390 struct framer *framer; ··· 735 735 * should provide a custom of_xlate function that reads the *args* and returns 736 736 * the appropriate framer. 737 737 */ 738 - struct framer *framer_provider_simple_of_xlate(struct device *dev, struct of_phandle_args *args) 738 + struct framer *framer_provider_simple_of_xlate(struct device *dev, 739 + const struct of_phandle_args *args) 739 740 { 740 741 struct class_dev_iter iter; 741 742 struct framer *framer; ··· 769 768 struct framer_provider * 770 769 __framer_provider_of_register(struct device *dev, struct module *owner, 771 770 struct framer *(*of_xlate)(struct device *dev, 772 - struct of_phandle_args *args)) 771 + const struct of_phandle_args *args)) 773 772 { 774 773 struct framer_provider *framer_provider; 775 774 ··· 831 830 struct framer_provider * 832 831 __devm_framer_provider_of_register(struct device *dev, struct module *owner, 833 832 struct framer *(*of_xlate)(struct device *dev, 834 - struct of_phandle_args *args)) 833 + const struct of_phandle_args *args)) 835 834 { 836 835 struct framer_provider **ptr, *framer_provider; 837 836
+7 -7
include/linux/framer/framer-provider.h
··· 93 93 struct module *owner; 94 94 struct list_head list; 95 95 struct framer * (*of_xlate)(struct device *dev, 96 - struct of_phandle_args *args); 96 + const struct of_phandle_args *args); 97 97 }; 98 98 99 99 static inline void framer_set_drvdata(struct framer *framer, void *data) ··· 118 118 const struct framer_ops *ops); 119 119 120 120 struct framer *framer_provider_simple_of_xlate(struct device *dev, 121 - struct of_phandle_args *args); 121 + const struct of_phandle_args *args); 122 122 123 123 struct framer_provider * 124 124 __framer_provider_of_register(struct device *dev, struct module *owner, 125 125 struct framer *(*of_xlate)(struct device *dev, 126 - struct of_phandle_args *args)); 126 + const struct of_phandle_args *args)); 127 127 128 128 void framer_provider_of_unregister(struct framer_provider *framer_provider); 129 129 130 130 struct framer_provider * 131 131 __devm_framer_provider_of_register(struct device *dev, struct module *owner, 132 132 struct framer *(*of_xlate)(struct device *dev, 133 - struct of_phandle_args *args)); 133 + const struct of_phandle_args *args)); 134 134 135 135 void framer_notify_status_change(struct framer *framer); 136 136 ··· 154 154 } 155 155 156 156 static inline struct framer *framer_provider_simple_of_xlate(struct device *dev, 157 - struct of_phandle_args *args) 157 + const struct of_phandle_args *args) 158 158 { 159 159 return ERR_PTR(-ENOSYS); 160 160 } ··· 162 162 static inline struct framer_provider * 163 163 __framer_provider_of_register(struct device *dev, struct module *owner, 164 164 struct framer *(*of_xlate)(struct device *dev, 165 - struct of_phandle_args *args)) 165 + const struct of_phandle_args *args)) 166 166 { 167 167 return ERR_PTR(-ENOSYS); 168 168 } ··· 174 174 static inline struct framer_provider * 175 175 __devm_framer_provider_of_register(struct device *dev, struct module *owner, 176 176 struct framer *(*of_xlate)(struct device *dev, 177 - struct of_phandle_args *args)) 177 + const struct of_phandle_args *args)) 178 178 { 179 179 return ERR_PTR(-ENOSYS); 180 180 }