regulator: core: Constify the regulator_desc passed in when registering
authorMark Brown <broonie@opensource.wolfsonmicro.com>
Tue, 3 Apr 2012 19:46:53 +0000 (20:46 +0100)
committerMark Brown <broonie@opensource.wolfsonmicro.com>
Wed, 4 Apr 2012 10:43:26 +0000 (11:43 +0100)
Drivers should be able to declare their descriptors const and the framework
shouldn't ever be modifying the desciptor. Make the parameter and the
pointer in regulator_dev const to enforce this.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
drivers/regulator/core.c
include/linux/regulator/driver.h

index c056abd7562a29b91666083371d888a698b85eef..c4b626789f8eb84895ef5cb7d39aab4720b7f608 100644 (file)
@@ -2829,7 +2829,8 @@ static void rdev_init_debugfs(struct regulator_dev *rdev)
  * Called by regulator drivers to register a regulator.
  * Returns 0 on success.
  */
-struct regulator_dev *regulator_register(struct regulator_desc *regulator_desc,
+struct regulator_dev *
+regulator_register(const struct regulator_desc *regulator_desc,
        struct device *dev, const struct regulator_init_data *init_data,
        void *driver_data, struct device_node *of_node)
 {
index fa8b55b8191c980de60c32b5e1b3fe1d3016340f..1dcdf00e0db28e467b159b37f4e3fe247ea83c77 100644 (file)
@@ -184,7 +184,7 @@ struct regulator_desc {
  * no other direct access).
  */
 struct regulator_dev {
-       struct regulator_desc *desc;
+       const struct regulator_desc *desc;
        int exclusive;
        u32 use_count;
        u32 open_count;
@@ -210,7 +210,8 @@ struct regulator_dev {
        struct dentry *debugfs;
 };
 
-struct regulator_dev *regulator_register(struct regulator_desc *regulator_desc,
+struct regulator_dev *
+regulator_register(const struct regulator_desc *regulator_desc,
        struct device *dev, const struct regulator_init_data *init_data,
        void *driver_data, struct device_node *of_node);
 void regulator_unregister(struct regulator_dev *rdev);