pinctrl: spear: use new pinctrl GPIO helpers
Replace the pinctrl helpers taking the global GPIO number as argument with the improved variants that instead take a pointer to the GPIO chip and the controller-relative offset. Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org> Acked-by: Viresh Kumar <viresh.kumar@linaro.org> Acked-by: Linus Walleij <linus.walleij@linaro.org>
This commit is contained in:
@@ -204,14 +204,13 @@ static void plgpio_set_value(struct gpio_chip *chip, unsigned offset, int value)
|
||||
static int plgpio_request(struct gpio_chip *chip, unsigned offset)
|
||||
{
|
||||
struct plgpio *plgpio = gpiochip_get_data(chip);
|
||||
int gpio = chip->base + offset;
|
||||
unsigned long flags;
|
||||
int ret = 0;
|
||||
|
||||
if (offset >= chip->ngpio)
|
||||
return -EINVAL;
|
||||
|
||||
ret = pinctrl_gpio_request(gpio);
|
||||
ret = pinctrl_gpio_request_new(chip, offset);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
@@ -249,14 +248,13 @@ err1:
|
||||
if (!IS_ERR(plgpio->clk))
|
||||
clk_disable(plgpio->clk);
|
||||
err0:
|
||||
pinctrl_gpio_free(gpio);
|
||||
pinctrl_gpio_free_new(chip, offset);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void plgpio_free(struct gpio_chip *chip, unsigned offset)
|
||||
{
|
||||
struct plgpio *plgpio = gpiochip_get_data(chip);
|
||||
int gpio = chip->base + offset;
|
||||
unsigned long flags;
|
||||
|
||||
if (offset >= chip->ngpio)
|
||||
@@ -280,7 +278,7 @@ disable_clk:
|
||||
if (!IS_ERR(plgpio->clk))
|
||||
clk_disable(plgpio->clk);
|
||||
|
||||
pinctrl_gpio_free(gpio);
|
||||
pinctrl_gpio_free_new(chip, offset);
|
||||
}
|
||||
|
||||
/* PLGPIO IRQ */
|
||||
|
||||
Reference in New Issue
Block a user