Skip to content

Commit 2e539b7

Browse files
Tom RixBartosz Golaszewski
authored andcommitted
gpio: tegra186: remove unneeded loop in tegra186_gpio_init_route_mapping()
Reviewing the j loop over num_irqs_per_bank, in the code previous to the fixes: commit, every j was used. now only when j == 0. If only j == 0 is used, there is no need for the loop. Fixes: 2103868 ("gpio: tegra186: Support multiple interrupts per bank") Signed-off-by: Tom Rix <[email protected]> Acked-by: Thierry Reding <[email protected]> Signed-off-by: Bartosz Golaszewski <[email protected]>
1 parent eed5a3b commit 2e539b7

File tree

1 file changed

+18
-22
lines changed

1 file changed

+18
-22
lines changed

drivers/gpio/gpio-tegra186.c

Lines changed: 18 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -677,7 +677,7 @@ static const struct of_device_id tegra186_pmc_of_match[] = {
677677
static void tegra186_gpio_init_route_mapping(struct tegra_gpio *gpio)
678678
{
679679
struct device *dev = gpio->gpio.parent;
680-
unsigned int i, j;
680+
unsigned int i;
681681
u32 value;
682682

683683
for (i = 0; i < gpio->soc->num_ports; i++) {
@@ -699,27 +699,23 @@ static void tegra186_gpio_init_route_mapping(struct tegra_gpio *gpio)
699699
* On Tegra194 and later, each pin can be routed to one or more
700700
* interrupts.
701701
*/
702-
for (j = 0; j < gpio->num_irqs_per_bank; j++) {
703-
dev_dbg(dev, "programming default interrupt routing for port %s\n",
704-
port->name);
705-
706-
offset = TEGRA186_GPIO_INT_ROUTE_MAPPING(p, j);
707-
708-
/*
709-
* By default we only want to route GPIO pins to IRQ 0. This works
710-
* only under the assumption that we're running as the host kernel
711-
* and hence all GPIO pins are owned by Linux.
712-
*
713-
* For cases where Linux is the guest OS, the hypervisor will have
714-
* to configure the interrupt routing and pass only the valid
715-
* interrupts via device tree.
716-
*/
717-
if (j == 0) {
718-
value = readl(base + offset);
719-
value = BIT(port->pins) - 1;
720-
writel(value, base + offset);
721-
}
722-
}
702+
dev_dbg(dev, "programming default interrupt routing for port %s\n",
703+
port->name);
704+
705+
offset = TEGRA186_GPIO_INT_ROUTE_MAPPING(p, 0);
706+
707+
/*
708+
* By default we only want to route GPIO pins to IRQ 0. This works
709+
* only under the assumption that we're running as the host kernel
710+
* and hence all GPIO pins are owned by Linux.
711+
*
712+
* For cases where Linux is the guest OS, the hypervisor will have
713+
* to configure the interrupt routing and pass only the valid
714+
* interrupts via device tree.
715+
*/
716+
value = readl(base + offset);
717+
value = BIT(port->pins) - 1;
718+
writel(value, base + offset);
723719
}
724720
}
725721
}

0 commit comments

Comments
 (0)