diff options
author | Alexandre Courbot <acourbot@nvidia.com> | 2013-02-02 11:29:24 -0500 |
---|---|---|
committer | Grant Likely <grant.likely@secretlab.ca> | 2013-02-09 04:20:12 -0500 |
commit | 1a989d0f1de8f5a150b35e1e8181cc1abc139162 (patch) | |
tree | 5d1a3b1009d2ec1ee84abf3d2a120a46b4748f87 /include | |
parent | 0fa2fd9a0d4f1305a54a396d44975894e90eed7b (diff) |
gpiolib: link all gpio_chips using a list
Add a list member to gpio_chip that allows all chips to be parsed
quickly. The current method requires parsing the entire GPIO integer
space, which is painfully slow. Using a list makes many chip operations
that involve lookup or parsing faster, and also simplifies the code. It
is also necessary to eventually get rid of the global gpio_desc[] array.
The list of gpio_chips is always ordered by base GPIO number to ensure
chips traversal is done in the right order.
Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
Diffstat (limited to 'include')
-rw-r--r-- | include/asm-generic/gpio.h | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/include/asm-generic/gpio.h b/include/asm-generic/gpio.h index 2034e691c7ab..b562f95cdc2f 100644 --- a/include/asm-generic/gpio.h +++ b/include/asm-generic/gpio.h | |||
@@ -53,6 +53,7 @@ struct device_node; | |||
53 | * @label: for diagnostics | 53 | * @label: for diagnostics |
54 | * @dev: optional device providing the GPIOs | 54 | * @dev: optional device providing the GPIOs |
55 | * @owner: helps prevent removal of modules exporting active GPIOs | 55 | * @owner: helps prevent removal of modules exporting active GPIOs |
56 | * @list: links gpio_chips together for traversal | ||
56 | * @request: optional hook for chip-specific activation, such as | 57 | * @request: optional hook for chip-specific activation, such as |
57 | * enabling module power and clock; may sleep | 58 | * enabling module power and clock; may sleep |
58 | * @free: optional hook for chip-specific deactivation, such as | 59 | * @free: optional hook for chip-specific deactivation, such as |
@@ -98,6 +99,7 @@ struct gpio_chip { | |||
98 | const char *label; | 99 | const char *label; |
99 | struct device *dev; | 100 | struct device *dev; |
100 | struct module *owner; | 101 | struct module *owner; |
102 | struct list_head list; | ||
101 | 103 | ||
102 | int (*request)(struct gpio_chip *chip, | 104 | int (*request)(struct gpio_chip *chip, |
103 | unsigned offset); | 105 | unsigned offset); |