diff mbox series

pinctrl: at91-pio4: Get rid of legacy call

Message ID 20180913120636.28430-1-linus.walleij@linaro.org
State Accepted
Commit e897b3866580978d5081970ccdd732c137ab08b0
Headers show
Series pinctrl: at91-pio4: Get rid of legacy call | expand

Commit Message

Linus Walleij Sept. 13, 2018, 12:06 p.m. UTC
By just moving the atmel_gpio_to_irq() and calling the internal
function we can get rid of the driver calling back out into the
deprecated external consumer API.

Cc: Ludovic Desroches <ludovic.desroches@microchip.com>
Cc: Alexandre Belloni <alexandre.belloni@bootlin.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>

---
 drivers/pinctrl/pinctrl-at91-pio4.c | 18 ++++++++----------
 1 file changed, 8 insertions(+), 10 deletions(-)

-- 
2.17.1

Comments

Ludovic Desroches Sept. 13, 2018, 1:03 p.m. UTC | #1
On Thu, Sep 13, 2018 at 02:06:36PM +0200, Linus Walleij wrote:
> By just moving the atmel_gpio_to_irq() and calling the internal

> function we can get rid of the driver calling back out into the

> deprecated external consumer API.

> 

> Cc: Ludovic Desroches <ludovic.desroches@microchip.com>

> Cc: Alexandre Belloni <alexandre.belloni@bootlin.com>

> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>

> ---

>  drivers/pinctrl/pinctrl-at91-pio4.c | 18 ++++++++----------

>  1 file changed, 8 insertions(+), 10 deletions(-)

> 

> diff --git a/drivers/pinctrl/pinctrl-at91-pio4.c b/drivers/pinctrl/pinctrl-at91-pio4.c

> index ef7ab208b951..9c76d9d358cc 100644

> --- a/drivers/pinctrl/pinctrl-at91-pio4.c

> +++ b/drivers/pinctrl/pinctrl-at91-pio4.c

> @@ -17,8 +17,6 @@

>  #include <dt-bindings/pinctrl/at91.h>

>  #include <linux/clk.h>

>  #include <linux/gpio/driver.h>

> -/* FIXME: needed for gpio_to_irq(), get rid of this */

> -#include <linux/gpio.h>

>  #include <linux/interrupt.h>

>  #include <linux/io.h>

>  #include <linux/init.h>

> @@ -264,6 +262,13 @@ static struct irq_chip atmel_gpio_irq_chip = {

>  	.irq_set_wake	= atmel_gpio_irq_set_wake,

>  };

>  

> +static int atmel_gpio_to_irq(struct gpio_chip *chip, unsigned offset)

> +{

> +	struct atmel_pioctrl *atmel_pioctrl = gpiochip_get_data(chip);

> +

> +	return irq_find_mapping(atmel_pioctrl->irq_domain, offset);

> +}

> +

>  static void atmel_gpio_irq_handler(struct irq_desc *desc)

>  {

>  	unsigned int irq = irq_desc_get_irq(desc);

> @@ -297,7 +302,7 @@ static void atmel_gpio_irq_handler(struct irq_desc *desc)

>  			break;

>  

>  		for_each_set_bit(n, &isr, BITS_PER_LONG)

> -			generic_handle_irq(gpio_to_irq(bank *

> +			generic_handle_irq(atmel_gpio_to_irq(chip, bank *


chip is a pointer on an irq_chip structure not a gpio_chip one.
s/chip/atmel_pioctrl->gpio_chip

Once fixed,
Acked-by: Ludovic Desroches <ludovic.desroches@microchip.com>


Regards

Ludovic

>  					ATMEL_PIO_NPINS_PER_BANK + n));

>  	}

>  

> @@ -360,13 +365,6 @@ static void atmel_gpio_set(struct gpio_chip *chip, unsigned offset, int val)

>  			 BIT(pin->line));

>  }

>  

> -static int atmel_gpio_to_irq(struct gpio_chip *chip, unsigned offset)

> -{

> -	struct atmel_pioctrl *atmel_pioctrl = gpiochip_get_data(chip);

> -

> -	return irq_find_mapping(atmel_pioctrl->irq_domain, offset);

> -}

> -

>  static struct gpio_chip atmel_gpio_chip = {

>  	.direction_input        = atmel_gpio_direction_input,

>  	.get                    = atmel_gpio_get,

> -- 

> 2.17.1

>
diff mbox series

Patch

diff --git a/drivers/pinctrl/pinctrl-at91-pio4.c b/drivers/pinctrl/pinctrl-at91-pio4.c
index ef7ab208b951..9c76d9d358cc 100644
--- a/drivers/pinctrl/pinctrl-at91-pio4.c
+++ b/drivers/pinctrl/pinctrl-at91-pio4.c
@@ -17,8 +17,6 @@ 
 #include <dt-bindings/pinctrl/at91.h>
 #include <linux/clk.h>
 #include <linux/gpio/driver.h>
-/* FIXME: needed for gpio_to_irq(), get rid of this */
-#include <linux/gpio.h>
 #include <linux/interrupt.h>
 #include <linux/io.h>
 #include <linux/init.h>
@@ -264,6 +262,13 @@  static struct irq_chip atmel_gpio_irq_chip = {
 	.irq_set_wake	= atmel_gpio_irq_set_wake,
 };
 
+static int atmel_gpio_to_irq(struct gpio_chip *chip, unsigned offset)
+{
+	struct atmel_pioctrl *atmel_pioctrl = gpiochip_get_data(chip);
+
+	return irq_find_mapping(atmel_pioctrl->irq_domain, offset);
+}
+
 static void atmel_gpio_irq_handler(struct irq_desc *desc)
 {
 	unsigned int irq = irq_desc_get_irq(desc);
@@ -297,7 +302,7 @@  static void atmel_gpio_irq_handler(struct irq_desc *desc)
 			break;
 
 		for_each_set_bit(n, &isr, BITS_PER_LONG)
-			generic_handle_irq(gpio_to_irq(bank *
+			generic_handle_irq(atmel_gpio_to_irq(chip, bank *
 					ATMEL_PIO_NPINS_PER_BANK + n));
 	}
 
@@ -360,13 +365,6 @@  static void atmel_gpio_set(struct gpio_chip *chip, unsigned offset, int val)
 			 BIT(pin->line));
 }
 
-static int atmel_gpio_to_irq(struct gpio_chip *chip, unsigned offset)
-{
-	struct atmel_pioctrl *atmel_pioctrl = gpiochip_get_data(chip);
-
-	return irq_find_mapping(atmel_pioctrl->irq_domain, offset);
-}
-
 static struct gpio_chip atmel_gpio_chip = {
 	.direction_input        = atmel_gpio_direction_input,
 	.get                    = atmel_gpio_get,