net: wan: framer: constify of_phandle_args in xlate
authorKrzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Sat, 17 Feb 2024 10:03:06 +0000 (11:03 +0100)
committerJakub Kicinski <kuba@kernel.org>
Wed, 21 Feb 2024 02:28:54 +0000 (18:28 -0800)
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>
drivers/net/wan/framer/framer-core.c
include/linux/framer/framer-provider.h

index c04dc88bda6cd012ad92f8e7a61ff34e1e379bdd..33b358b99f70c0ce9ac7ae5046736217bd9ba981 100644 (file)
@@ -384,7 +384,7 @@ static struct framer_provider *framer_provider_of_lookup(const struct device_nod
        return ERR_PTR(-EPROBE_DEFER);
 }
 
-static struct framer *framer_of_get_from_provider(struct of_phandle_args *args)
+static struct framer *framer_of_get_from_provider(const struct of_phandle_args *args)
 {
        struct framer_provider *framer_provider;
        struct framer *framer;
@@ -735,7 +735,8 @@ EXPORT_SYMBOL_GPL(devm_framer_create);
  * should provide a custom of_xlate function that reads the *args* and returns
  * the appropriate framer.
  */
-struct framer *framer_provider_simple_of_xlate(struct device *dev, struct of_phandle_args *args)
+struct framer *framer_provider_simple_of_xlate(struct device *dev,
+                                              const struct of_phandle_args *args)
 {
        struct class_dev_iter iter;
        struct framer *framer;
@@ -768,7 +769,7 @@ EXPORT_SYMBOL_GPL(framer_provider_simple_of_xlate);
 struct framer_provider *
 __framer_provider_of_register(struct device *dev, struct module *owner,
                              struct framer *(*of_xlate)(struct device *dev,
-                                                        struct of_phandle_args *args))
+                                                        const struct of_phandle_args *args))
 {
        struct framer_provider *framer_provider;
 
@@ -830,7 +831,7 @@ static void devm_framer_provider_of_unregister(struct device *dev, void *res)
 struct framer_provider *
 __devm_framer_provider_of_register(struct device *dev, struct module *owner,
                                   struct framer *(*of_xlate)(struct device *dev,
-                                                             struct of_phandle_args *args))
+                                                             const struct of_phandle_args *args))
 {
        struct framer_provider **ptr, *framer_provider;
 
index 782cd5fc83d54210c1b1ebd3c7b3c3e93cac256b..f6fd2dd9259122d0d397151c5dd9617301700b69 100644 (file)
@@ -93,7 +93,7 @@ struct framer_provider {
        struct module           *owner;
        struct list_head        list;
        struct framer * (*of_xlate)(struct device *dev,
-                                   struct of_phandle_args *args);
+                                   const struct of_phandle_args *args);
 };
 
 static inline void framer_set_drvdata(struct framer *framer, void *data)
@@ -118,19 +118,19 @@ struct framer *devm_framer_create(struct device *dev, struct device_node *node,
                                  const struct framer_ops *ops);
 
 struct framer *framer_provider_simple_of_xlate(struct device *dev,
-                                              struct of_phandle_args *args);
+                                              const struct of_phandle_args *args);
 
 struct framer_provider *
 __framer_provider_of_register(struct device *dev, struct module *owner,
                              struct framer *(*of_xlate)(struct device *dev,
-                                                        struct of_phandle_args *args));
+                                                        const struct of_phandle_args *args));
 
 void framer_provider_of_unregister(struct framer_provider *framer_provider);
 
 struct framer_provider *
 __devm_framer_provider_of_register(struct device *dev, struct module *owner,
                                   struct framer *(*of_xlate)(struct device *dev,
-                                                             struct of_phandle_args *args));
+                                                             const struct of_phandle_args *args));
 
 void framer_notify_status_change(struct framer *framer);
 
@@ -154,7 +154,7 @@ static inline struct framer *devm_framer_create(struct device *dev, struct devic
 }
 
 static inline struct framer *framer_provider_simple_of_xlate(struct device *dev,
-                                                            struct of_phandle_args *args)
+                                                            const struct of_phandle_args *args)
 {
        return ERR_PTR(-ENOSYS);
 }
@@ -162,7 +162,7 @@ static inline struct framer *framer_provider_simple_of_xlate(struct device *dev,
 static inline struct framer_provider *
 __framer_provider_of_register(struct device *dev, struct module *owner,
                              struct framer *(*of_xlate)(struct device *dev,
-                                                        struct of_phandle_args *args))
+                                                        const struct of_phandle_args *args))
 {
        return ERR_PTR(-ENOSYS);
 }
@@ -174,7 +174,7 @@ void framer_provider_of_unregister(struct framer_provider *framer_provider)
 static inline struct framer_provider *
 __devm_framer_provider_of_register(struct device *dev, struct module *owner,
                                   struct framer *(*of_xlate)(struct device *dev,
-                                                             struct of_phandle_args *args))
+                                                             const struct of_phandle_args *args))
 {
        return ERR_PTR(-ENOSYS);
 }