linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] at86rf230: Allow slow GPIO pins for "rstn"
@ 2016-12-18 23:25 Andrey Smirnov
  2016-12-21 12:30 ` Nikita Yushchenko
  2016-12-21 13:11 ` [PATCH] " Stefan Schmidt
  0 siblings, 2 replies; 4+ messages in thread
From: Andrey Smirnov @ 2016-12-18 23:25 UTC (permalink / raw)
  To: linux-wpan
  Cc: Andrey Smirnov, Alexander Aring, netdev, linux-kernel, Chris Healy

Driver code never touches "rstn" signal in atomic context, so there's
no need to implicitly put such restriction on it by using gpio_set_value
to manipulate it. Replace gpio_set_value to gpio_set_value_cansleep to
fix that.

As a an example of where such restriction might be inconvenient,
consider a hardware design where "rstn" is connected to a pin of I2C/SPI
GPIO expander chip.

Cc: Chris Healy <cphealy@gmail.com>
Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
---
 drivers/net/ieee802154/at86rf230.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ieee802154/at86rf230.c b/drivers/net/ieee802154/at86rf230.c
index 9f10da6..7700690 100644
--- a/drivers/net/ieee802154/at86rf230.c
+++ b/drivers/net/ieee802154/at86rf230.c
@@ -1710,9 +1710,9 @@ static int at86rf230_probe(struct spi_device *spi)
 	/* Reset */
 	if (gpio_is_valid(rstn)) {
 		udelay(1);
-		gpio_set_value(rstn, 0);
+		gpio_set_value_cansleep(rstn, 0);
 		udelay(1);
-		gpio_set_value(rstn, 1);
+		gpio_set_value_cansleep(rstn, 1);
 		usleep_range(120, 240);
 	}
 
-- 
2.5.5

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

* Re: at86rf230: Allow slow GPIO pins for "rstn"
  2016-12-18 23:25 [PATCH] at86rf230: Allow slow GPIO pins for "rstn" Andrey Smirnov
@ 2016-12-21 12:30 ` Nikita Yushchenko
  2016-12-21 13:11 ` [PATCH] " Stefan Schmidt
  1 sibling, 0 replies; 4+ messages in thread
From: Nikita Yushchenko @ 2016-12-21 12:30 UTC (permalink / raw)
  To: linux-wpan
  Cc: Andrey Smirnov, Alexander Aring, netdev, linux-kernel,
	Chris Healy, Nikita Yushchenko

> Driver code never touches "rstn" signal in atomic context, so there's
> no need to implicitly put such restriction on it by using gpio_set_value
> to manipulate it. Replace gpio_set_value to gpio_set_value_cansleep to
> fix that.
> 
> As a an example of where such restriction might be inconvenient,
> consider a hardware design where "rstn" is connected to a pin of I2C/SPI
> GPIO expander chip.
> 
> Cc: Chris Healy <cphealy@gmail.com>
> Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>

Reviewed-by: Nikita Yushchenko <nikita.yoush@cogentembedded.com>

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

