Skip to contentSkip to conversation

pinctrl: mcp23s08: fix interrupt handling regression

PATCH In review Dmitry Mastykin 3 participants 3 messages Oct 18, 2017 – Oct 19, 2017

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 pinctrl: mcp23s08: fix interrupt handling regression

interrupt handling was broken with conversion to using regmap caching. cached_gpio value was updated by boolean status instead of gpio reading.

Fixes 8f38910ba4f6 ("pinctrl: mcp23s08: switch to regmap caching")
---
 drivers/pinctrl/pinctrl-mcp23s08.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/pinctrl/pinctrl-mcp23s08.c +3 -3
index 3e40d42..9c950bbf 100644
@@ -407,10 +407,10 @@ static int mcp23s08_get(struct gpio_chip *chip, unsigned offset)
 	ret = mcp_read(mcp, MCP_GPIO, &status);
 	if (ret < 0)
 		status = 0;
-	else
+	else {
+		mcp->cached_gpio = status;
 		status = !!(status & (1 << offset));
-
-	mcp->cached_gpio = status;
+	}
 
 	mutex_unlock(&mcp->lock);
 	return status;
Signature · 1 line
2.7.4
Reviewed-by on v2 1/1
#1 lore raw

Hi,

Quoted 6 lines · Dmitry Mastykin

interrupt handling was broken with conversion to using regmap caching. cached_gpio value was updated by boolean status instead of gpio reading.

Fixes 8f38910ba4f6 ("pinctrl: mcp23s08: switch to regmap caching")

-- Sebastian

Quoted 25 lines
---
 drivers/pinctrl/pinctrl-mcp23s08.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/pinctrl/pinctrl-mcp23s08.c +3 -3
index 3e40d42..9c950bbf 100644
@@ -407,10 +407,10 @@ static int mcp23s08_get(struct gpio_chip *chip, unsigned offset)
 	ret = mcp_read(mcp, MCP_GPIO, &status);
 	if (ret < 0)
 		status = 0;
-	else
+	else {
+		mcp->cached_gpio = status;
 		status = !!(status & (1 << offset));
-
-	mcp->cached_gpio = status;
+	}
 
 	mutex_unlock(&mcp->lock);
 	return status;
Signature · 1 line
2.7.4