[patch dpll-rfc 1/7] dpll: make ops function args const

Jiri Pirko jiri at resnulli.us
Sun Mar 26 10:00:46 PDT 2023


From: Jiri Pirko <jiri at nvidia.com>

Make ops args passed over *_register() functions const.

Signed-off-by: Jiri Pirko <jiri at nvidia.com>
---
 drivers/dpll/dpll_core.c | 25 ++++++++++++-------------
 include/linux/dpll.h     |  9 +++++----
 2 files changed, 17 insertions(+), 17 deletions(-)

diff --git a/drivers/dpll/dpll_core.c b/drivers/dpll/dpll_core.c
index d478ab5e2001..7f8442b73fd8 100644
--- a/drivers/dpll/dpll_core.c
+++ b/drivers/dpll/dpll_core.c
@@ -89,7 +89,7 @@ dpll_device_get_by_name(const char *bus_name, const char *device_name)
  */
 static int
 dpll_xa_ref_pin_add(struct xarray *xa_pins, struct dpll_pin *pin,
-		    struct dpll_pin_ops *ops, void *priv)
+		    const struct dpll_pin_ops *ops, void *priv)
 {
 	struct dpll_pin_ref *ref;
 	unsigned long i;
@@ -189,7 +189,7 @@ dpll_xa_ref_pin_find(struct xarray *xa_pins, const struct dpll_pin *pin)
  */
 static int
 dpll_xa_ref_dpll_add(struct xarray *xa_dplls, struct dpll_device *dpll,
-		     struct dpll_pin_ops *ops, void *priv)
+		     const struct dpll_pin_ops *ops, void *priv)
 {
 	struct dpll_pin_ref *ref;
 	unsigned long i;
@@ -385,8 +385,9 @@ EXPORT_SYMBOL_GPL(dpll_device_put);
  * * 0 on success
  * * -EINVAL on failure
  */
-int dpll_device_register(struct dpll_device *dpll, struct dpll_device_ops *ops,
-			 void *priv, struct device *owner)
+int dpll_device_register(struct dpll_device *dpll,
+			 const struct dpll_device_ops *ops, void *priv,
+			 struct device *owner)
 {
 	if (WARN_ON(!ops || !owner))
 		return -EINVAL;
@@ -551,7 +552,7 @@ EXPORT_SYMBOL_GPL(dpll_pin_put);
 
 static int
 __dpll_pin_register(struct dpll_device *dpll, struct dpll_pin *pin,
-		    struct dpll_pin_ops *ops, void *priv,
+		    const struct dpll_pin_ops *ops, void *priv,
 		    const char *rclk_device_name)
 {
 	int ret;
@@ -592,10 +593,9 @@ __dpll_pin_register(struct dpll_device *dpll, struct dpll_pin *pin,
  * * -EINVAL - missing dpll or pin
  * * -ENOMEM - failed to allocate memory
  */
-int
-dpll_pin_register(struct dpll_device *dpll, struct dpll_pin *pin,
-		  struct dpll_pin_ops *ops, void *priv,
-		  struct device *rclk_device)
+int dpll_pin_register(struct dpll_device *dpll, struct dpll_pin *pin,
+		      const struct dpll_pin_ops *ops, void *priv,
+		      struct device *rclk_device)
 {
 	const char *rclk_name = rclk_device ? dev_name(rclk_device) : NULL;
 	int ret;
@@ -661,10 +661,9 @@ EXPORT_SYMBOL_GPL(dpll_pin_unregister);
  * * -ENOMEM failed allocation
  * * -EPERM if parent is not allowed
  */
-int
-dpll_pin_on_pin_register(struct dpll_pin *parent, struct dpll_pin *pin,
-			 struct dpll_pin_ops *ops, void *priv,
-			 struct device *rclk_device)
+int dpll_pin_on_pin_register(struct dpll_pin *parent, struct dpll_pin *pin,
+			     const struct dpll_pin_ops *ops, void *priv,
+			     struct device *rclk_device)
 {
 	struct dpll_pin_ref *ref;
 	unsigned long i, stop;
diff --git a/include/linux/dpll.h b/include/linux/dpll.h
index 2e516d91c343..496358df83a9 100644
--- a/include/linux/dpll.h
+++ b/include/linux/dpll.h
@@ -123,8 +123,9 @@ void dpll_device_put(struct dpll_device *dpll);
  * @owner: device struct of the owner
  *
  */
-int dpll_device_register(struct dpll_device *dpll, struct dpll_device_ops *ops,
-			 void *priv, struct device *owner);
+int dpll_device_register(struct dpll_device *dpll,
+			 const struct dpll_device_ops *ops, void *priv,
+			 struct device *owner);
 
 /**
  * dpll_device_unregister - deregister registered dpll
@@ -200,7 +201,7 @@ struct dpll_pin
  * * -EBUSY - couldn't allocate id for a pin.
  */
 int dpll_pin_register(struct dpll_device *dpll, struct dpll_pin *pin,
-		      struct dpll_pin_ops *ops, void *priv,
+		      const struct dpll_pin_ops *ops, void *priv,
 		      struct device *rclk_device);
 
 /**
@@ -244,7 +245,7 @@ void dpll_pin_put(struct dpll_pin *pin);
  * * -EEXIST - pin already registered with this parent pin,
  */
 int dpll_pin_on_pin_register(struct dpll_pin *parent, struct dpll_pin *pin,
-			     struct dpll_pin_ops *ops, void *priv,
+			     const struct dpll_pin_ops *ops, void *priv,
 			     struct device *rclk_device);
 
 /**
-- 
2.39.0




More information about the linux-arm-kernel mailing list