regulator: max77663: convert regulator init data to pointer
Laxman Dewangan [Fri, 24 Aug 2012 11:55:31 +0000 (16:55 +0530)]
The platform data for max77663 regulator have the member for
regulator init data.  Convert this to pointer type to easing
the dt support for regulator.

Change-Id: I7ce715c5afc4046f85fd86e7e6efb27ec0e7e9e7
Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Reviewed-on: http://git-master/r/127158
Reviewed-by: Automatic_Commit_Validation_User

arch/arm/mach-tegra/board-cardhu-pm298-power-rails.c
arch/arm/mach-tegra/board-curacao-power.c
arch/arm/mach-tegra/board-dalmore-power.c
arch/arm/mach-tegra/board-kai-power.c
drivers/regulator/max77663-regulator.c
include/linux/regulator/max77663-regulator.h

index bdc211a..f57d0de 100644 (file)
@@ -166,27 +166,28 @@ static struct max77663_regulator_fps_cfg max77663_fps_cfgs[] = {
                            _always_on, _boot_on, _apply_uV,            \
                            _init_apply, _init_enable, _init_uV,        \
                            _fps_src, _fps_pu_period, _fps_pd_period, _flags) \
+       static struct regulator_init_data max77663_regulator_idata_##_id = {  \
+               .supply_regulator = _supply_reg,                        \
+               .constraints = {                                        \
+                       .name = max77663_rails(_id),                    \
+                       .min_uV = _min_uV,                              \
+                       .max_uV = _max_uV,                              \
+                       .valid_modes_mask = (REGULATOR_MODE_NORMAL |    \
+                                            REGULATOR_MODE_STANDBY),   \
+                       .valid_ops_mask = (REGULATOR_CHANGE_MODE |      \
+                                          REGULATOR_CHANGE_STATUS |    \
+                                          REGULATOR_CHANGE_VOLTAGE),   \
+                       .always_on = _always_on,                        \
+                       .boot_on = _boot_on,                            \
+                       .apply_uV = _apply_uV,                          \
+               },                                                      \
+               .num_consumer_supplies =                                \
+                               ARRAY_SIZE(max77663_##_id##_supply),    \
+               .consumer_supplies = max77663_##_id##_supply,           \
+       };                                                              \
        static struct max77663_regulator_platform_data max77663_regulator_pdata_##_id = \
        {                                                               \
-               .init_data = {                                          \
-                       .constraints = {                                \
-                               .name = max77663_rails(_id),            \
-                               .min_uV = _min_uV,                      \
-                               .max_uV = _max_uV,                      \
-                               .valid_modes_mask = (REGULATOR_MODE_NORMAL |  \
-                                                    REGULATOR_MODE_STANDBY), \
-                               .valid_ops_mask = (REGULATOR_CHANGE_MODE |    \
-                                                  REGULATOR_CHANGE_STATUS |  \
-                                                  REGULATOR_CHANGE_VOLTAGE), \
-                               .always_on = _always_on,                \
-                               .boot_on = _boot_on,                    \
-                               .apply_uV = _apply_uV,                  \
-                       },                                              \
-                       .num_consumer_supplies =                        \
-                               ARRAY_SIZE(max77663_##_id##_supply),    \
-                       .consumer_supplies = max77663_##_id##_supply,   \
-                       .supply_regulator = _supply_reg,                \
-               },                                                      \
+               .reg_init_data = &max77663_regulator_idata_##_id,       \
                .init_apply = _init_apply,                              \
                .init_enable = _init_enable,                            \
                .init_uV = _init_uV,                                    \
index 15b918d..d6e6256 100644 (file)
@@ -117,27 +117,28 @@ static struct max77663_regulator_fps_cfg max77663_fps_cfgs[] = {
                _always_on, _boot_on, _apply_uV,                        \
                _init_apply, _init_enable, _init_uV,                    \
                _fps_src, _fps_pu_period, _fps_pd_period, _flags)       \
-       static struct max77663_regulator_platform_data max77663_regulator_pdata_##_id = \
-{                                                              \
-       .init_data = {                                          \
-                       .constraints = {                                \
-                               .name = max77663_rails(_id),            \
-                               .min_uV = _min_uV,                      \
-                               .max_uV = _max_uV,                      \
-                               .valid_modes_mask = (REGULATOR_MODE_NORMAL |  \
-                                                    REGULATOR_MODE_STANDBY), \
-                               .valid_ops_mask = (REGULATOR_CHANGE_MODE |    \
-                                                  REGULATOR_CHANGE_STATUS |  \
-                                                  REGULATOR_CHANGE_VOLTAGE), \
-                               .always_on = _always_on,                \
-                               .boot_on = _boot_on,                    \
-                               .apply_uV = _apply_uV,                  \
-                       },                                              \
-                       .num_consumer_supplies =                        \
-                               ARRAY_SIZE(max77663_##_id##_supply),    \
-                       .consumer_supplies = max77663_##_id##_supply,   \
-                       .supply_regulator = _supply_reg,                \
+       static struct regulator_init_data max77663_regulator_idata_##_id = {  \
+               .supply_regulator = _supply_reg,                        \
+               .constraints = {                                        \
+                       .name = max77663_rails(_id),                    \
+                       .min_uV = _min_uV,                              \
+                       .max_uV = _max_uV,                              \
+                       .valid_modes_mask = (REGULATOR_MODE_NORMAL |    \
+                                            REGULATOR_MODE_STANDBY),   \
+                       .valid_ops_mask = (REGULATOR_CHANGE_MODE |      \
+                                          REGULATOR_CHANGE_STATUS |    \
+                                          REGULATOR_CHANGE_VOLTAGE),   \
+                       .always_on = _always_on,                        \
+                       .boot_on = _boot_on,                            \
+                       .apply_uV = _apply_uV,                          \
                },                                                      \
+               .num_consumer_supplies =                                \
+                       ARRAY_SIZE(max77663_##_id##_supply),            \
+               .consumer_supplies = max77663_##_id##_supply,           \
+       };                                                              \
+       static struct max77663_regulator_platform_data max77663_regulator_pdata_##_id = \
+       {                                                               \
+               .reg_init_data = &max77663_regulator_idata_##_id,       \
                .init_apply = _init_apply,                              \
                .init_enable = _init_enable,                            \
                .init_uV = _init_uV,                                    \
index 699148a..c233a1c 100644 (file)
@@ -133,27 +133,28 @@ static struct max77663_regulator_fps_cfg max77663_fps_cfgs[] = {
                _always_on, _boot_on, _apply_uV,                        \
                _init_apply, _init_enable, _init_uV,                    \
                _fps_src, _fps_pu_period, _fps_pd_period, _flags)       \
+       static struct regulator_init_data max77663_regulator_idata_##_id = {   \
+               .supply_regulator = _supply_reg,                        \
+               .constraints = {                                        \
+                       .name = max77663_rails(_id),                    \
+                       .min_uV = _min_uV,                              \
+                       .max_uV = _max_uV,                              \
+                       .valid_modes_mask = (REGULATOR_MODE_NORMAL |    \
+                                            REGULATOR_MODE_STANDBY),   \
+                       .valid_ops_mask = (REGULATOR_CHANGE_MODE |      \
+                                          REGULATOR_CHANGE_STATUS |    \
+                                          REGULATOR_CHANGE_VOLTAGE),   \
+                       .always_on = _always_on,                        \
+                       .boot_on = _boot_on,                            \
+                       .apply_uV = _apply_uV,                          \
+               },                                                      \
+               .num_consumer_supplies =                                \
+                       ARRAY_SIZE(max77663_##_id##_supply),            \
+               .consumer_supplies = max77663_##_id##_supply,           \
+       };                                                              \
 static struct max77663_regulator_platform_data max77663_regulator_pdata_##_id =\
 {                                                                      \
-       .init_data = {                                                  \
-                       .constraints = {                                \
-                               .name = max77663_rails(_id),            \
-                               .min_uV = _min_uV,                      \
-                               .max_uV = _max_uV,                      \
-                               .valid_modes_mask = (REGULATOR_MODE_NORMAL |  \
-                                                    REGULATOR_MODE_STANDBY), \
-                               .valid_ops_mask = (REGULATOR_CHANGE_MODE |    \
-                                                  REGULATOR_CHANGE_STATUS |  \
-                                                  REGULATOR_CHANGE_VOLTAGE), \
-                               .always_on = _always_on,                \
-                               .boot_on = _boot_on,                    \
-                               .apply_uV = _apply_uV,                  \
-                       },                                              \
-                       .num_consumer_supplies =                        \
-                               ARRAY_SIZE(max77663_##_id##_supply),    \
-                       .consumer_supplies = max77663_##_id##_supply,   \
-                       .supply_regulator = _supply_reg,                \
-               },                                                      \
+               .reg_init_data = &max77663_regulator_idata_##_id,       \
                .init_apply = _init_apply,                              \
                .init_enable = _init_enable,                            \
                .init_uV = _init_uV,                                    \
index 3dae49a..da0310f 100644 (file)
@@ -146,27 +146,28 @@ static struct max77663_regulator_fps_cfg max77663_fps_cfgs[] = {
                            _always_on, _boot_on, _apply_uV,            \
                            _init_apply, _init_enable, _init_uV,        \
                            _fps_src, _fps_pu_period, _fps_pd_period, _flags) \
+       static struct regulator_init_data max77663_regulator_idata_##_id = {  \
+               .supply_regulator = _supply_reg,                        \
+               .constraints = {                                        \
+                       .name = max77663_rails(_id),                    \
+                       .min_uV = _min_uV,                              \
+                       .max_uV = _max_uV,                              \
+                       .valid_modes_mask = (REGULATOR_MODE_NORMAL |    \
+                                            REGULATOR_MODE_STANDBY),   \
+                       .valid_ops_mask = (REGULATOR_CHANGE_MODE |      \
+                                          REGULATOR_CHANGE_STATUS |    \
+                                          REGULATOR_CHANGE_VOLTAGE),   \
+                       .always_on = _always_on,                        \
+                       .boot_on = _boot_on,                            \
+                       .apply_uV = _apply_uV,                          \
+               },                                                      \
+               .num_consumer_supplies =                                \
+                               ARRAY_SIZE(max77663_##_id##_supply),    \
+               .consumer_supplies = max77663_##_id##_supply,           \
+       };                                                              \
        static struct max77663_regulator_platform_data max77663_regulator_pdata_##_id = \
        {                                                               \
-               .init_data = {                                          \
-                       .constraints = {                                \
-                               .name = max77663_rails(_id),            \
-                               .min_uV = _min_uV,                      \
-                               .max_uV = _max_uV,                      \
-                               .valid_modes_mask = (REGULATOR_MODE_NORMAL |  \
-                                                    REGULATOR_MODE_STANDBY), \
-                               .valid_ops_mask = (REGULATOR_CHANGE_MODE |    \
-                                                  REGULATOR_CHANGE_STATUS |  \
-                                                  REGULATOR_CHANGE_VOLTAGE), \
-                               .always_on = _always_on,                \
-                               .boot_on = _boot_on,                    \
-                               .apply_uV = _apply_uV,                  \
-                       },                                              \
-                       .num_consumer_supplies =                        \
-                               ARRAY_SIZE(max77663_##_id##_supply),    \
-                       .consumer_supplies = max77663_##_id##_supply,   \
-                       .supply_regulator = _supply_reg,                \
-               },                                                      \
+               .reg_init_data = &max77663_regulator_idata_##_id,       \
                .init_apply = _init_apply,                              \
                .init_enable = _init_enable,                            \
                .init_uV = _init_uV,                                    \
index ef25f92..bee2596 100644 (file)
@@ -882,7 +882,7 @@ static int max77663_regulator_probe(struct platform_device *pdev)
        }
 
        reg->rdev = regulator_register(rdesc, &pdev->dev,
-                                      &reg->pdata->init_data, reg, NULL);
+                                      reg->pdata->reg_init_data, reg, NULL);
        if (IS_ERR(reg->rdev)) {
                dev_err(&pdev->dev, "probe: Failed to register regulator %s\n",
                        rdesc->name);
index d8ab389..7cf4a53 100644 (file)
@@ -114,7 +114,7 @@ struct max77663_regulator_fps_cfg {
 };
 
 struct max77663_regulator_platform_data {
-       struct regulator_init_data init_data;
+       struct regulator_init_data *reg_init_data;
        bool init_apply;
        bool init_enable;
        int init_uV;