Topics

[PATCH 7/8] gpio: gpio_dw: Use generic suspend suspend/resume API


dirk.brandewie@...
 

From: Dirk Brandewie <dirk.j.brandewie(a)intel.com>

Change-Id: I55c2c8132172e841214e53be76545b5c84ba1a3c
Signed-off-by: Dirk Brandewie <dirk.j.brandewie(a)intel.com>
---
drivers/gpio/gpio_dw.c | 26 ++++++++++++++++++--------
1 file changed, 18 insertions(+), 8 deletions(-)

diff --git a/drivers/gpio/gpio_dw.c b/drivers/gpio/gpio_dw.c
index 85150a6..4b3da49 100644
--- a/drivers/gpio/gpio_dw.c
+++ b/drivers/gpio/gpio_dw.c
@@ -354,8 +354,6 @@ static struct gpio_driver_api api_funcs = {
.set_callback = gpio_dw_set_callback,
.enable_callback = gpio_dw_enable_callback,
.disable_callback = gpio_dw_disable_callback,
- .suspend = gpio_dw_suspend_port,
- .resume = gpio_dw_resume_port
};

#ifdef CONFIG_PCI
@@ -417,6 +415,11 @@ int gpio_dw_initialize(struct device *port)
return 0;
}

+struct device_ops gpio_dw_dev_ops = {
+ .suspend = gpio_dw_suspend_port,
+ .resume = gpio_dw_resume_port
+};
+
/* Bindings to the plaform */
#if CONFIG_GPIO_DW_0
void gpio_config_0_irq(struct device *port);
@@ -448,9 +451,12 @@ struct gpio_dw_config gpio_config_0 = {

struct gpio_dw_runtime gpio_0_runtime;

-DEVICE_INIT(gpio_dw_0, CONFIG_GPIO_DW_0_NAME, gpio_dw_initialize,
- &gpio_0_runtime, &gpio_config_0,
- SECONDARY, CONFIG_GPIO_DW_INIT_PRIORITY);
+
+DECLARE_INIT_PM(gpio_0, CONFIG_GPIO_DW_0_NAME,
+ gpio_dw_initialize, &gpio_dw_dev_ops,
+ &gpio_config_0);
+SYS_DEFINE_DEVICE(gpio_0, &gpio_0_runtime, SECONDARY,
+ CONFIG_GPIO_DW_INIT_PRIORITY);

#ifdef CONFIG_GPIO_DW_0_IRQ_DIRECT
#ifdef CONFIG_IOAPIC
@@ -522,9 +528,13 @@ struct gpio_dw_config gpio_dw_config_1 = {

struct gpio_dw_runtime gpio_1_runtime;

-DEVICE_INIT(gpio_dw_1, CONFIG_GPIO_DW_1_NAME, gpio_dw_initialize,
- &gpio_1_runtime, &gpio_dw_config_1,
- SECONDARY, CONFIG_GPIO_DW_INIT_PRIORITY);
+
+DECLARE_INIT_PM(gpio_1, CONFIG_GPIO_DW_1_NAME,
+ gpio_dw_initialize, &gpio_dw_dev_ops,
+ &gpio_dw_config_1);
+
+SYS_DEFINE_DEVICE(gpio_1, &gpio_1_runtime, SECONDARY,
+ CONFIG_GPIO_DW_INIT_PRIORITY);

#ifdef CONFIG_GPIO_DW_1_IRQ_DIRECT
#ifdef CONFIG_IOAPIC
--
2.4.3