From: Alexandre Courbot <acourbot@nvidia.com>
To: Grant Likely <grant.likely@secretlab.ca>,
Linus Walleij <linus.walleij@linaro.org>,
Arnd Bergmann <arnd@arndb.de>
Cc: linux-arch@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org, gnurou@gmail.com,
Alexandre Courbot <acourbot@nvidia.com>
Subject: [PATCH 0/9] gpiolib: remove gpio_desc[] static array
Date: Sun, 3 Feb 2013 01:29:23 +0900 [thread overview]
Message-ID: <1359822572-26009-2-git-send-email-acourbot@nvidia.com> (raw)
In-Reply-To: <1359822572-26009-1-git-send-email-acourbot@nvidia.com>
Since Linus kindly merged the gpiochip_reserve() removal patches, here comes the
main course.
This series removes the ARCH_NR_GPIOS sized static array of GPIO descriptors
that stood in gpiolib and replaces it with a more flexible mechanism that
dynamically allocates GPIO descriptors as chips are added.
ARCH_NR_GPIOS is still here, but now only controls the upper limit of the GPIO
integer space, i.e. which GPIO numbers are valid and where GPIO chips without a
base GPIO are placed in the GPIO space. Technically it would be possible to get
rid of it completely - but this might change GPIO numbers on some architectures
and make people unhappy. At least it can now be arbitrarily high without
consuming more memory.
As a result of this series, gpiolib has a slightly lower memory footprint (~-9KB
on my Tegra2 board which has a GPIO space of 1024 but only uses 232 of them), is
very slightly slower (because of the gpio to descriptor conversion which is
linear instead of being constant), and (most importantly) is prepared to receive
the new descriptor-based public GPIO interface.
The linear-time conversion between GPIO numbers and descriptors might make some
teeth grind, but please consider the following. First, even though the
conversion is O(n), this is a very small n (the number of GPIO chips), and I
doubt the overhead would be even perceptible. Second, the gpio descriptor
interface that will follow this series will not require this conversion since it
works with descriptors directly. Finally, the GPIO framework allow platforms
that are concerned about performance to implement gpio_get_value() and
gpio_set_value() with a fast path shortcutting gpiolib for those GPIO numbers
for which performance matters, and this is not affected at all by this series.
The patches are split as much as possible to make the switch as easy to follow
as possible - they may actually be oversplit, if this is the case please let me
know and I will resubmit the series.
This has been tested on a Tegra 2 Ventana board. I made sure that debugfs and
sysfs were working as before, and that GPIOs had the expected value. Being a
rather deep change, it should certainly undergo some more testing.
Alexandre Courbot (9):
gpiolib: link all gpio_chips using a list
gpiolib: use gpio_chips list in gpiolib_sysfs_init
gpiolib: use gpio_chips list in gpiochip_find
gpiolib: use gpio_chips list in sysfs ops
gpiolib: use gpio_chips list in gpiochip_find_base
gpiolib: use descriptors internally
gpiolib: let gpio_chip reference its descriptors
gpiolib: use gpio_chips list in gpio_to_desc
gpiolib: dynamically allocate descriptors array
drivers/gpio/gpiolib.c | 694 ++++++++++++++++++++++++++++-----------------
include/asm-generic/gpio.h | 5 +
2 files changed, 440 insertions(+), 259 deletions(-)
--
1.8.1.1
next prev parent reply other threads:[~2013-02-02 16:27 UTC|newest]
Thread overview: 63+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-02-02 16:29 [PATCH 0/9] gpiolib: remove gpio_desc[] static array Alexandre Courbot
2013-02-02 16:29 ` Alexandre Courbot [this message]
2013-02-02 16:29 ` [PATCH 1/9] gpiolib: link all gpio_chips using a list Alexandre Courbot
2013-02-02 16:29 ` Alexandre Courbot
2013-02-05 17:00 ` Linus Walleij
2013-02-09 9:20 ` Grant Likely
2013-02-09 9:20 ` Grant Likely
2013-02-02 16:29 ` [PATCH 2/9] gpiolib: use gpio_chips list in gpiolib_sysfs_init Alexandre Courbot
2013-02-02 16:29 ` Alexandre Courbot
2013-02-05 17:04 ` Linus Walleij
2013-02-09 9:22 ` Grant Likely
2013-02-09 9:22 ` Grant Likely
2013-02-02 16:29 ` [PATCH 3/9] gpiolib: use gpio_chips list in gpiochip_find Alexandre Courbot
2013-02-02 16:29 ` Alexandre Courbot
2013-02-05 17:05 ` Linus Walleij
2013-02-09 9:25 ` Grant Likely
2013-02-09 9:25 ` Grant Likely
2013-02-02 16:29 ` [PATCH 4/9] gpiolib: use gpio_chips list in sysfs ops Alexandre Courbot
2013-02-02 16:29 ` Alexandre Courbot
2013-02-05 17:15 ` Linus Walleij
2013-02-05 17:15 ` Linus Walleij
2013-02-09 9:37 ` Grant Likely
2013-02-09 9:37 ` Grant Likely
2013-02-09 13:53 ` Alexandre Courbot
2013-02-02 16:29 ` [PATCH 5/9] gpiolib: use gpio_chips list in gpiochip_find_base Alexandre Courbot
2013-02-02 16:29 ` Alexandre Courbot
2013-02-05 17:21 ` Linus Walleij
2013-02-06 4:48 ` Alex Courbot
2013-02-09 9:47 ` Grant Likely
2013-02-09 9:47 ` Grant Likely
2013-02-02 16:29 ` [PATCH 6/9] gpiolib: use descriptors internally Alexandre Courbot
2013-02-02 16:29 ` Alexandre Courbot
2013-02-05 17:53 ` Linus Walleij
2013-02-07 6:57 ` Alexandre Courbot
2013-02-09 9:17 ` Grant Likely
2013-02-09 9:17 ` Grant Likely
2013-02-11 14:09 ` Linus Walleij
2013-02-11 15:40 ` Paul Mundt
2013-02-11 15:40 ` Paul Mundt
2013-02-11 17:39 ` Stephen Warren
2013-02-12 12:29 ` Linus Walleij
2013-02-12 15:59 ` Paul Mundt
2013-02-12 17:18 ` Arnd Bergmann
2013-02-09 13:11 ` Grant Likely
2013-02-09 13:11 ` Grant Likely
2013-02-09 14:15 ` Alexandre Courbot
2013-02-09 13:24 ` Grant Likely
2013-02-09 13:24 ` Grant Likely
2013-02-09 14:18 ` Alexandre Courbot
2013-02-02 16:29 ` [PATCH 7/9] gpiolib: let gpio_chip reference its descriptors Alexandre Courbot
2013-02-05 18:00 ` Linus Walleij
2013-02-09 13:28 ` Grant Likely
2013-02-02 16:29 ` [PATCH 8/9] gpiolib: use gpio_chips list in gpio_to_desc Alexandre Courbot
2013-02-05 18:01 ` Linus Walleij
2013-02-05 18:01 ` Linus Walleij
2013-02-09 9:58 ` Grant Likely
2013-02-09 9:58 ` Grant Likely
2013-02-09 14:21 ` Alexandre Courbot
2013-02-09 14:21 ` Alexandre Courbot
2013-02-09 14:37 ` Grant Likely
2013-02-02 16:29 ` [PATCH 9/9] gpiolib: dynamically allocate descriptors array Alexandre Courbot
2013-02-02 16:29 ` Alexandre Courbot
2013-02-05 18:02 ` Linus Walleij
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1359822572-26009-2-git-send-email-acourbot@nvidia.com \
--to=acourbot@nvidia.com \
--cc=arnd@arndb.de \
--cc=gnurou@gmail.com \
--cc=grant.likely@secretlab.ca \
--cc=linus.walleij@linaro.org \
--cc=linux-arch@vger.kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).