aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pinctrl/sh-pfc/gpio.c
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>2013-02-14 22:35:09 +0100
committerLaurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>2013-03-15 13:33:39 +0100
commit934cb02bab9003bf65afe73e9146a1ea63b26c40 (patch)
tree4388d27ec6313aa85bf0f9829eb05fbf89dfae4b /drivers/pinctrl/sh-pfc/gpio.c
parentsh-pfc: Simplify the sh_pfc_gpio_is_pin() logic (diff)
downloadlinux-dev-934cb02bab9003bf65afe73e9146a1ea63b26c40.tar.xz
linux-dev-934cb02bab9003bf65afe73e9146a1ea63b26c40.zip
sh-pfc: Add function to retrieve a pin instance from its pin number
This prepares support for sparse pin numbering. The function currently just performs and indexed lookup in the pins array. Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com> Acked-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'drivers/pinctrl/sh-pfc/gpio.c')
-rw-r--r--drivers/pinctrl/sh-pfc/gpio.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/pinctrl/sh-pfc/gpio.c b/drivers/pinctrl/sh-pfc/gpio.c
index db9af4e548a0..45090d8381a2 100644
--- a/drivers/pinctrl/sh-pfc/gpio.c
+++ b/drivers/pinctrl/sh-pfc/gpio.c
@@ -43,8 +43,9 @@ static struct sh_pfc *gpio_to_pfc(struct gpio_chip *gc)
static int gpio_pin_request(struct gpio_chip *gc, unsigned offset)
{
struct sh_pfc *pfc = gpio_to_pfc(gc);
+ struct sh_pfc_pin *pin = sh_pfc_get_pin(pfc, offset);
- if (pfc->info->pins[offset].enum_id == 0)
+ if (pin->enum_id == 0)
return -EINVAL;
return pinctrl_request_gpio(offset);