* Re: [PATCH] at86rf230: Allow slow GPIO pins for "rstn"
  2016-12-18 23:25 [PATCH] at86rf230: Allow slow GPIO pins for "rstn" Andrey Smirnov
  2016-12-21 12:30 ` Nikita Yushchenko
@ 2016-12-21 13:11 ` Stefan Schmidt
       [not found]   ` <CAFXsbZpgiTM2qngYERVpfXHvePW8M8DN91YnZwc-voKO=FDUUA@mail.gmail.com>
  1 sibling, 1 reply; 4+ messages in thread
From: Stefan Schmidt @ 2016-12-21 13:11 UTC (permalink / raw)
  To: Andrey Smirnov, linux-wpan
  Cc: Alexander Aring, netdev, linux-kernel, Chris Healy

Hello.

On 19/12/16 00:25, Andrey Smirnov wrote:
> Driver code never touches "rstn" signal in atomic context, so there's
> no need to implicitly put such restriction on it by using gpio_set_value
> to manipulate it. Replace gpio_set_value to gpio_set_value_cansleep to
> fix that.

We need to make sure we are not assuming it can be called  in such a 
context in the future now. But that is something we can worry about if 
it comes up.

> As a an example of where such restriction might be inconvenient,
> consider a hardware design where "rstn" is connected to a pin of I2C/SPI
> GPIO expander chip.

Is this a real life issue you run into?

> Cc: Chris Healy <cphealy@gmail.com>
> Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
> ---
>  drivers/net/ieee802154/at86rf230.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/net/ieee802154/at86rf230.c b/drivers/net/ieee802154/at86rf230.c
> index 9f10da6..7700690 100644
> --- a/drivers/net/ieee802154/at86rf230.c
> +++ b/drivers/net/ieee802154/at86rf230.c
> @@ -1710,9 +1710,9 @@ static int at86rf230_probe(struct spi_device *spi)
>  	/* Reset */
>  	if (gpio_is_valid(rstn)) {
>  		udelay(1);
> -		gpio_set_value(rstn, 0);
> +		gpio_set_value_cansleep(rstn, 0);
>  		udelay(1);
> -		gpio_set_value(rstn, 1);
> +		gpio_set_value_cansleep(rstn, 1);
>  		usleep_range(120, 240);
>  	}
>
>


Acked-by: Stefan Schmidt <stefan@osg.samsung.com>

regards
Stefan Schmidt

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

* Re: [PATCH] at86rf230: Allow slow GPIO pins for "rstn"
       [not found]   ` <CAFXsbZpgiTM2qngYERVpfXHvePW8M8DN91YnZwc-voKO=FDUUA@mail.gmail.com>
@ 2016-12-21 21:01     ` Stefan Schmidt
  0 siblings, 0 replies; 4+ messages in thread
From: Stefan Schmidt @ 2016-12-21 21:01 UTC (permalink / raw)
  To: Chris Healy
  Cc: Alexander Aring, Andrey Smirnov, linux-kernel, netdev, linux-wpan

Hello.

On 21/12/16 19:30, Chris Healy wrote:
>
>
> On Dec 21, 2016 5:11 AM, "Stefan Schmidt" <stefan@osg.samsung.com
> <mailto:stefan@osg.samsung.com>> wrote:
>
>     Hello.
>
>
>     On 19/12/16 00:25, Andrey Smirnov wrote:
>
>         Driver code never touches "rstn" signal in atomic context, so
>         there's
>         no need to implicitly put such restriction on it by using
>         gpio_set_value
>         to manipulate it. Replace gpio_set_value to
>         gpio_set_value_cansleep to
>         fix that.
>
>
>     We need to make sure we are not assuming it can be called  in such a
>     context in the future now. But that is something we can worry about
>     if it comes up.
>
>
>         As a an example of where such restriction might be inconvenient,
>         consider a hardware design where "rstn" is connected to a pin of
>         I2C/SPI
>         GPIO expander chip.
>
>
>     Is this a real life issue you run into?
>
>
> I have a platform with this configuration.  The DTS for the platform is
> in the process of being mainlined right now.

Thanks for letting us know. What platform is that? I'm always interested 
in hearing about devices that use the Linux ieee802154 subsystem. :)

regards
Stefan Schmidt

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

end of thread, other threads:[~2016-12-21 21:01 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-12-18 23:25 [PATCH] at86rf230: Allow slow GPIO pins for "rstn" Andrey Smirnov
2016-12-21 12:30 ` Nikita Yushchenko
2016-12-21 13:11 ` [PATCH] " Stefan Schmidt
     [not found]   ` <CAFXsbZpgiTM2qngYERVpfXHvePW8M8DN91YnZwc-voKO=FDUUA@mail.gmail.com>
2016-12-21 21:01     ` Stefan Schmidt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).