linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/3] regulator: bcm590xx: Make the modalias matches the driver name
@ 2014-03-14  1:57 Axel Lin
  2014-03-14  1:59 ` [PATCH 2/3] regulator: bcm590xx: Remove **rdev from struct bcm590xx_reg Axel Lin
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Axel Lin @ 2014-03-14  1:57 UTC (permalink / raw)
  To: Mark Brown
  Cc: Matt Porter, Tim Kryger, Markus Mayer, Liam Girdwood,
	linux-kernel

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

diff --git a/drivers/regulator/bcm590xx-regulator.c b/drivers/regulator/bcm590xx-regulator.c
index e6b2e8e..d12d6d6 100644
--- a/drivers/regulator/bcm590xx-regulator.c
+++ b/drivers/regulator/bcm590xx-regulator.c
@@ -410,4 +410,4 @@ module_platform_driver(bcm590xx_regulator_driver);
 MODULE_AUTHOR("Matt Porter <mporter@linaro.org>");
 MODULE_DESCRIPTION("BCM590xx voltage regulator driver");
 MODULE_LICENSE("GPL v2");
-MODULE_ALIAS("platform:bcm590xx-regulator");
+MODULE_ALIAS("platform:bcm590xx-vregs");
-- 
1.8.1.2




^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 2/3] regulator: bcm590xx: Remove **rdev from struct bcm590xx_reg
  2014-03-14  1:57 [PATCH 1/3] regulator: bcm590xx: Make the modalias matches the driver name Axel Lin
@ 2014-03-14  1:59 ` Axel Lin
  2014-03-20 15:21   ` Matt Porter
  2014-03-21 18:10   ` Mark Brown
  2014-03-14  2:00 ` [PATCH 3/3] regulator: bcm590xx: Use array to save desc and *info Axel Lin
  2014-03-21 18:09 ` [PATCH 1/3] regulator: bcm590xx: Make the modalias matches the driver name Mark Brown
  2 siblings, 2 replies; 8+ messages in thread
From: Axel Lin @ 2014-03-14  1:59 UTC (permalink / raw)
  To: Mark Brown
  Cc: Matt Porter, Tim Kryger, Markus Mayer, Liam Girdwood,
	linux-kernel

The **rdev of 'struct bcm590xx_reg' isn't used anywhere in the driver so
remove it.

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

diff --git a/drivers/regulator/bcm590xx-regulator.c b/drivers/regulator/bcm590xx-regulator.c
index d12d6d6..ab08ca7 100644
--- a/drivers/regulator/bcm590xx-regulator.c
+++ b/drivers/regulator/bcm590xx-regulator.c
@@ -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;
-- 
1.8.1.2




^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 3/3] regulator: bcm590xx: Use array to save desc and *info
  2014-03-14  1:57 [PATCH 1/3] regulator: bcm590xx: Make the modalias matches the driver name Axel Lin
  2014-03-14  1:59 ` [PATCH 2/3] regulator: bcm590xx: Remove **rdev from struct bcm590xx_reg Axel Lin
@ 2014-03-14  2:00 ` Axel Lin
  2014-03-20 15:42   ` Matt Porter
  2014-03-21 18:09 ` [PATCH 1/3] regulator: bcm590xx: Make the modalias matches the driver name Mark Brown
  2 siblings, 1 reply; 8+ messages in thread
From: Axel Lin @ 2014-03-14  2:00 UTC (permalink / raw)
  To: Mark Brown
  Cc: Matt Porter, Tim Kryger, Markus Mayer, Liam Girdwood,
	linux-kernel

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




^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH 2/3] regulator: bcm590xx: Remove **rdev from struct bcm590xx_reg
  2014-03-14  1:59 ` [PATCH 2/3] regulator: bcm590xx: Remove **rdev from struct bcm590xx_reg Axel Lin
@ 2014-03-20 15:21   ` Matt Porter
  2014-03-21 18:10   ` Mark Brown
  1 sibling, 0 replies; 8+ messages in thread
From: Matt Porter @ 2014-03-20 15:21 UTC (permalink / raw)
  To: Axel Lin
  Cc: Mark Brown, Tim Kryger, Markus Mayer, Liam Girdwood, linux-kernel

On Fri, Mar 14, 2014 at 09:59:07AM +0800, Axel Lin wrote:
> The **rdev of 'struct bcm590xx_reg' isn't used anywhere in the driver so
> remove it.
> 
> Signed-off-by: Axel Lin <axel.lin@ingics.com>
> ---
>  drivers/regulator/bcm590xx-regulator.c | 10 ----------
>  1 file changed, 10 deletions(-)

Looks good, thanks for catching this.

Acked-by: Matt Porter <mporter@linaro.org>

> 
> diff --git a/drivers/regulator/bcm590xx-regulator.c b/drivers/regulator/bcm590xx-regulator.c
> index d12d6d6..ab08ca7 100644
> --- a/drivers/regulator/bcm590xx-regulator.c
> +++ b/drivers/regulator/bcm590xx-regulator.c
> @@ -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;
> -- 
> 1.8.1.2
> 
> 
> 

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 3/3] regulator: bcm590xx: Use array to save desc and *info
  2014-03-14  2:00 ` [PATCH 3/3] regulator: bcm590xx: Use array to save desc and *info Axel Lin
