All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ARM: S5PV210: Use REGULATOR_SUPPLY macro for regulator consumers
@ 2011-01-28  9:29 Kukjin Kim
  2011-02-11  9:31 ` Marek Szyprowski
  0 siblings, 1 reply; 4+ messages in thread
From: Kukjin Kim @ 2011-01-28  9:29 UTC (permalink / raw)
  To: linux-samsung-soc; +Cc: ben-linux, Kukjin Kim

To use REGULATOR_SUPPLY macro is cleaner for initializing regulator
consumer supply.

Signed-off-by: Kukjin Kim <kgene.kim@samsung.com>
---
 arch/arm/mach-s5pv210/mach-aquila.c |   52 +++++++++++-----------------------
 arch/arm/mach-s5pv210/mach-goni.c   |   52 +++++++++++-----------------------
 2 files changed, 34 insertions(+), 70 deletions(-)

diff --git a/arch/arm/mach-s5pv210/mach-aquila.c b/arch/arm/mach-s5pv210/mach-aquila.c
index 461aa03..38b3d67 100644
--- a/arch/arm/mach-s5pv210/mach-aquila.c
+++ b/arch/arm/mach-s5pv210/mach-aquila.c
@@ -296,13 +296,11 @@ static struct regulator_init_data aquila_ldo17_data = {
 };
 
 /* BUCK */
-static struct regulator_consumer_supply buck1_consumer[] = {
-	{	.supply	= "vddarm", },
-};
+static struct regulator_consumer_supply buck1_consumer =
+	REGULATOR_SUPPLY("vddarm", NULL);
 
-static struct regulator_consumer_supply buck2_consumer[] = {
-	{	.supply	= "vddint", },
-};
+static struct regulator_consumer_supply buck2_consumer =
+	REGULATOR_SUPPLY("vddint", NULL);
 
 static struct regulator_init_data aquila_buck1_data = {
 	.constraints	= {
@@ -313,8 +311,8 @@ static struct regulator_init_data aquila_buck1_data = {
 		.valid_ops_mask	= REGULATOR_CHANGE_VOLTAGE |
 				  REGULATOR_CHANGE_STATUS,
 	},
-	.num_consumer_supplies	= ARRAY_SIZE(buck1_consumer),
-	.consumer_supplies	= buck1_consumer,
+	.num_consumer_supplies	= 1,
+	.consumer_supplies	= &buck1_consumer,
 };
 
 static struct regulator_init_data aquila_buck2_data = {
@@ -326,8 +324,8 @@ static struct regulator_init_data aquila_buck2_data = {
 		.valid_ops_mask	= REGULATOR_CHANGE_VOLTAGE |
 				  REGULATOR_CHANGE_STATUS,
 	},
-	.num_consumer_supplies	= ARRAY_SIZE(buck2_consumer),
-	.consumer_supplies	= buck2_consumer,
+	.num_consumer_supplies	= 1,
+	.consumer_supplies	= &buck2_consumer,
 };
 
 static struct regulator_init_data aquila_buck3_data = {
@@ -388,26 +386,14 @@ static struct max8998_platform_data aquila_max8998_pdata = {
 #endif
 
 static struct regulator_consumer_supply wm8994_fixed_voltage0_supplies[] = {
-	{
-		.dev_name	= "5-001a",
-		.supply		= "DBVDD",
-	}, {
-		.dev_name	= "5-001a",
-		.supply		= "AVDD2",
-	}, {
-		.dev_name	= "5-001a",
-		.supply		= "CPVDD",
-	},
+	REGULATOR_SUPPLY("DBVDD", "5-001a"),
+	REGULATOR_SUPPLY("AVDD2", "5-001a"),
+	REGULATOR_SUPPLY("CPVDD", "5-001a"),
 };
 
 static struct regulator_consumer_supply wm8994_fixed_voltage1_supplies[] = {
-	{
-		.dev_name	= "5-001a",
-		.supply		= "SPKVDD1",
-	}, {
-		.dev_name	= "5-001a",
-		.supply		= "SPKVDD2",
-	},
+	REGULATOR_SUPPLY("SPKVDD1", "5-001a"),
+	REGULATOR_SUPPLY("SPKVDD2", "5-001a"),
 };
 
 static struct regulator_init_data wm8994_fixed_voltage0_init_data = {
@@ -456,15 +442,11 @@ static struct platform_device wm8994_fixed_voltage1 = {
 	},
 };
 
-static struct regulator_consumer_supply wm8994_avdd1_supply = {
-	.dev_name	= "5-001a",
-	.supply		= "AVDD1",
-};
+static struct regulator_consumer_supply wm8994_avdd1_supply =
+	REGULATOR_SUPPLY("AVDD1", "5-001a");
 
-static struct regulator_consumer_supply wm8994_dcvdd_supply = {
-	.dev_name	= "5-001a",
-	.supply		= "DCVDD",
-};
+static struct regulator_consumer_supply wm8994_dcvdd_supply =
+	REGULATOR_SUPPLY("DCVDD", "5-001a");
 
 static struct regulator_init_data wm8994_ldo1_data = {
 	.constraints	= {
diff --git a/arch/arm/mach-s5pv210/mach-goni.c b/arch/arm/mach-s5pv210/mach-goni.c
index e22d511..db16d72 100644
--- a/arch/arm/mach-s5pv210/mach-goni.c
+++ b/arch/arm/mach-s5pv210/mach-goni.c
@@ -436,13 +436,11 @@ static struct regulator_init_data goni_ldo17_data = {
 };
 
 /* BUCK */
-static struct regulator_consumer_supply buck1_consumer[] = {
-	{	.supply	= "vddarm", },
-};
+static struct regulator_consumer_supply buck1_consumer =
+	REGULATOR_SUPPLY("vddarm", NULL);
 
-static struct regulator_consumer_supply buck2_consumer[] = {
-	{	.supply	= "vddint", },
-};
+static struct regulator_consumer_supply buck2_consumer =
+	REGULATOR_SUPPLY("vddint", NULL);
 
 static struct regulator_init_data goni_buck1_data = {
 	.constraints	= {
@@ -453,8 +451,8 @@ static struct regulator_init_data goni_buck1_data = {
 		.valid_ops_mask	= REGULATOR_CHANGE_VOLTAGE |
 				  REGULATOR_CHANGE_STATUS,
 	},
-	.num_consumer_supplies	= ARRAY_SIZE(buck1_consumer),
-	.consumer_supplies	= buck1_consumer,
+	.num_consumer_supplies	= 1,
+	.consumer_supplies	= &buck1_consumer,
 };
 
 static struct regulator_init_data goni_buck2_data = {
@@ -466,8 +464,8 @@ static struct regulator_init_data goni_buck2_data = {
 		.valid_ops_mask	= REGULATOR_CHANGE_VOLTAGE |
 				  REGULATOR_CHANGE_STATUS,
 	},
-	.num_consumer_supplies	= ARRAY_SIZE(buck2_consumer),
-	.consumer_supplies	= buck2_consumer,
+	.num_consumer_supplies	= 1,
+	.consumer_supplies	= &buck2_consumer,
 };
 
 static struct regulator_init_data goni_buck3_data = {
@@ -528,26 +526,14 @@ static struct max8998_platform_data goni_max8998_pdata = {
 #endif
 
 static struct regulator_consumer_supply wm8994_fixed_voltage0_supplies[] = {
-	{
-		.dev_name	= "5-001a",
-		.supply		= "DBVDD",
-	}, {
-		.dev_name	= "5-001a",
-		.supply		= "AVDD2",
-	}, {
-		.dev_name	= "5-001a",
-		.supply		= "CPVDD",
-	},
+	REGULATOR_SUPPLY("DBVDD", "5-001a"),
+	REGULATOR_SUPPLY("AVDD2", "5-001a"),
+	REGULATOR_SUPPLY("CPVDD", "5-001a"),
 };
 
 static struct regulator_consumer_supply wm8994_fixed_voltage1_supplies[] = {
-	{
-		.dev_name	= "5-001a",
-		.supply		= "SPKVDD1",
-	}, {
-		.dev_name	= "5-001a",
-		.supply		= "SPKVDD2",
-	},
+	REGULATOR_SUPPLY("SPKVDD1", "5-001a"),
+	REGULATOR_SUPPLY("SPKVDD2", "5-001a"),
 };
 
 static struct regulator_init_data wm8994_fixed_voltage0_init_data = {
@@ -596,15 +582,11 @@ static struct platform_device wm8994_fixed_voltage1 = {
 	},
 };
 
-static struct regulator_consumer_supply wm8994_avdd1_supply = {
-	.dev_name	= "5-001a",
-	.supply		= "AVDD1",
-};
+static struct regulator_consumer_supply wm8994_avdd1_supply =
+	REGULATOR_SUPPLY("AVDD1", "5-001a");
 
-static struct regulator_consumer_supply wm8994_dcvdd_supply = {
-	.dev_name	= "5-001a",
-	.supply		= "DCVDD",
-};
+static struct regulator_consumer_supply wm8994_dcvdd_supply =
+	REGULATOR_SUPPLY("DCVDD", "5-001a");
 
 static struct regulator_init_data wm8994_ldo1_data = {
 	.constraints	= {
-- 
1.7.1

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

* RE: [PATCH] ARM: S5PV210: Use REGULATOR_SUPPLY macro for regulator consumers
  2011-01-28  9:29 [PATCH] ARM: S5PV210: Use REGULATOR_SUPPLY macro for regulator consumers Kukjin Kim
@ 2011-02-11  9:31 ` Marek Szyprowski
  2011-02-11 18:31   ` Mark Brown
  0 siblings, 1 reply; 4+ messages in thread
From: Marek Szyprowski @ 2011-02-11  9:31 UTC (permalink / raw)
  To: 'Kukjin Kim', linux-samsung-soc
  Cc: ben-linux, 'Mark Brown', Marek Szyprowski

Hello,

I'm sorry for the late reply, just noticed this commit on your kernel tree...

On Friday, January 28, 2011 10:29 AM Kukjin Kim wrote:

> To use REGULATOR_SUPPLY macro is cleaner for initializing regulator
> consumer supply.
> 
> Signed-off-by: Kukjin Kim <kgene.kim@samsung.com>
> ---
>  arch/arm/mach-s5pv210/mach-aquila.c |   52 +++++++++++-----------------------
>  arch/arm/mach-s5pv210/mach-goni.c   |   52 +++++++++++-----------------------
>  2 files changed, 34 insertions(+), 70 deletions(-)
> 
> diff --git a/arch/arm/mach-s5pv210/mach-aquila.c b/arch/arm/mach-s5pv210/mach-aquila.c
> index 461aa03..38b3d67 100644
> --- a/arch/arm/mach-s5pv210/mach-aquila.c
> +++ b/arch/arm/mach-s5pv210/mach-aquila.c
> @@ -296,13 +296,11 @@ static struct regulator_init_data aquila_ldo17_data = {
>  };
> 
>  /* BUCK */
> -static struct regulator_consumer_supply buck1_consumer[] = {
> -	{	.supply	= "vddarm", },
> -};
> +static struct regulator_consumer_supply buck1_consumer =
> +	REGULATOR_SUPPLY("vddarm", NULL);
> 
> -static struct regulator_consumer_supply buck2_consumer[] = {
> -	{	.supply	= "vddint", },
> -};
> +static struct regulator_consumer_supply buck2_consumer =
> +	REGULATOR_SUPPLY("vddint", NULL);
> 
>  static struct regulator_init_data aquila_buck1_data = {
>  	.constraints	= {
> @@ -313,8 +311,8 @@ static struct regulator_init_data aquila_buck1_data = {
>  		.valid_ops_mask	= REGULATOR_CHANGE_VOLTAGE |
>  				  REGULATOR_CHANGE_STATUS,
>  	},
> -	.num_consumer_supplies	= ARRAY_SIZE(buck1_consumer),
> -	.consumer_supplies	= buck1_consumer,
> +	.num_consumer_supplies	= 1,
> +	.consumer_supplies	= &buck1_consumer,
>  };

I'm really not sure that this type of change is necessary. IMHO it makes the code harder
to read, update or reuse. What is the reason for it?

[snip]

Best regards
--
Marek Szyprowski
Samsung Poland R&D Center

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

* Re: [PATCH] ARM: S5PV210: Use REGULATOR_SUPPLY macro for regulator consumers
  2011-02-11  9:31 ` Marek Szyprowski
