From d7a7ca5781fa2ac40319acc7125c487db5b26d91 Mon Sep 17 00:00:00 2001 From: Laurent Pinchart Date: Wed, 28 Nov 2012 17:51:00 +0100 Subject: sh-pfc: Replace first_gpio and last_gpio with nr_gpios The SoC information first_gpio field is always equal to 0, and the last_gpio field is the index of the last entry in the pinmux_gpios array. Replace the first_gpio and last_gpio fields by a nr_gpios field, and initialize it to ARRAY_SIZE(pinmux_gpios). Signed-off-by: Laurent Pinchart Acked-by: Linus Walleij --- drivers/pinctrl/sh-pfc/pinctrl.c | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) (limited to 'drivers/pinctrl/sh-pfc/pinctrl.c') diff --git a/drivers/pinctrl/sh-pfc/pinctrl.c b/drivers/pinctrl/sh-pfc/pinctrl.c index 4ce2753cb2df..908b5362b1cd 100644 --- a/drivers/pinctrl/sh-pfc/pinctrl.c +++ b/drivers/pinctrl/sh-pfc/pinctrl.c @@ -336,7 +336,7 @@ static int sh_pfc_map_gpios(struct sh_pfc *pfc, struct sh_pfc_pinctrl *pmx) { int i; - pmx->nr_pads = pfc->info->last_gpio - pfc->info->first_gpio + 1; + pmx->nr_pads = pfc->info->nr_gpios; pmx->pads = devm_kzalloc(pfc->dev, sizeof(*pmx->pads) * pmx->nr_pads, GFP_KERNEL); @@ -345,17 +345,11 @@ static int sh_pfc_map_gpios(struct sh_pfc *pfc, struct sh_pfc_pinctrl *pmx) return -ENOMEM; } - /* - * We don't necessarily have a 1:1 mapping between pin and linux - * GPIO number, as the latter maps to the associated enum_id. - * Care needs to be taken to translate back to pin space when - * dealing with any pin configurations. - */ for (i = 0; i < pmx->nr_pads; i++) { struct pinctrl_pin_desc *pin = pmx->pads + i; struct pinmux_gpio *gpio = pfc->info->gpios + i; - pin->number = pfc->info->first_gpio + i; + pin->number = i; pin->name = gpio->name; /* XXX */ @@ -421,9 +415,9 @@ int sh_pfc_register_pinctrl(struct sh_pfc *pfc) pmx->range.name = DRV_NAME, pmx->range.id = 0; - pmx->range.npins = pfc->info->last_gpio - pfc->info->first_gpio + 1; - pmx->range.base = pfc->info->first_gpio; - pmx->range.pin_base = pfc->info->first_gpio; + pmx->range.npins = pfc->info->nr_gpios; + pmx->range.base = 0; + pmx->range.pin_base = 0; pinctrl_add_gpio_range(pmx->pctl, &pmx->range); -- cgit v1.2.3