regulator: bcm590xx: Make the modalias matches the driver name
PATCH 1/3 regulator: bcm590xx: Make the modalias matches the driver name
--- drivers/regulator/bcm590xx-regulator.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/regulator/bcm590xx-regulator.c +1 -1
@@ -410,4 +410,4 @@ module_platform_driver(bcm590xx_regulator_driver);MODULE_AUTHOR ("Matt Porter <[email protected]>" );MODULE_DESCRIPTION ("BCM590xx voltage regulator driver" );MODULE_LICENSE ("GPL v2" ); -MODULE_ALIAS ("platform:bcm590xx-regulator" ); +MODULE_ALIAS ("platform:bcm590xx-vregs" );
Signature · 1 line
1.8.1.2
PATCH 2/3 regulator: bcm590xx: Remove **rdev from struct bcm590xx_reg
The **rdev of 'struct bcm590xx_reg' isn't used anywhere in the driver so remove it.
--- drivers/regulator/bcm590xx-regulator.c | 10 ---------- 1 file changed, 10 deletions(-)
drivers/regulator/bcm590xx-regulator.c +0 -10
@@ -153,7 +153,6 @@ static struct bcm590xx_info bcm590xx_regs[] = {struct bcm590xx_reg {struct regulator_desc *desc;struct bcm590xx *mfd; -struct regulator_dev **rdev;struct bcm590xx_info **info; };
@@ -334,13 +333,6 @@ static int bcm590xx_probe(struct platform_device *pdev)return -ENOMEM ; } - pmu->rdev =devm_kzalloc (&pdev->dev,BCM590XX_NUM_REGS * -sizeof (struct regulator_dev *),GFP_KERNEL ); -if (!pmu->rdev) { -dev_err (&pdev->dev,"Memory alloc fails for rdev\n" ); -return -ENOMEM ; - } - info = bcm590xx_regs;for (i =0 ; i <BCM590XX_NUM_REGS ; i++, info++) {
@@ -391,8 +383,6 @@ static int bcm590xx_probe(struct platform_device *pdev) pdev->name);return PTR_ERR (rdev); } - - pmu->rdev[i] = rdev; }return 0 ;
Signature · 1 line
1.8.1.2
Re: [PATCH 2/3] regulator: bcm590xx: Remove **rdev from struct bcm590xx_reg
Quoted 7 lines · Axel Lin
The **rdev of 'struct
bcm590xx_reg' isn't used anywhere in the driver so remove it.Signed-off-by Axel Lin <[email protected]>--- drivers/regulator/bcm590xx-regulator.c | 10 ---------- 1 file changed, 10 deletions(-)
Looks good, thanks for catching this.
Quoted 41 lines
drivers/regulator/bcm590xx-regulator.c +0
-10@@ -153,7 +153,6 @@ static struct bcm590xx_info bcm590xx_regs[] = {struct bcm590xx_reg {struct regulator_desc *desc;struct bcm590xx *mfd; -struct regulator_dev **rdev;struct bcm590xx_info **info; };@@ -334,13 +333,6 @@ static int bcm590xx_probe(struct platform_device *pdev)return -ENOMEM ; } - pmu->rdev =devm_kzalloc (&pdev->dev,BCM590XX_NUM_REGS * -sizeof (struct regulator_dev *),GFP_KERNEL ); -if (!pmu->rdev) { -dev_err (&pdev->dev,"Memory alloc fails for rdev\n" ); -return -ENOMEM ; - } - info = bcm590xx_regs;for (i =0 ; i <BCM590XX_NUM_REGS ; i++, info++) {@@ -391,8 +383,6 @@ static int bcm590xx_probe(struct platform_device *pdev) pdev->name);return PTR_ERR (rdev); } - - pmu->rdev[i] = rdev; }return 0 ;Signature · 1 line
1.8.1.2
Re: [PATCH 2/3] regulator: bcm590xx: Remove **rdev from struct bcm590xx_reg
In reply to Axel LinQuoted 2 lines · Axel Lin
The **rdev of 'struct
bcm590xx_reg' isn't used anywhere in the driver so remove it.
Applied, thanks.
PATCH 3/3 regulator: bcm590xx: Use array to save desc and *info
In reply to Axel LinBCM590XX_NUM_REGS is known in compile time.
Use array to save desc and *info makes the code simpler.
--- drivers/regulator/bcm590xx-regulator.c | 18 ++---------------- 1 file changed, 2 insertions(+), 16 deletions(-)
drivers/regulator/bcm590xx-regulator.c +2 -16
@@ -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++) {
Signature · 1 line
1.8.1.2
Re: [PATCH 3/3] regulator: bcm590xx: Use array to save desc and *info
Quoted 4 lines · Axel Lin
BCM590XX_NUM_REGSis known in compile time.
Use array to save desc and *info makes the code simpler.Signed-off-by Axel Lin <[email protected]>
Well, ok. It was coded for dynamic allocation because I'm starting to work on BCM59054 support, which is similar but different. The actual regulators are different but, due to luck, the total number is the same between 59056 and 59054...so this can still work for the moment. However, another 590xx part does have a different number of regulators so I'm not sure this is worth doing when we know we'll go back to dynamic allocation in the future.
-Matt
Quoted 46 lines
--- drivers/regulator/bcm590xx-regulator.c | 18 ++---------------- 1 file changed, 2 insertions(+), 16 deletions(-)drivers/regulator/bcm590xx-regulator.c +2
-16@@ -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++) {Signature · 1 line
1.8.1.2
Re: [PATCH 3/3] regulator: bcm590xx: Use array to save desc and *info
2014-03-20 23:42 GMT+08:00 Matt Porter <[email protected]>:
Quoted 6 lines · Axel Lin
Quoted 4 lines
BCM590XX_NUM_REGSis known in compile time.
Use array to save desc and *info makes the code simpler.Signed-off-by Axel Lin <[email protected]>
Quoted 7 lines
Well, ok. It was coded for dynamic allocation because I'm starting to work on BCM59054 support, which is similar but different. The actual regulators are different but, due to luck, the total number is the same between 59056 and 59054...so this can still work for the moment. However, another 590xx part does have a different number of regulators so I'm not sure this is worth doing when we know we'll go back to dynamic allocation in the future.
Then it' ok to keep the code as is, just drop this patch.
Regards,
Axel
Quoted 1 line · Axel Lin
Signed-off-by Axel Lin <[email protected]>
Applied, thanks.