@ 2011-02-11 18:31   ` Mark Brown
  2011-02-14  9:35     ` Marek Szyprowski
  0 siblings, 1 reply; 4+ messages in thread
From: Mark Brown @ 2011-02-11 18:31 UTC (permalink / raw)
  To: Marek Szyprowski; +Cc: 'Kukjin Kim', linux-samsung-soc, ben-linux

On Fri, Feb 11, 2011 at 10:31:08AM +0100, Marek Szyprowski wrote:

> I'm sorry for the late reply, just noticed this commit on your kernel tree...

Please don't make up e-mail addresses for people if you want them to see
your e-mail - my e-mail address is broonie@opensource.wolfsonmicro.com

> > -	.num_consumer_supplies	= ARRAY_SIZE(buck1_consumer),
> > -	.consumer_supplies	= buck1_consumer,
> > +	.num_consumer_supplies	= 1,
> > +	.consumer_supplies	= &buck1_consumer,
> >  };

> I'm really not sure that this type of change is necessary. IMHO it makes the code harder
> to read, update or reuse. What is the reason for it?

FWIW I don't think it makes much difference either way.

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

* RE: [PATCH] ARM: S5PV210: Use REGULATOR_SUPPLY macro for regulator consumers
  2011-02-11 18:31   ` Mark Brown
@ 2011-02-14  9:35     ` Marek Szyprowski
  0 siblings, 0 replies; 4+ messages in thread
