diff options
author | Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com> | 2013-02-14 22:35:09 +0100 |
---|---|---|
committer | Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com> | 2013-03-15 13:33:39 +0100 |
commit | 934cb02bab9003bf65afe73e9146a1ea63b26c40 (patch) | |
tree | 4388d27ec6313aa85bf0f9829eb05fbf89dfae4b /drivers/pinctrl/sh-pfc/core.c | |
parent | 0b73ee5d534cc6dcb96efb9eac4cf96b40910911 (diff) | |
download | linux-934cb02bab9003bf65afe73e9146a1ea63b26c40.tar.gz linux-934cb02bab9003bf65afe73e9146a1ea63b26c40.tar.bz2 linux-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/core.c')
-rw-r--r-- | drivers/pinctrl/sh-pfc/core.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/drivers/pinctrl/sh-pfc/core.c b/drivers/pinctrl/sh-pfc/core.c index 9b5c0319eb77..667db99fb510 100644 --- a/drivers/pinctrl/sh-pfc/core.c +++ b/drivers/pinctrl/sh-pfc/core.c @@ -78,6 +78,11 @@ static void __iomem *sh_pfc_phys_to_virt(struct sh_pfc *pfc, return (void __iomem *)address; } +struct sh_pfc_pin *sh_pfc_get_pin(struct sh_pfc *pfc, unsigned int pin) +{ + return &pfc->info->pins[pin]; +} + static int sh_pfc_enum_in_range(pinmux_enum_t enum_id, struct pinmux_range *r) { if (enum_id < r->begin) @@ -278,7 +283,7 @@ static void sh_pfc_setup_data_regs(struct sh_pfc *pfc) void sh_pfc_get_data_reg(struct sh_pfc *pfc, unsigned gpio, struct pinmux_data_reg **drp, int *bitp) { - struct sh_pfc_pin *gpiop = &pfc->info->pins[gpio]; + struct sh_pfc_pin *gpiop = sh_pfc_get_pin(pfc, gpio); int k, n; k = (gpiop->flags & PINMUX_FLAG_DREG) >> PINMUX_FLAG_DREG_SHIFT; |