diff options
author | Guodong Xu <guodong.xu@linaro.org> | 2013-01-28 13:03:15 +0800 |
---|---|---|
committer | Guodong Xu <guodong.xu@linaro.org> | 2013-02-21 16:12:36 +0800 |
commit | f2c2fceffb4ae361318ceb79cf851e4d9ca0e1ca (patch) | |
tree | 7caaf33d3ee48a9a9dcfd31e2b2981de4060a2cc | |
parent | 9e40b6373b27460f5372905dee685941ea0309be (diff) |
regulator: hi6421 compilation error fixed
-rw-r--r-- | drivers/regulator/hi6421-regulator.c | 36 |
1 files changed, 20 insertions, 16 deletions
diff --git a/drivers/regulator/hi6421-regulator.c b/drivers/regulator/hi6421-regulator.c index 5815d4c54a5d..ebd3a7b49dce 100644 --- a/drivers/regulator/hi6421-regulator.c +++ b/drivers/regulator/hi6421-regulator.c @@ -40,7 +40,7 @@ struct hi6421_regulator_register_info { u32 eco_mode_mask; u32 vset_reg; u32 vset_mask; -} +}; struct hi6421_regulator { const char *name; @@ -83,6 +83,7 @@ static int anatop_regmap_get_voltage_sel(struct regulator_dev *reg) } #endif +#if 0 static int hi6421_regulator_enable(struct regulator_dev *dev) { int ret = 0; @@ -94,7 +95,6 @@ static int hi6421_regulator_enable(struct regulator_dev *dev) rdev_info(dev, "will be enabled\n"); #endif - /* do_gettimeofday(&tv); diff = (tv.tv_sec - hi6421_regulator_data->lastoff_time[regulator_id].tv_sec) * USEC_PER_SEC + tv.tv_usec - hi6421_regulator_data->lastoff_time[regulator_id].tv_usec; @@ -122,12 +122,13 @@ static int hi6421_regulator_enable(struct regulator_dev *dev) return 0; } +#endif static int hi6421_dt_parse_common(struct hi6421_regulator *sreg, struct platform_device *pdev) { struct device *dev = &pdev->dev; struct device_node *np = dev->of_node; - struct regulator_desc *rdesc = sreg->rdesc; + struct regulator_desc *rdesc = &sreg->rdesc; unsigned int register_info[3]; int ret = 0; @@ -154,7 +155,7 @@ static int hi6421_dt_parse_common(struct hi6421_regulator *sreg, struct platform int i; printk("regulator: hi6421-register_info:\n"); for(i=0;i<5;i++){ - printk("regulator: reg_infor[%d]=%d\n", i, (u32 *)(&(sreg->register_info))[i]); + printk("regulator: reg_infor[%d]=%d\n", i, ((u32 *)&sreg->register_info)[i]); } } @@ -183,7 +184,8 @@ static int hi6421_dt_parse_ldo(struct hi6421_regulator *sreg, struct platform_de { struct device *dev = &pdev->dev; struct device_node *np = dev->of_node; - struct regulator_desc *rdesc = sreg->rdesc; + struct regulator_desc *rdesc = &sreg->rdesc; + unsigned int *v_table; int ret = 0; /* parse .n_voltages, and .volt_table */ @@ -195,23 +197,25 @@ static int hi6421_dt_parse_ldo(struct hi6421_regulator *sreg, struct platform_de } /* alloc space for .volt_table */ - rdesc->volt_table = devm_kzalloc(dev, sizeof(unsigned int) * rdesc->n_voltages, GFP_KERNEL); - if (unlikely(!rdesc->volt_table)) { + v_table = devm_kzalloc(dev, sizeof(unsigned int) * rdesc->n_voltages, GFP_KERNEL); + if (unlikely(!v_table)) { ret = -ENOMEM; dev_err(dev, "no memory for .volt_table\n"); goto dt_parse_ldo_end; } - ret = of_property_read_u32_array(np, "hisilicon,hi6421-vset-table", rdesc->volt_table, rdesc->n_voltages); + ret = of_property_read_u32_array(np, "hisilicon,hi6421-vset-table", v_table, rdesc->n_voltages); if (ret) { dev_err(dev, "no hisilicon,hi6421-vset-table property set\n"); goto dt_parse_ldo_end1; } + rdesc->volt_table = v_table; + /* debug info */ { int i; printk("regulator: hi6421-vset-table:\n"); - for(i=0;i<rdesc->volt_table;i++){ + for(i=0;i<rdesc->n_voltages;i++){ printk("regulator: hi6421 desc.volt_table[%d]=%d\n", i, rdesc->volt_table[i]); } } @@ -224,7 +228,7 @@ static int hi6421_dt_parse_ldo(struct hi6421_regulator *sreg, struct platform_de } dt_parse_ldo_end1: - devm_kfree(dev, rdesc->volt_table); + devm_kfree(dev, v_table); dt_parse_ldo_end: return ret; } @@ -233,7 +237,7 @@ static int hi6421_dt_parse_buck012(struct hi6421_regulator *sreg, struct platfor { struct device *dev = &pdev->dev; struct device_node *np = dev->of_node; - struct regulator_desc *rdesc = sreg->rdesc; + struct regulator_desc *rdesc = &sreg->rdesc; int ret = 0; /* parse .n_voltages, and .uV_step */ @@ -254,7 +258,7 @@ static int hi6421_dt_parse_buck012(struct hi6421_regulator *sreg, struct platfor ret = hi6421_dt_parse_common(sreg, pdev); if (ret) { dev_err(dev, "failure in hi6421_dt_parse_common\n"); - goto dt_parse_ldo_end1; + goto dt_parse_buck012_end; } dt_parse_buck012_end: @@ -354,7 +358,8 @@ static int hi6421_regulator_probe(struct platform_device *pdev) { struct device *dev = &pdev->dev; struct device_node *np = dev->of_node; - struct device_node *hi6421_np; +/* struct device_node *hi6421_np; + */ struct regulator_desc *rdesc; struct regulator_dev *rdev; struct hi6421_regulator *sreg = NULL; @@ -362,7 +367,6 @@ static int hi6421_regulator_probe(struct platform_device *pdev) struct regulator_config config = { }; const struct of_device_id *match; const struct hi6421_regulator *template; - unsigned int register_info[3]; int ret = 0; /* to check which type of regulator this is */ @@ -444,8 +448,8 @@ static int hi6421_regulator_remove(struct platform_device *pdev) regulator_unregister(rdev); /* TODO: should i worry about that? devm_kzalloc */ - if (sreg->rdesc->volt_table) - devm_kfree(pdev->dev, sreg->rdesc->volt_table); + if (sreg->rdesc.volt_table) + devm_kfree(&pdev->dev, (unsigned int *)sreg->rdesc.volt_table); kfree(sreg); return 0; |