[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CACRpkdZDtJ3AN+Pgxy9nNgVx_YYTC=7AuDC48w7kDbDAeqdufw@mail.gmail.com>
Date: Tue, 5 Feb 2013 18:00:56 +0100
From: Linus Walleij <linus.walleij@...aro.org>
To: Alexandre Courbot <acourbot@...dia.com>
Cc: Grant Likely <grant.likely@...retlab.ca>,
Arnd Bergmann <arnd@...db.de>, linux-arch@...r.kernel.org,
linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org,
gnurou@...il.com
Subject: Re: [PATCH 1/9] gpiolib: link all gpio_chips using a list
On Sat, Feb 2, 2013 at 5:29 PM, Alexandre Courbot <acourbot@...dia.com> wrote:
> 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@...dia.com>
OK!
> + * Return -EBUSY if the new chip overlaps with some other chip's integer
> + * space.
(...)
> + /* are we stepping on the chip right before? */
> + if (pos != &gpio_chips && pos->prev != &gpio_chips) {
> + _chip = list_entry(pos->prev, struct gpio_chip, list);
> + if (_chip->base + _chip->ngpio > chip->base) {
> + dev_err(chip->dev,
> + "GPIO integer space overlap, cannot add chip\n");
> + err = -EBUSY;
> + }
> + }
This robustness change on its own is a merit for merging the patch.
And keeping a list of gpiochips available is great for stuff like
debugfs.
Reviewed-by: Linus Walleij <linus.walleij@...aro.org>
Yours,
Linus Walleij
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists