2013-06-10 15:09:24

by Pawel Moll

[permalink] [raw]
Subject: [PATCH] mfd: vexpress: Make the driver optional for arm and arm64

The driver can be used on either arm or arm64 platforms, but
the latter doesn't have any platform-specific configuration
options, so it must be possible to manually enable the driver.

As the gpiolib is optional for arm64 arch, the gpio/led code
must be compiled conditionally.

Signed-off-by: Pawel Moll <[email protected]>
Acked-by: Catalin Marinas <[email protected]>
---
drivers/mfd/Kconfig | 3 ++-
drivers/mfd/vexpress-sysreg.c | 10 ++++++++--
2 files changed, 10 insertions(+), 3 deletions(-)

Hi Samuel,

Could you please queue this small change for 3.11?

Thanks!

Pawel

diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig
index d54e985..6959b8d 100644
--- a/drivers/mfd/Kconfig
+++ b/drivers/mfd/Kconfig
@@ -1144,7 +1144,8 @@ config MCP_UCB1200_TS
endmenu

config VEXPRESS_CONFIG
- bool
+ bool "ARM Versatile Express platform infrastructure"
+ depends on ARM || ARM64
help
Platform configuration infrastructure for the ARM Ltd.
Versatile Express.
diff --git a/drivers/mfd/vexpress-sysreg.c b/drivers/mfd/vexpress-sysreg.c
index 96a020b..e2bbec5 100644
--- a/drivers/mfd/vexpress-sysreg.c
+++ b/drivers/mfd/vexpress-sysreg.c
@@ -351,6 +351,8 @@ void __init vexpress_sysreg_of_early_init(void)
}


+#if defined(CONFIG_GPIOLIB)
+
#define VEXPRESS_SYSREG_GPIO(_name, _reg, _value) \
[VEXPRESS_GPIO_##_name] = { \
.reg = _reg, \
@@ -445,6 +447,8 @@ struct gpio_led_platform_data vexpress_sysreg_leds_pdata = {
.leds = vexpress_sysreg_leds,
};

+#endif
+

static ssize_t vexpress_sysreg_sys_id_show(struct device *dev,
struct device_attribute *attr, char *buf)
@@ -480,6 +484,9 @@ static int vexpress_sysreg_probe(struct platform_device *pdev)
setup_timer(&vexpress_sysreg_config_timer,
vexpress_sysreg_config_complete, 0);

+ vexpress_sysreg_dev = &pdev->dev;
+
+#if defined(CONFIG_GPIOLIB)
vexpress_sysreg_gpio_chip.dev = &pdev->dev;
err = gpiochip_add(&vexpress_sysreg_gpio_chip);
if (err) {
@@ -490,11 +497,10 @@ static int vexpress_sysreg_probe(struct platform_device *pdev)
return err;
}

- vexpress_sysreg_dev = &pdev->dev;
-
platform_device_register_data(vexpress_sysreg_dev, "leds-gpio",
PLATFORM_DEVID_AUTO, &vexpress_sysreg_leds_pdata,
sizeof(vexpress_sysreg_leds_pdata));
+#endif

device_create_file(vexpress_sysreg_dev, &dev_attr_sys_id);

--
1.8.1.2


2013-06-10 23:23:01

by Russell King - ARM Linux

[permalink] [raw]
Subject: Re: [PATCH] mfd: vexpress: Make the driver optional for arm and arm64

On Mon, Jun 10, 2013 at 04:09:15PM +0100, Pawel Moll wrote:
> The driver can be used on either arm or arm64 platforms, but
> the latter doesn't have any platform-specific configuration
> options, so it must be possible to manually enable the driver.
>
> As the gpiolib is optional for arm64 arch, the gpio/led code
> must be compiled conditionally.
>
> Signed-off-by: Pawel Moll <[email protected]>
> Acked-by: Catalin Marinas <[email protected]>
> ---
> drivers/mfd/Kconfig | 3 ++-
> drivers/mfd/vexpress-sysreg.c | 10 ++++++++--
> 2 files changed, 10 insertions(+), 3 deletions(-)
>
> Hi Samuel,
>
> Could you please queue this small change for 3.11?

Please use #ifdef rather than a single #if defined(). #if defined()
on its own is unnecessarily ugly.

2013-06-11 10:56:21

by Pawel Moll

[permalink] [raw]
Subject: [PATCH v2] mfd: vexpress: Make the driver optional for arm and arm64

The driver can be used on either arm or arm64 platforms, but
the latter doesn't have any platform-specific configuration
options, so it must be possible to manually enable the driver.

As the gpiolib is optional for arm64 arch, the gpio/led code
must be compiled conditionally.

Signed-off-by: Pawel Moll <[email protected]>
Acked-by: Catalin Marinas <[email protected]>
---
drivers/mfd/Kconfig | 3 ++-
drivers/mfd/vexpress-sysreg.c | 10 ++++++++--
2 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig
index d54e985..6959b8d 100644
--- a/drivers/mfd/Kconfig
+++ b/drivers/mfd/Kconfig
@@ -1144,7 +1144,8 @@ config MCP_UCB1200_TS
endmenu

config VEXPRESS_CONFIG
- bool
+ bool "ARM Versatile Express platform infrastructure"
+ depends on ARM || ARM64
help
Platform configuration infrastructure for the ARM Ltd.
Versatile Express.
diff --git a/drivers/mfd/vexpress-sysreg.c b/drivers/mfd/vexpress-sysreg.c
index 96a020b..981bef4 100644
--- a/drivers/mfd/vexpress-sysreg.c
+++ b/drivers/mfd/vexpress-sysreg.c
@@ -351,6 +351,8 @@ void __init vexpress_sysreg_of_early_init(void)
}


