]> asedeno.scripts.mit.edu Git - linux.git/commit
pinctrl: sunxi: Fix and simplify pin bank regulator handling
authorChen-Yu Tsai <wens@csie.org>
Sun, 13 Jan 2019 09:57:22 +0000 (17:57 +0800)
committerLinus Walleij <linus.walleij@linaro.org>
Mon, 14 Jan 2019 15:09:27 +0000 (16:09 +0100)
commitdc14455841773df52b15a17b36d01a26745f212b
tree81a10c9d247a61d571a080b0504dd46d532d24fe
parent2d2d478576d71000b29c52668c5712c825ee9af8
pinctrl: sunxi: Fix and simplify pin bank regulator handling

The new per-pin-bank regulator handling code in the sunxi pinctrl driver
has mismatched conditions for enabling and disabling the regulator: it
is enabled each time a pin is requested, but only disabled when the
pin-bank's reference count reaches zero.

Since we are doing reference counting already, there's no need to enable
the regulator each time a pin is requested. Instead we can just do it
for the first requested pin of each pin-bank. Thus we can reverse the
test and bail out early if it's not the first occurrence.

Fixes: 9a2a566adb00 ("pinctrl: sunxi: Deal with per-bank regulators")
Acked-by: Maxime Ripard <maxime.ripard@bootlin.com>
Signed-off-by: Chen-Yu Tsai <wens@csie.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
drivers/pinctrl/sunxi/pinctrl-sunxi.c