pinctrl: rockchip: Simplify pin_to_bank equation
Subsystems (2)
PATCH 1/1 pinctrl: rockchip: Simplify pin_to_bank equation
If (b->pin_base + b->nr_pins - 1) < pin is true, pin >= b->pin_base is always true because b->nr_pins is never less than 0.
Thus this patch simplify the equation.
Signed-off-by Axel Lin <[email protected]>
--- drivers/pinctrl/pinctrl-rockchip.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/pinctrl/pinctrl-rockchip.c +1 -2
@@ -186,8 +186,7 @@ static struct rockchip_pin_bank *pin_to_bank(struct rockchip_pinctrl *info, {struct rockchip_pin_bank *b = info->ctrl->pin_banks; -while ((pin >= b->pin_base) && - ((b->pin_base + b->nr_pins -1 ) < pin)) +while (pin >= (b->pin_base + b->nr_pins)) b++;return b;
Signature · 1 line
1.8.1.2
Am Freitag, 23. August 2013, 09:49:00 schrieb Axel Lin:
Quoted 5 lines
If (
b->pin_base+b->nr_pins- 1) < pin is true, pin >=b->pin_baseis always true becauseb->nr_pinsis never less than 0.
Thus this patch simplify the equation.Signed-off-by Axel Lin <[email protected]>
Acked-by Heiko Stuebner <[email protected]>
Quoted 18 lines
--- drivers/pinctrl/pinctrl-rockchip.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)(quoted diff) +0
-0
b/drivers/pinctrl/pinctrl-rockchip.cindex 319a64a..ea27806 100644drivers/pinctrl/pinctrl-rockchip.c +1
-2@@ -186,8 +186,7 @@ static struct rockchip_pin_bank *pin_to_bank(struct rockchip_pinctrl *info, {struct rockchip_pin_bank *b = info->ctrl->pin_banks; -while ((pin >= b->pin_base) && - ((b->pin_base + b->nr_pins -1 ) < pin)) +while (pin >= (b->pin_base + b->nr_pins)) b++;return b;
Quoted 5 lines · Axel Lin
If (
b->pin_base+b->nr_pins- 1) < pin is true, pin >=b->pin_baseis always true becauseb->nr_pinsis never less than 0.
Thus this patch simplify the equation.Signed-off-by Axel Lin <[email protected]>
Patch applied with Heiko's ACK.
Yours,
Linus Walleij