diff mbox

[08/12] mfd: vexpress-sysreg: Add syscon labels as platform data

Message ID 1392138636-29240-9-git-send-email-pawel.moll@arm.com
State New
Headers show

Commit Message

Pawel Moll Feb. 11, 2014, 5:10 p.m. UTC
This patch adds label names for syscon registers as platform
data for the relevant MFD cells.

Cc: Samuel Ortiz <sameo@linux.intel.com>
Cc: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Pawel Moll <pawel.moll@arm.com>
---
 drivers/mfd/vexpress-sysreg.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

Comments

Lee Jones Feb. 11, 2014, 5:29 p.m. UTC | #1
> This patch adds label names for syscon registers as platform
> data for the relevant MFD cells.

Okay, I see.

Hmm... not sure I like this at all. It seems awfully as though you're
bending current infrastructure to suit your needs. There must be better
ways of passing a name than through pdata, and if there isn't I'd
suggest setting up a sysconf pdata struct that others can use in case
they wish to expand the functionality further in some other
unfathomable way. :)

> Cc: Samuel Ortiz <sameo@linux.intel.com>
> Cc: Lee Jones <lee.jones@linaro.org>
> Signed-off-by: Pawel Moll <pawel.moll@arm.com>
> ---
>  drivers/mfd/vexpress-sysreg.c | 12 ++++++++++++
>  1 file changed, 12 insertions(+)
> 
> diff --git a/drivers/mfd/vexpress-sysreg.c b/drivers/mfd/vexpress-sysreg.c
> index ece5ac8..57c21a0 100644
> --- a/drivers/mfd/vexpress-sysreg.c
> +++ b/drivers/mfd/vexpress-sysreg.c
> @@ -132,6 +132,8 @@ void __init vexpress_sysreg_early_init(void __iomem *base)
>  
>  /* The sysreg block is just a random collection of various functions... */
>  
> +static const char vexpress_sysreg_sys_id_pdata[] = "sys_id";
> +
>  static struct bgpio_pdata vexpress_sysreg_sys_led_pdata = {
>  	.label = "sys_led",
>  	.base = -1,
> @@ -150,6 +152,10 @@ static struct bgpio_pdata vexpress_sysreg_sys_flash_pdata = {
>  	.ngpio = 1,
>  };
>  
> +static const char vexpress_sysreg_sys_misc_pdata[] = "sys_misc";
> +
> +static const char vexpress_sysreg_sys_procid_pdata[] = "sys_procid";
> +
>  static struct mfd_cell vexpress_sysreg_cells[] = {
>  	{
>  		.name = "syscon",
> @@ -157,6 +163,8 @@ static struct mfd_cell vexpress_sysreg_cells[] = {
>  		.resources = (struct resource []) {
>  			DEFINE_RES_MEM(SYS_ID, 0x4),
>  		},
> +		.platform_data = &vexpress_sysreg_sys_id_pdata,
> +		.pdata_size = sizeof(vexpress_sysreg_sys_id_pdata),
>  	}, {
>  		.name = "basic-mmio-gpio",
>  		.of_compatible = "arm,vexpress-sysreg,sys_led",
> @@ -190,12 +198,16 @@ static struct mfd_cell vexpress_sysreg_cells[] = {
>  		.resources = (struct resource []) {
>  			DEFINE_RES_MEM(SYS_MISC, 0x4),
>  		},
> +		.platform_data = &vexpress_sysreg_sys_misc_pdata,
> +		.pdata_size = sizeof(vexpress_sysreg_sys_misc_pdata),
>  	}, {
>  		.name = "syscon",
>  		.num_resources = 1,
>  		.resources = (struct resource []) {
>  			DEFINE_RES_MEM(SYS_PROCID0, 0x8),
>  		},
> +		.platform_data = &vexpress_sysreg_sys_procid_pdata,
> +		.pdata_size = sizeof(vexpress_sysreg_sys_procid_pdata),
>  	}, {
>  		.name = "vexpress-syscfg",
>  		.num_resources = 1,
Pawel Moll Feb. 11, 2014, 5:32 p.m. UTC | #2
On Tue, 2014-02-11 at 17:29 +0000, Lee Jones wrote:
> There must be better
> ways of passing a name than through pdata, and if there isn't I'd
> suggest setting up a sysconf pdata struct that others can use in case
> they wish to expand the functionality further in some other
> unfathomable way. :)

... which I proposed in the previous patch :-)

On Tue, 2014-02-11 at 17:10 +0000, Pawel Moll wrote:
> Alternatively I could define a syscon platform data structure,
> something like this:
> 
> struct syscon_platform_data {
> 	const char *label;
> };

Pawel

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/
Lee Jones Feb. 11, 2014, 5:48 p.m. UTC | #3
On Tue, 11 Feb 2014, Pawel Moll wrote:

> On Tue, 2014-02-11 at 17:29 +0000, Lee Jones wrote:
> > There must be better
> > ways of passing a name than through pdata, and if there isn't I'd
> > suggest setting up a sysconf pdata struct that others can use in case
> > they wish to expand the functionality further in some other
> > unfathomable way. :)
> 
> ... which I proposed in the previous patch :-)
> 
> > Alternatively I could define a syscon platform data structure,
> > something like this:
> > 
> > struct syscon_platform_data {
> > 	const char *label;
> > };

So you did.

Yes, this would be the lesser of the two evils.
diff mbox

Patch

diff --git a/drivers/mfd/vexpress-sysreg.c b/drivers/mfd/vexpress-sysreg.c
index ece5ac8..57c21a0 100644
--- a/drivers/mfd/vexpress-sysreg.c
+++ b/drivers/mfd/vexpress-sysreg.c
@@ -132,6 +132,8 @@  void __init vexpress_sysreg_early_init(void __iomem *base)
 
 /* The sysreg block is just a random collection of various functions... */
 
+static const char vexpress_sysreg_sys_id_pdata[] = "sys_id";
+
 static struct bgpio_pdata vexpress_sysreg_sys_led_pdata = {
 	.label = "sys_led",
 	.base = -1,
@@ -150,6 +152,10 @@  static struct bgpio_pdata vexpress_sysreg_sys_flash_pdata = {
 	.ngpio = 1,
 };
 
+static const char vexpress_sysreg_sys_misc_pdata[] = "sys_misc";
+
+static const char vexpress_sysreg_sys_procid_pdata[] = "sys_procid";
+
 static struct mfd_cell vexpress_sysreg_cells[] = {
 	{
 		.name = "syscon",
@@ -157,6 +163,8 @@  static struct mfd_cell vexpress_sysreg_cells[] = {
 		.resources = (struct resource []) {
 			DEFINE_RES_MEM(SYS_ID, 0x4),
 		},
+		.platform_data = &vexpress_sysreg_sys_id_pdata,
+		.pdata_size = sizeof(vexpress_sysreg_sys_id_pdata),
 	}, {
 		.name = "basic-mmio-gpio",
 		.of_compatible = "arm,vexpress-sysreg,sys_led",
@@ -190,12 +198,16 @@  static struct mfd_cell vexpress_sysreg_cells[] = {
 		.resources = (struct resource []) {
 			DEFINE_RES_MEM(SYS_MISC, 0x4),
 		},
+		.platform_data = &vexpress_sysreg_sys_misc_pdata,
+		.pdata_size = sizeof(vexpress_sysreg_sys_misc_pdata),
 	}, {
 		.name = "syscon",
 		.num_resources = 1,
 		.resources = (struct resource []) {
 			DEFINE_RES_MEM(SYS_PROCID0, 0x8),
 		},
+		.platform_data = &vexpress_sysreg_sys_procid_pdata,
+		.pdata_size = sizeof(vexpress_sysreg_sys_procid_pdata),
 	}, {
 		.name = "vexpress-syscfg",
 		.num_resources = 1,