• Bamvor Jian Zhang's avatar
    gpiolib: improve overlap check of range of gpio · ef7c7553
    Bamvor Jian Zhang authored
    There are limitations for the current checker:
    1.  Could not check the overlap if the new gpiochip is the secondly
        gpiochip.
    2.  Could not check the overlap if the new gpiochip is overlap
        with the left of gpiochip. E.g. if we insert [c, d] between
        [a,b] and [e, f], and e >= c + d, it will successful even if
        c < a + b.
    3.  Allow overlap of base of different gpiochip.
    
    This patch fix these issues by checking the overlap of both right and
    left gpiochip in the same loop statement.
    Signed-off-by: default avatarBamvor Jian Zhang <bamvor.zhangjian@linaro.org>
    [Tweaked to remove unnecessary ret variable]
    Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
    ef7c7553
gpiolib.c 68.4 KB