提交 96098df1 编写于 作者: J Julien Grossholtz 提交者: Linus Walleij

gpiolib: fix chip order in gpio list

In some situations the gpio_list order is not correct.
As a consequence gpiochip_find_base returns the same
base number twice. This happens when a first ship is added
with manual base number, then other ships are added using
automatic base number.

To prevent this behaviour, this patch add the new chip after
the last element of the gpio list.
Signed-off-by: NJulien Grossholtz <julien.grossholtz@savoirfairelinux.com>
Signed-off-by: NLinus Walleij <linus.walleij@linaro.org>
上级 78179989
......@@ -226,8 +226,10 @@ static int gpiochip_add_to_list(struct gpio_chip *chip)
*/
iterator = list_last_entry(&gpio_chips, struct gpio_chip, list);
if (iterator->base + iterator->ngpio <= chip->base)
goto found;
if (iterator->base + iterator->ngpio <= chip->base) {
list_add(&chip->list, &iterator->list);
return 0;
}
dev_err(chip->parent,
"GPIO integer space overlap, cannot add chip\n");
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册