Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 101606
b: refs/heads/master
c: 2145115
h: refs/heads/master
v: v3
  • Loading branch information
Anton Vorontsov authored and Paul Mackerras committed May 23, 2008
1 parent b6fbb8a commit 813cdf6
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 38 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 09e67ca2c523544e6b38aa570a5f62a0cf20b87b
refs/heads/master: 21451155d8858773ee764e9218de2ca0f4d6fc38
38 changes: 1 addition & 37 deletions trunk/drivers/of/gpio.c
Original file line number Diff line number Diff line change
Expand Up @@ -137,38 +137,6 @@ int of_gpio_simple_xlate(struct of_gpio_chip *of_gc, struct device_node *np,
}
EXPORT_SYMBOL(of_gpio_simple_xlate);

/* Should be sufficient for now, later we'll use dynamic bases. */
#if defined(CONFIG_PPC32) || defined(CONFIG_SPARC32)
#define GPIOS_PER_CHIP 32
#else
#define GPIOS_PER_CHIP 64
#endif

static int of_get_gpiochip_base(struct device_node *np)
{
struct device_node *gc = NULL;
int gpiochip_base = 0;

while ((gc = of_find_all_nodes(gc))) {
if (!of_get_property(gc, "gpio-controller", NULL))
continue;

if (gc != np) {
gpiochip_base += GPIOS_PER_CHIP;
continue;
}

of_node_put(gc);

if (gpiochip_base >= ARCH_NR_GPIOS)
return -ENOSPC;

return gpiochip_base;
}

return -ENOENT;
}

/**
* of_mm_gpiochip_add - Add memory mapped GPIO chip (bank)
* @np: device node of the GPIO chip
Expand Down Expand Up @@ -205,11 +173,7 @@ int of_mm_gpiochip_add(struct device_node *np,
if (!mm_gc->regs)
goto err1;

gc->base = of_get_gpiochip_base(np);
if (gc->base < 0) {
ret = gc->base;
goto err1;
}
gc->base = -1;

if (!of_gc->xlate)
of_gc->xlate = of_gpio_simple_xlate;
Expand Down

0 comments on commit 813cdf6

Please sign in to comment.