@ 2014-03-20 15:42   ` Matt Porter
  2014-03-21  0:58     ` Axel Lin
  0 siblings, 1 reply; 8+ messages in thread
From: Matt Porter @ 2014-03-20 15:42 UTC (permalink / raw)
  To: Axel Lin
  Cc: Mark Brown, Tim Kryger, Markus Mayer, Liam Girdwood, linux-kernel

On Fri, Mar 14, 2014 at 10:00:28AM +0800, Axel Lin wrote:
> 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>

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

> ---
>  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
> 
> 
> 

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 3/3] regulator: bcm590xx: Use array to save desc and *info
  2014-03-20 15:42   ` Matt Porter
@ 2014-03-21  0:58     ` Axel Lin
  0 siblings, 0 replies; 8+ messages in thread
From: Axel Lin @ 2014-03-21  0:58 UTC (permalink / raw)
  To: Matt Porter
  Cc: Mark Brown, Tim Kryger, Markus Mayer, Liam Girdwood,
	linux-kernel@vger.kernel.org

2014-03-20 23:42 GMT+08:00 Matt Porter <mporter@linaro.org>:
> On Fri, Mar 14, 2014 at 10:00:28AM +0800, Axel Lin wrote:
>> 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>
>
> 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

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 1/3] regulator: bcm590xx: Make the modalias matches the driver name
  2014-03-14  1:57 [PATCH 1/3] regulator: bcm590xx: Make the modalias matches the driver name Axel Lin
  2014-03-14  1:59 ` [PATCH 2/3] regulator: bcm590xx: Remove **rdev from struct bcm590xx_reg Axel Lin
  2014-03-14  2:00 ` [PATCH 3/3] regulator: bcm590xx: Use array to save desc and *info Axel Lin
@ 2014-03-21 18:09 ` Mark Brown
  2 siblings, 0 replies; 8+ messages in thread
From: Mark Brown @ 2014-03-21 18:09 UTC (permalink / raw)
  To: Axel Lin; +Cc: Matt Porter, Tim Kryger, Markus Mayer, Liam Girdwood,
	linux-kernel

[-- Attachment #1: Type: text/plain, Size: 124 bytes --]

On Fri, Mar 14, 2014 at 09:57:54AM +0800, Axel Lin wrote:
> Signed-off-by: Axel Lin <axel.lin@ingics.com>

Applied, thanks.

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 2/3] regulator: bcm590xx: Remove **rdev from struct bcm590xx_reg
  2014-03-14  1:59 ` [PATCH 2/3] regulator: bcm590xx: Remove **rdev from struct bcm590xx_reg Axel Lin
  2014-03-20 15:21   ` Matt Porter
@ 2014-03-21 18:10   ` Mark Brown
  1 sibling, 0 replies; 8+ messages in thread
From: Mark Brown @ 2014-03-21 18:10 UTC (permalink / raw)
  To: Axel Lin; +Cc: Matt Porter, Tim Kryger, Markus Mayer, Liam Girdwood,
	linux-kernel

[-- Attachment #1: Type: text/plain, Size: 164 bytes --]

On Fri, Mar 14, 2014 at 09:59:07AM +0800, Axel Lin wrote:
> The **rdev of 'struct bcm590xx_reg' isn't used anywhere in the driver so
> remove it.

Applied, thanks.

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2014-03-21 18:10 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-03-14  1:57 [PATCH 1/3] regulator: bcm590xx: Make the modalias matches the driver name Axel Lin
2014-03-14  1:59 ` [PATCH 2/3] regulator: bcm590xx: Remove **rdev from struct bcm590xx_reg Axel Lin
2014-03-20 15:21   ` Matt Porter
2014-03-21 18:10   ` Mark Brown
2014-03-14  2:00 ` [PATCH 3/3] regulator: bcm590xx: Use array to save desc and *info Axel Lin
2014-03-20 15:42   ` Matt Porter
2014-03-21  0:58     ` Axel Lin
2014-03-21 18:09 ` [PATCH 1/3] regulator: bcm590xx: Make the modalias matches the driver name Mark Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).