pinctrl: mcp23s08: debugfs: Do not restore the INTF register
authorJan Kundrát <jan.kundrat@cesnet.cz>
Tue, 20 Feb 2018 18:04:47 +0000 (19:04 +0100)
committerLinus Walleij <linus.walleij@linaro.org>
Mon, 18 Jun 2018 05:56:05 +0000 (07:56 +0200)
commit7547b5969e069520d4cf23ba43b4ac889f8bd0ef
treea5c72cb29b68000765cc1e601077e461f1c5e425
parent6ff45566554ace49f8db45734dc6ce59e02487f5
pinctrl: mcp23s08: debugfs: Do not restore the INTF register

Apart from the usual stuff, the debugfs code is currently also used for
one non-obvious side effect. It attempts to check whether the chip's
registers are still set to an expected value, and if not, re-initializes
them. It seems that the driver has "always" done so.

The code, however, also checks the INTF register which normally
indicates which pins have caused the recent interrupt. That's a volatile
register, and the datasheet says that writes are ignored in there.

When I'm just cat-ing /sys/kernel/debug/gpio with no SPI traffic and no
nosie on the GPIO lines, I'm not getting any warnings. Once I actually
use these GPIOs and cat that file in parallel, I always seem to get a:

  mcp23s08 spi1.1: restoring reg 0x07 from 0x0000 to 0xffff (power-loss?)

This might be a sign that I should not leave my unused inputs floating,
but the code should not be checking a volatile register, anyway. Let's
simply skip this last item in the iteration. I was also considering
removing this enitre re-initialization because it's non-obvious, but the
code survived various refactorings already and has sign-offs by people
who know more than I do, so let's leave it as-is. For now :).

Signed-off-by: Jan Kundrát <jan.kundrat@cesnet.cz>
Reviewed-by: Phil Reid <preid@electromag.com.au>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
drivers/pinctrl/pinctrl-mcp23s08.c