lkml.org 
[lkml]   [2014]   [Mar]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Subject[PATCH 3/3] regulator: bcm590xx: Use array to save desc and *info
From
Date
BCM590XX_NUM_REGS is known in compile time.
Use array to save desc and *info makes the code simpler.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
---
drivers/regulator/bcm590xx-regulator.c | 18 ++----------------
1 file changed, 2 insertions(+), 16 deletions(-)

diff --git a/drivers/regulator/bcm590xx-regulator.c b/drivers/regulator/bcm590xx-regulator.c
index ab08ca7..fe21855 100644
--- a/drivers/regulator/bcm590xx-regulator.c
+++ b/drivers/regulator/bcm590xx-regulator.c
@@ -151,9 +151,9 @@ static struct bcm590xx_info bcm590xx_regs[] = {
};

struct bcm590xx_reg {
- struct regulator_desc *desc;
+ struct regulator_desc desc[BCM590XX_NUM_REGS];
struct bcm590xx *mfd;
- struct bcm590xx_info **info;
+ struct bcm590xx_info *info[BCM590XX_NUM_REGS];
};

static int bcm590xx_get_vsel_register(int id)
@@ -319,20 +319,6 @@ static int bcm590xx_probe(struct platform_device *pdev)

platform_set_drvdata(pdev, pmu);

- pmu->desc = devm_kzalloc(&pdev->dev, BCM590XX_NUM_REGS *
- sizeof(struct regulator_desc), GFP_KERNEL);
- if (!pmu->desc) {
- dev_err(&pdev->dev, "Memory alloc fails for desc\n");
- return -ENOMEM;
- }
-
- pmu->info = devm_kzalloc(&pdev->dev, BCM590XX_NUM_REGS *
- sizeof(struct bcm590xx_info *), GFP_KERNEL);
- if (!pmu->info) {
- dev_err(&pdev->dev, "Memory alloc fails for info\n");
- return -ENOMEM;
- }
-
info = bcm590xx_regs;

for (i = 0; i < BCM590XX_NUM_REGS; i++, info++) {
--
1.8.1.2




\
 
 \ /
  Last update: 2014-03-14 03:41    [W:0.380 / U:0.116 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site