]> git.kernelconcepts.de Git - karo-tx-linux.git/blobdiff - drivers/pinctrl/sunxi/pinctrl-sunxi.c
Merge branch 'locking-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel...
[karo-tx-linux.git] / drivers / pinctrl / sunxi / pinctrl-sunxi.c
index fb4669c0ce0e7651e1d9b3dfbcc4d1b4421f4427..dead97daca35fe2e59a0e81f7898b4e66f27b0cb 100644 (file)
@@ -446,16 +446,6 @@ static const struct pinmux_ops sunxi_pmx_ops = {
        .gpio_set_direction     = sunxi_pmx_gpio_set_direction,
 };
 
-static int sunxi_pinctrl_gpio_request(struct gpio_chip *chip, unsigned offset)
-{
-       return pinctrl_request_gpio(chip->base + offset);
-}
-
-static void sunxi_pinctrl_gpio_free(struct gpio_chip *chip, unsigned offset)
-{
-       pinctrl_free_gpio(chip->base + offset);
-}
-
 static int sunxi_pinctrl_gpio_direction_input(struct gpio_chip *chip,
                                        unsigned offset)
 {
@@ -617,13 +607,11 @@ static int sunxi_pinctrl_irq_set_type(struct irq_data *d, unsigned int type)
        spin_lock_irqsave(&pctl->lock, flags);
 
        if (type & IRQ_TYPE_LEVEL_MASK)
-               __irq_set_chip_handler_name_locked(d->irq,
-                                                  &sunxi_pinctrl_level_irq_chip,
-                                                  handle_fasteoi_irq, NULL);
+               irq_set_chip_handler_name_locked(d, &sunxi_pinctrl_level_irq_chip,
+                                                handle_fasteoi_irq, NULL);
        else
-               __irq_set_chip_handler_name_locked(d->irq,
-                                                  &sunxi_pinctrl_edge_irq_chip,
-                                                  handle_edge_irq, NULL);
+               irq_set_chip_handler_name_locked(d, &sunxi_pinctrl_edge_irq_chip,
+                                                handle_edge_irq, NULL);
 
        regval = readl(pctl->membase + reg);
        regval &= ~(IRQ_CFG_IRQ_MASK << index);
@@ -718,6 +706,7 @@ static int sunxi_pinctrl_irq_of_xlate(struct irq_domain *d,
                                      unsigned long *out_hwirq,
                                      unsigned int *out_type)
 {
+       struct sunxi_pinctrl *pctl = d->host_data;
        struct sunxi_desc_function *desc;
        int pin, base;
 
@@ -725,10 +714,9 @@ static int sunxi_pinctrl_irq_of_xlate(struct irq_domain *d,
                return -EINVAL;
 
        base = PINS_PER_BANK * intspec[0];
-       pin = base + intspec[1];
+       pin = pctl->desc->pin_base + base + intspec[1];
 
-       desc = sunxi_pinctrl_desc_find_function_by_pin(d->host_data,
-                                                      pin, "irq");
+       desc = sunxi_pinctrl_desc_find_function_by_pin(pctl, pin, "irq");
        if (!desc)
                return -EINVAL;
 
@@ -742,7 +730,7 @@ static struct irq_domain_ops sunxi_pinctrl_irq_domain_ops = {
        .xlate          = sunxi_pinctrl_irq_of_xlate,
 };
 
-static void sunxi_pinctrl_irq_handler(unsigned __irq, struct irq_desc *desc)
+static void sunxi_pinctrl_irq_handler(struct irq_desc *desc)
 {
        unsigned int irq = irq_desc_get_irq(desc);
        struct irq_chip *chip = irq_desc_get_chip(desc);
@@ -958,8 +946,8 @@ int sunxi_pinctrl_init(struct platform_device *pdev,
 
        last_pin = pctl->desc->pins[pctl->desc->npins - 1].pin.number;
        pctl->chip->owner = THIS_MODULE;
-       pctl->chip->request = sunxi_pinctrl_gpio_request,
-       pctl->chip->free = sunxi_pinctrl_gpio_free,
+       pctl->chip->request = gpiochip_generic_request,
+       pctl->chip->free = gpiochip_generic_free,
        pctl->chip->direction_input = sunxi_pinctrl_gpio_direction_input,
        pctl->chip->direction_output = sunxi_pinctrl_gpio_direction_output,
        pctl->chip->get = sunxi_pinctrl_gpio_get,
@@ -1031,7 +1019,7 @@ int sunxi_pinctrl_init(struct platform_device *pdev,
                irq_set_chip_and_handler(irqno, &sunxi_pinctrl_edge_irq_chip,
                                         handle_edge_irq);
                irq_set_chip_data(irqno, pctl);
-       };
+       }
 
        for (i = 0; i < pctl->desc->irq_banks; i++) {
                /* Mask and clear all IRQs before registering a handler */