Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d7a7ca57 authored by Laurent Pinchart's avatar Laurent Pinchart
Browse files

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: default avatarLaurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Acked-by: default avatarLinus Walleij <linus.walleij@linaro.org>
parent 35ad4271
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -260,7 +260,7 @@ static void sh_pfc_setup_data_regs(struct sh_pfc *pfc)
	struct pinmux_data_reg *drp;
	int k;

	for (k = pfc->info->first_gpio; k <= pfc->info->last_gpio; k++)
	for (k = 0; k < pfc->info->nr_gpios; k++)
		sh_pfc_setup_data_reg(pfc, k);

	k = 0;
+4 −7
Original line number Diff line number Diff line
@@ -130,12 +130,10 @@ static void sh_pfc_gpio_setup(struct sh_pfc_chip *chip)
	gc->set = sh_gpio_set;
	gc->to_irq = sh_gpio_to_irq;

	WARN_ON(pfc->info->first_gpio != 0); /* needs testing */

	gc->label = pfc->info->name;
	gc->owner = THIS_MODULE;
	gc->base = pfc->info->first_gpio;
	gc->ngpio = (pfc->info->last_gpio - pfc->info->first_gpio) + 1;
	gc->base = 0;
	gc->ngpio = pfc->info->nr_gpios;
}

int sh_pfc_register_gpiochip(struct sh_pfc *pfc)
@@ -157,9 +155,8 @@ int sh_pfc_register_gpiochip(struct sh_pfc *pfc)

	pfc->gpio = chip;

	pr_info("%s handling gpio %d -> %d\n",
		pfc->info->name, pfc->info->first_gpio,
		pfc->info->last_gpio);
	pr_info("%s handling gpio 0 -> %u\n",
		pfc->info->name, pfc->info->nr_gpios - 1);

	return 0;
}
+2 −3
Original line number Diff line number Diff line
@@ -2597,10 +2597,9 @@ struct sh_pfc_soc_info r8a7740_pinmux_info = {
	.function	= { PINMUX_FUNCTION_BEGIN,
			    PINMUX_FUNCTION_END },

	.first_gpio	= GPIO_PORT0,
	.last_gpio	= GPIO_FN_TRACEAUD_FROM_MEMC,

	.gpios		= pinmux_gpios,
	.nr_gpios	= ARRAY_SIZE(pinmux_gpios),

	.cfg_regs	= pinmux_config_regs,
	.data_regs	= pinmux_data_regs,

+2 −3
Original line number Diff line number Diff line
@@ -2612,10 +2612,9 @@ struct sh_pfc_soc_info r8a7779_pinmux_info = {
	.mark = { PINMUX_MARK_BEGIN, PINMUX_MARK_END },
	.function = { PINMUX_FUNCTION_BEGIN, PINMUX_FUNCTION_END },

	.first_gpio = GPIO_GP_0_0,
	.last_gpio = GPIO_FN_SCK4_B,

	.gpios = pinmux_gpios,
	.nr_gpios = ARRAY_SIZE(pinmux_gpios),

	.cfg_regs = pinmux_config_regs,
	.data_regs = pinmux_data_regs,

+2 −3
Original line number Diff line number Diff line
@@ -1580,10 +1580,9 @@ struct sh_pfc_soc_info sh7203_pinmux_info = {
	.mark = { PINMUX_MARK_BEGIN, PINMUX_MARK_END },
	.function = { PINMUX_FUNCTION_BEGIN, PINMUX_FUNCTION_END },

	.first_gpio = GPIO_PA7,
	.last_gpio = GPIO_FN_LCD_DATA0,

	.gpios = pinmux_gpios,
	.nr_gpios = ARRAY_SIZE(pinmux_gpios),

	.cfg_regs = pinmux_config_regs,
	.data_regs = pinmux_data_regs,

Loading