All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] pinctrl: mcp23s08: fix interrupt handling regression
@ 2017-10-18 14:21 ` Dmitry Mastykin
  0 siblings, 0 replies; 4+ messages in thread
From: Dmitry Mastykin @ 2017-10-18 14:21 UTC (permalink / raw)
  Cc: mastichi, sebastian.reichel, preid, Linus Walleij, linux-gpio,
	linux-kernel

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")
Tested-by: Phil Reid <preid@electromag.com.au>
Signed-off-by: Dmitry Mastykin <mastichi@gmail.com>
---
 drivers/pinctrl/pinctrl-mcp23s08.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/pinctrl/pinctrl-mcp23s08.c b/drivers/pinctrl/pinctrl-mcp23s08.c
index 3e40d42..9c950bbf 100644
--- a/drivers/pinctrl/pinctrl-mcp23s08.c
+++ b/drivers/pinctrl/pinctrl-mcp23s08.c
@@ -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;
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH v2] pinctrl: mcp23s08: fix interrupt handling regression
@ 2017-10-18 14:21 ` Dmitry Mastykin
  0 siblings, 0 replies; 4+ messages in thread
From: Dmitry Mastykin @ 2017-10-18 14:21 UTC (permalink / raw)
  Cc: mastichi, sebastian.reichel, preid, Linus Walleij, linux-gpio,
	linux-kernel

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")
Tested-by: Phil Reid <preid@electromag.com.au>
Signed-off-by: Dmitry Mastykin <mastichi@gmail.com>
---
 drivers/pinctrl/pinctrl-mcp23s08.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/pinctrl/pinctrl-mcp23s08.c b/drivers/pinctrl/pinctrl-mcp23s08.c
index 3e40d42..9c950bbf 100644
--- a/drivers/pinctrl/pinctrl-mcp23s08.c
+++ b/drivers/pinctrl/pinctrl-mcp23s08.c
@@ -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;
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH v2] pinctrl: mcp23s08: fix interrupt handling regression
  2017-10-18 14:21 ` Dmitry Mastykin
  (?)
@ 2017-10-18 17:00 ` Sebastian Reichel
  -1 siblings, 0 replies; 4+ messages in thread
From: Sebastian Reichel @ 2017-10-18 17:00 UTC (permalink / raw)
  To: Dmitry Mastykin; +Cc: preid, Linus Walleij, linux-gpio, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 1203 bytes --]

Hi,

On Wed, Oct 18, 2017 at 05:21:02PM +0300, Dmitry Mastykin wrote:
> 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")
> Tested-by: Phil Reid <preid@electromag.com.au>
> Signed-off-by: Dmitry Mastykin <mastichi@gmail.com>

Reviewed-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>

-- Sebastian

> ---
>  drivers/pinctrl/pinctrl-mcp23s08.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/pinctrl/pinctrl-mcp23s08.c b/drivers/pinctrl/pinctrl-mcp23s08.c
> index 3e40d42..9c950bbf 100644
> --- a/drivers/pinctrl/pinctrl-mcp23s08.c
> +++ b/drivers/pinctrl/pinctrl-mcp23s08.c
> @@ -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;
> -- 
> 2.7.4
> 

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v2] pinctrl: mcp23s08: fix interrupt handling regression
  2017-10-18 14:21 ` Dmitry Mastykin
  (?)
  (?)
@ 2017-10-19  8:20 ` Linus Walleij
  -1 siblings, 0 replies; 4+ messages in thread
From: Linus Walleij @ 2017-10-19  8:20 UTC (permalink / raw)
  To: Dmitry Mastykin; +Cc: Sebastian Reichel, Phil Reid, linux-gpio, linux-kernel

On Wed, Oct 18, 2017 at 4:21 PM, Dmitry Mastykin <mastichi@gmail.com> wrote:

> 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")
> Tested-by: Phil Reid <preid@electromag.com.au>
> Signed-off-by: Dmitry Mastykin <mastichi@gmail.com>

Patch applied for fixes, adding Sebastians review tag.

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2017-10-19  8:20 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-10-18 14:21 [PATCH v2] pinctrl: mcp23s08: fix interrupt handling regression Dmitry Mastykin
2017-10-18 14:21 ` Dmitry Mastykin
2017-10-18 17:00 ` Sebastian Reichel
2017-10-19  8:20 ` Linus Walleij

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.