From 65f26846b90611742f3b407cc538a1cad33abde8 Mon Sep 17 00:00:00 2001 From: Mark Brown Date: Tue, 3 Apr 2012 20:46:53 +0100 Subject: [PATCH 01/15] regulator: core: Constify the regulator_desc passed in when registering 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 --- drivers/regulator/core.c | 3 ++- include/linux/regulator/driver.h | 5 +++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c index c056abd7562a..c4b626789f8e 100644 --- a/drivers/regulator/core.c +++ b/drivers/regulator/core.c @@ -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) { diff --git a/include/linux/regulator/driver.h b/include/linux/regulator/driver.h index fa8b55b8191c..1dcdf00e0db2 100644 --- a/include/linux/regulator/driver.h +++ b/include/linux/regulator/driver.h @@ -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); From 47924b6ae1c7a7fafd5d110fb1af9923c2d5e216 Mon Sep 17 00:00:00 2001 From: Mark Brown Date: Tue, 3 Apr 2012 20:47:15 +0100 Subject: [PATCH 02/15] regulator: wm8350: Constify regulator_desc Signed-off-by: Mark Brown --- drivers/regulator/wm8350-regulator.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/regulator/wm8350-regulator.c b/drivers/regulator/wm8350-regulator.c index ab1e183a74b5..552b1edf8091 100644 --- a/drivers/regulator/wm8350-regulator.c +++ b/drivers/regulator/wm8350-regulator.c @@ -1269,7 +1269,7 @@ static struct regulator_ops wm8350_isink_ops = { .enable_time = wm8350_isink_enable_time, }; -static struct regulator_desc wm8350_reg[NUM_WM8350_REGULATORS] = { +static const struct regulator_desc wm8350_reg[NUM_WM8350_REGULATORS] = { { .name = "DCDC1", .id = WM8350_DCDC_1, From 25e4d602f74cb849aa8a4e4b4d0486dc22da872b Mon Sep 17 00:00:00 2001 From: Mark Brown Date: Tue, 3 Apr 2012 20:47:27 +0100 Subject: [PATCH 03/15] regulator: wm8994: Constify regulator_desc Signed-off-by: Mark Brown --- drivers/regulator/wm8994-regulator.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/regulator/wm8994-regulator.c b/drivers/regulator/wm8994-regulator.c index 75ed402d9f43..8a4897a35f28 100644 --- a/drivers/regulator/wm8994-regulator.c +++ b/drivers/regulator/wm8994-regulator.c @@ -209,7 +209,7 @@ static struct regulator_ops wm8994_ldo2_ops = { .set_voltage = wm8994_ldo2_set_voltage, }; -static struct regulator_desc wm8994_ldo_desc[] = { +static const struct regulator_desc wm8994_ldo_desc[] = { { .name = "LDO1", .id = 1, From 487f71e6f5038ef738de6291ff572717a507129c Mon Sep 17 00:00:00 2001 From: Axel Lin Date: Thu, 5 Apr 2012 11:56:56 +0800 Subject: [PATCH 04/15] regulator: ad5398: Constify regulator_desc Signed-off-by: Axel Lin Acked-by: Sonic Zhang Signed-off-by: Mark Brown --- drivers/regulator/ad5398.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/regulator/ad5398.c b/drivers/regulator/ad5398.c index 26d23adfc66f..1bd3e72b35cb 100644 --- a/drivers/regulator/ad5398.c +++ b/drivers/regulator/ad5398.c @@ -184,7 +184,7 @@ static struct regulator_ops ad5398_ops = { .is_enabled = ad5398_is_enabled, }; -static struct regulator_desc ad5398_reg = { +static const struct regulator_desc ad5398_reg = { .name = "isink", .id = 0, .ops = &ad5398_ops, From 2ac2d7d83025e8eac9a4985113930b52491dd4c5 Mon Sep 17 00:00:00 2001 From: Axel Lin Date: Thu, 5 Apr 2012 12:02:36 +0800 Subject: [PATCH 05/15] regulator: pcf50633: Constify regulator_desc Signed-off-by: Axel Lin Signed-off-by: Mark Brown --- drivers/regulator/pcf50633-regulator.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/regulator/pcf50633-regulator.c b/drivers/regulator/pcf50633-regulator.c index 6db46c632f13..0f8ffed3dd22 100644 --- a/drivers/regulator/pcf50633-regulator.c +++ b/drivers/regulator/pcf50633-regulator.c @@ -285,7 +285,7 @@ static struct regulator_ops pcf50633_regulator_ops = { .is_enabled = pcf50633_regulator_is_enabled, }; -static struct regulator_desc regulators[] = { +static const struct regulator_desc regulators[] = { [PCF50633_REGULATOR_AUTO] = PCF50633_REGULATOR("auto", PCF50633_REGULATOR_AUTO, 81), [PCF50633_REGULATOR_DOWN1] = From 4b65e159b94e37b40dfa1a5df77adb6fce932f6a Mon Sep 17 00:00:00 2001 From: Axel Lin Date: Thu, 5 Apr 2012 11:58:06 +0800 Subject: [PATCH 06/15] regulator: isl6271a: Constify regulator_desc Signed-off-by: Axel Lin Signed-off-by: Mark Brown --- drivers/regulator/isl6271a-regulator.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/regulator/isl6271a-regulator.c b/drivers/regulator/isl6271a-regulator.c index 775f5fd208c3..54c164df4707 100644 --- a/drivers/regulator/isl6271a-regulator.c +++ b/drivers/regulator/isl6271a-regulator.c @@ -112,7 +112,7 @@ static struct regulator_ops isl_fixed_ops = { .list_voltage = isl6271a_list_fixed_voltage, }; -static struct regulator_desc isl_rd[] = { +static const struct regulator_desc isl_rd[] = { { .name = "Core Buck", .id = 0, From 14add4ff2132a04843dfcb320c9f22c717c58328 Mon Sep 17 00:00:00 2001 From: Axel Lin Date: Thu, 5 Apr 2012 11:59:20 +0800 Subject: [PATCH 07/15] regulator: lp3971: Constify regulator_desc Signed-off-by: Axel Lin Signed-off-by: Mark Brown --- drivers/regulator/lp3971.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/regulator/lp3971.c b/drivers/regulator/lp3971.c index 0cfabd318a59..3e0d001b599e 100644 --- a/drivers/regulator/lp3971.c +++ b/drivers/regulator/lp3971.c @@ -309,7 +309,7 @@ static struct regulator_ops lp3971_dcdc_ops = { .set_voltage = lp3971_dcdc_set_voltage, }; -static struct regulator_desc regulators[] = { +static const struct regulator_desc regulators[] = { { .name = "LDO1", .id = LP3971_LDO1, From 1bdcf11052bb075a3b2a53b39841601e36f0e86b Mon Sep 17 00:00:00 2001 From: Axel Lin Date: Thu, 5 Apr 2012 12:00:32 +0800 Subject: [PATCH 08/15] regulator: lp3972: Constify regulator_desc Signed-off-by: Axel Lin Signed-off-by: Mark Brown --- drivers/regulator/lp3972.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/regulator/lp3972.c b/drivers/regulator/lp3972.c index 49a15eefe5fe..2e48621ef8b6 100644 --- a/drivers/regulator/lp3972.c +++ b/drivers/regulator/lp3972.c @@ -471,7 +471,7 @@ static struct regulator_ops lp3972_dcdc_ops = { .set_voltage = lp3972_dcdc_set_voltage, }; -static struct regulator_desc regulators[] = { +static const struct regulator_desc regulators[] = { { .name = "LDO1", .id = LP3972_LDO1, From 0d2fbc519e5c2e30a4d2d225a3fd795303ba7caa Mon Sep 17 00:00:00 2001 From: Axel Lin Date: Thu, 5 Apr 2012 12:01:33 +0800 Subject: [PATCH 09/15] regulator: pcap: Constify regulator_desc Signed-off-by: Axel Lin Signed-off-by: Mark Brown --- drivers/regulator/pcap-regulator.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/regulator/pcap-regulator.c b/drivers/regulator/pcap-regulator.c index a5aab1b08bcf..c434e5f5f8a2 100644 --- a/drivers/regulator/pcap-regulator.c +++ b/drivers/regulator/pcap-regulator.c @@ -265,7 +265,7 @@ static struct regulator_ops pcap_regulator_ops = { .owner = THIS_MODULE, \ } -static struct regulator_desc pcap_regulators[] = { +static const struct regulator_desc pcap_regulators[] = { VREG(V1), VREG(V2), VREG(V3), VREG(V4), VREG(V5), VREG(V6), VREG(V7), VREG(V8), VREG(V9), VREG(V10), VREG(VAUX1), VREG(VAUX2), VREG(VAUX3), VREG(VAUX4), VREG(VSIM), VREG(VSIM2), VREG(VVIB), VREG(SW1), VREG(SW2), From 621adb30ace17799f24d17b1df1aa0f69081f71b Mon Sep 17 00:00:00 2001 From: Axel Lin Date: Fri, 6 Apr 2012 08:26:59 +0800 Subject: [PATCH 10/15] regulator: max8660: Constify regulator_desc Signed-off-by: Axel Lin Signed-off-by: Mark Brown --- drivers/regulator/max8660.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/regulator/max8660.c b/drivers/regulator/max8660.c index 4c5b05311f47..880bd56a2a92 100644 --- a/drivers/regulator/max8660.c +++ b/drivers/regulator/max8660.c @@ -313,7 +313,7 @@ static struct regulator_ops max8660_ldo67_ops = { .set_voltage = max8660_ldo67_set, }; -static struct regulator_desc max8660_reg[] = { +static const struct regulator_desc max8660_reg[] = { { .name = "V3(DCDC)", .id = MAX8660_V3, From bd6ff0d6a0c8a5bb3ef2e349b225875bb05221c9 Mon Sep 17 00:00:00 2001 From: Axel Lin Date: Fri, 6 Apr 2012 08:29:49 +0800 Subject: [PATCH 11/15] regulator: max8952: Constify regulator_desc Signed-off-by: Axel Lin Signed-off-by: Mark Brown --- drivers/regulator/max8952.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/regulator/max8952.c b/drivers/regulator/max8952.c index 75d89400c123..d50000e60ef0 100644 --- a/drivers/regulator/max8952.c +++ b/drivers/regulator/max8952.c @@ -173,7 +173,7 @@ static struct regulator_ops max8952_ops = { .set_suspend_disable = max8952_disable, }; -static struct regulator_desc regulator = { +static const struct regulator_desc regulator = { .name = "MAX8952_VOUT", .id = 0, .n_voltages = MAX8952_NUM_DVS_MODE, From d882d73eb72d7e5d57645c8d40195f4a7ad76f6c Mon Sep 17 00:00:00 2001 From: Axel Lin Date: Fri, 6 Apr 2012 08:30:42 +0800 Subject: [PATCH 12/15] regulator: tps6105x: Constify regulator_desc Signed-off-by: Axel Lin Signed-off-by: Mark Brown --- drivers/regulator/tps6105x-regulator.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/regulator/tps6105x-regulator.c b/drivers/regulator/tps6105x-regulator.c index d9278da18a9e..3b788977cb72 100644 --- a/drivers/regulator/tps6105x-regulator.c +++ b/drivers/regulator/tps6105x-regulator.c @@ -123,7 +123,7 @@ static struct regulator_ops tps6105x_regulator_ops = { .list_voltage = tps6105x_regulator_list_voltage, }; -static struct regulator_desc tps6105x_regulator_desc = { +static const struct regulator_desc tps6105x_regulator_desc = { .name = "tps6105x-boost", .ops = &tps6105x_regulator_ops, .type = REGULATOR_VOLTAGE, From 78637a3d8c871c4e27e86d9753e19868e2d9e6a8 Mon Sep 17 00:00:00 2001 From: Axel Lin Date: Fri, 6 Apr 2012 08:31:51 +0800 Subject: [PATCH 13/15] regulator: tps65217: Constify regulator_desc Signed-off-by: Axel Lin Acked-by: AnilKumar Ch Signed-off-by: Mark Brown --- drivers/regulator/tps65217-regulator.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/regulator/tps65217-regulator.c b/drivers/regulator/tps65217-regulator.c index e39521b42772..80fad2d3479e 100644 --- a/drivers/regulator/tps65217-regulator.c +++ b/drivers/regulator/tps65217-regulator.c @@ -312,7 +312,7 @@ static struct regulator_ops tps65217_pmic_ldo1_ops = { .list_voltage = tps65217_pmic_list_voltage, }; -static struct regulator_desc regulators[] = { +static const struct regulator_desc regulators[] = { TPS65217_REGULATOR("DCDC1", TPS65217_DCDC_1, tps65217_pmic_ops, 64), TPS65217_REGULATOR("DCDC2", TPS65217_DCDC_2, tps65217_pmic_ops, 64), TPS65217_REGULATOR("DCDC3", TPS65217_DCDC_3, tps65217_pmic_ops, 64), From 0373bcff46c444d71bbff424d1060b550bab28ec Mon Sep 17 00:00:00 2001 From: Axel Lin Date: Fri, 6 Apr 2012 08:24:27 +0800 Subject: [PATCH 14/15] regulator: max1586: Constify regulator_desc Signed-off-by: Axel Lin Signed-off-by: Mark Brown --- drivers/regulator/max1586.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/regulator/max1586.c b/drivers/regulator/max1586.c index 282d2ee0604e..fad0bee10c54 100644 --- a/drivers/regulator/max1586.c +++ b/drivers/regulator/max1586.c @@ -161,7 +161,7 @@ static struct regulator_ops max1586_v6_ops = { .list_voltage = max1586_v6_list, }; -static struct regulator_desc max1586_reg[] = { +static const struct regulator_desc max1586_reg[] = { { .name = "Output_V3", .id = MAX1586_V3, From 09de3473c7724d7a1db7596acc2ce411e5e72f63 Mon Sep 17 00:00:00 2001 From: Axel Lin Date: Fri, 6 Apr 2012 08:26:06 +0800 Subject: [PATCH 15/15] regulator: max8649: Constify regulator_desc Signed-off-by: Axel Lin Signed-off-by: Mark Brown --- drivers/regulator/max8649.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/regulator/max8649.c b/drivers/regulator/max8649.c index 824c650436ed..aa91ec60fa08 100644 --- a/drivers/regulator/max8649.c +++ b/drivers/regulator/max8649.c @@ -207,7 +207,7 @@ static struct regulator_ops max8649_dcdc_ops = { }; -static struct regulator_desc dcdc_desc = { +static const struct regulator_desc dcdc_desc = { .name = "max8649", .ops = &max8649_dcdc_ops, .type = REGULATOR_VOLTAGE,