From: Marek Szyprowski @ 2011-02-14  9:35 UTC (permalink / raw)
  To: 'Mark Brown'; +Cc: 'Kukjin Kim', linux-samsung-soc, ben-linux

Hello,

On Friday, February 11, 2011 7:31 PM Mark Brown wrote:

> On Fri, Feb 11, 2011 at 10:31:08AM +0100, Marek Szyprowski wrote:
> 
> > I'm sorry for the late reply, just noticed this commit on your kernel tree...
> 
> Please don't make up e-mail addresses for people if you want them to see
> your e-mail - my e-mail address is broonie@opensource.wolfsonmicro.com

I'm really sorry for the using wrong email. I've relied on email cache, but
it looks it was simply wrong here...

> > > -	.num_consumer_supplies	= ARRAY_SIZE(buck1_consumer),
> > > -	.consumer_supplies	= buck1_consumer,
> > > +	.num_consumer_supplies	= 1,
> > > +	.consumer_supplies	= &buck1_consumer,
> > >  };
> 
> > I'm really not sure that this type of change is necessary. IMHO it makes the code harder
> > to read, update or reuse. What is the reason for it?
> 
> FWIW I don't think it makes much difference either way.

Ok, then I'm fine with the change.

Best regards
--
Marek Szyprowski
Samsung Poland R&D Center

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

end of thread, other threads:[~2011-02-14  9:36 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-01-28  9:29 [PATCH] ARM: S5PV210: Use REGULATOR_SUPPLY macro for regulator consumers Kukjin Kim
2011-02-11  9:31 ` Marek Szyprowski
2011-02-11 18:31   ` Mark Brown
2011-02-14  9:35     ` Marek Szyprowski

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.