[RFC PATCH 3/5] gpio: omap: convert driver to use gpio_chip_ops

From: Javier Martinez Canillas
Date: Tue Apr 08 2014 - 14:25:06 EST


The GPIO controller operations has been split to be stored
on a separate struct gpio_chip_ops virtual function table.

Signed-off-by: Javier Martinez Canillas <javier.martinez@xxxxxxxxxxxxxxx>
---
drivers/gpio/gpio-omap.c | 19 ++++++++++++-------
1 file changed, 12 insertions(+), 7 deletions(-)

diff --git a/drivers/gpio/gpio-omap.c b/drivers/gpio/gpio-omap.c
index 8cc9e91..50f0938 100644
--- a/drivers/gpio/gpio-omap.c
+++ b/drivers/gpio/gpio-omap.c
@@ -1072,6 +1072,16 @@ omap_mpuio_alloc_gc(struct gpio_bank *bank, unsigned int irq_start,
IRQ_NOREQUEST | IRQ_NOPROBE, 0);
}

+const struct gpio_chip_ops omap_gpio_ops = {
+ .request = omap_gpio_request,
+ .free = omap_gpio_free,
+ .direction_input = gpio_input,
+ .get = gpio_get,
+ .direction_output = gpio_output,
+ .set_debounce = gpio_debounce,
+ .set = gpio_set
+};
+
static int omap_gpio_chip_init(struct gpio_bank *bank)
{
int j;
@@ -1083,13 +1093,8 @@ static int omap_gpio_chip_init(struct gpio_bank *bank)
* REVISIT eventually switch from OMAP-specific gpio structs
* over to the generic ones
*/
- bank->chip.request = omap_gpio_request;
- bank->chip.free = omap_gpio_free;
- bank->chip.direction_input = gpio_input;
- bank->chip.get = gpio_get;
- bank->chip.direction_output = gpio_output;
- bank->chip.set_debounce = gpio_debounce;
- bank->chip.set = gpio_set;
+ bank->chip.ops = &omap_gpio_ops;
+
if (bank->is_mpuio) {
bank->chip.label = "mpuio";
if (bank->regs->wkup_en)
--
1.9.0

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/