+#ifdef CONFIG_GPIOLIB
+
#define VEXPRESS_SYSREG_GPIO(_name, _reg, _value) \
[VEXPRESS_GPIO_##_name] = { \
.reg = _reg, \
@@ -445,6 +447,8 @@ struct gpio_led_platform_data vexpress_sysreg_leds_pdata = {
.leds = vexpress_sysreg_leds,
};

+#endif
+

static ssize_t vexpress_sysreg_sys_id_show(struct device *dev,
struct device_attribute *attr, char *buf)
@@ -480,6 +484,9 @@ static int vexpress_sysreg_probe(struct platform_device *pdev)
setup_timer(&vexpress_sysreg_config_timer,
vexpress_sysreg_config_complete, 0);

+ vexpress_sysreg_dev = &pdev->dev;
+
+#ifdef CONFIG_GPIOLIB
vexpress_sysreg_gpio_chip.dev = &pdev->dev;
err = gpiochip_add(&vexpress_sysreg_gpio_chip);
if (err) {
@@ -490,11 +497,10 @@ static int vexpress_sysreg_probe(struct platform_device *pdev)
return err;
}

- vexpress_sysreg_dev = &pdev->dev;
-
platform_device_register_data(vexpress_sysreg_dev, "leds-gpio",
PLATFORM_DEVID_AUTO, &vexpress_sysreg_leds_pdata,
sizeof(vexpress_sysreg_leds_pdata));
+#endif

device_create_file(vexpress_sysreg_dev, &dev_attr_sys_id);

--
1.8.1.2

2013-06-19 09:34:08

by Samuel Ortiz

[permalink] [raw]
Subject: Re: [PATCH v2] mfd: vexpress: Make the driver optional for arm and arm64

Hi Pawel,

On Tue, Jun 11, 2013 at 11:56:02AM +0100, Pawel Moll wrote:
> The driver can be used on either arm or arm64 platforms, but
> the latter doesn't have any platform-specific configuration
> options, so it must be possible to manually enable the driver.
>
> As the gpiolib is optional for arm64 arch, the gpio/led code
> must be compiled conditionally.
The real solution would be to move the GPIO code away from the MFD
driver, as we agreed on another thread.
Based on this agreement, I'm taking this one for now, thanks.

Cheers,
Samuel.

--
Intel Open Source Technology Centre
http://oss.intel.com/