linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] gpio: regmap: fix direction register check
@ 2021-03-02 18:06 Álvaro Fernández Rojas
  2021-03-02 18:16 ` Michael Walle
  0 siblings, 1 reply; 3+ messages in thread
From: Álvaro Fernández Rojas @ 2021-03-02 18:06 UTC (permalink / raw)
  To: Michael Walle, Linus Walleij, Bartosz Golaszewski,
	Andy Shevchenko, linux-gpio, linux-kernel
  Cc: Álvaro Fernández Rojas

If there's a direction register, we should also have dat or set registers.
However, we only need one of them, not both.

Fixes: ebe363197e52 ("gpio: add a reusable generic gpio_chip using regmap")
Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
---
 drivers/gpio/gpio-regmap.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpio/gpio-regmap.c b/drivers/gpio/gpio-regmap.c
index 23b0a8572f53..5a9fca00b5e8 100644
--- a/drivers/gpio/gpio-regmap.c
+++ b/drivers/gpio/gpio-regmap.c
@@ -194,7 +194,7 @@ struct gpio_regmap *gpio_regmap_register(const struct gpio_regmap_config *config
 
 	/* if we have a direction register we need both input and output */
 	if ((config->reg_dir_out_base || config->reg_dir_in_base) &&
-	    (!config->reg_dat_base || !config->reg_set_base))
+	    (!config->reg_dat_base && !config->reg_set_base))
 		return ERR_PTR(-EINVAL);
 
 	/* we don't support having both registers simultaneously for now */
-- 
2.20.1


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

* Re: [PATCH] gpio: regmap: fix direction register check
  2021-03-02 18:06 [PATCH] gpio: regmap: fix direction register check Álvaro Fernández Rojas
@ 2021-03-02 18:16 ` Michael Walle
  2021-03-02 18:21   ` Álvaro Fernández Rojas
  0 siblings, 1 reply; 3+ messages in thread
From: Michael Walle @ 2021-03-02 18:16 UTC (permalink / raw)
  To: Álvaro Fernández Rojas
  Cc: Linus Walleij, Bartosz Golaszewski, Andy Shevchenko, linux-gpio,
	linux-kernel

Am 2021-03-02 19:06, schrieb Álvaro Fernández Rojas:
> If there's a direction register, we should also have dat or set 
> registers.
> However, we only need one of them, not both.

Can you give some more context or an example? If there is a direction
register, we'd need to set and get the value, no?

-michael

> Fixes: ebe363197e52 ("gpio: add a reusable generic gpio_chip using 
> regmap")
> Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
> ---
>  drivers/gpio/gpio-regmap.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/gpio/gpio-regmap.c b/drivers/gpio/gpio-regmap.c
> index 23b0a8572f53..5a9fca00b5e8 100644
> --- a/drivers/gpio/gpio-regmap.c
> +++ b/drivers/gpio/gpio-regmap.c
> @@ -194,7 +194,7 @@ struct gpio_regmap *gpio_regmap_register(const
> struct gpio_regmap_config *config
> 
>  	/* if we have a direction register we need both input and output */
>  	if ((config->reg_dir_out_base || config->reg_dir_in_base) &&
> -	    (!config->reg_dat_base || !config->reg_set_base))
> +	    (!config->reg_dat_base && !config->reg_set_base))
>  		return ERR_PTR(-EINVAL);
> 
>  	/* we don't support having both registers simultaneously for now */

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

* Re: [PATCH] gpio: regmap: fix direction register check
  2021-03-02 18:16 ` Michael Walle
@ 2021-03-02 18:21   ` Álvaro Fernández Rojas
  0 siblings, 0 replies; 3+ messages in thread
From: Álvaro Fernández Rojas @ 2021-03-02 18:21 UTC (permalink / raw)
  To: Michael Walle
  Cc: Linus Walleij, Bartosz Golaszewski, Andy Shevchenko, linux-gpio,
	linux-kernel

Hi Michael,

El 02/03/2021 a las 19:16, Michael Walle escribió:
> Am 2021-03-02 19:06, schrieb Álvaro Fernández Rojas:
>> If there's a direction register, we should also have dat or set 
>> registers.
>> However, we only need one of them, not both.
> 
> Can you give some more context or an example? If there is a direction
> register, we'd need to set and get the value, no?

I've just realized that I need to set reg_set_base to the same value as 
reg_dat_base in my case.
Please, ignore this patch and excuse me :$.

> 
> -michael
> 
>> Fixes: ebe363197e52 ("gpio: add a reusable generic gpio_chip using 
>> regmap")
>> Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
>> ---
>>  drivers/gpio/gpio-regmap.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/gpio/gpio-regmap.c b/drivers/gpio/gpio-regmap.c
>> index 23b0a8572f53..5a9fca00b5e8 100644
>> --- a/drivers/gpio/gpio-regmap.c
>> +++ b/drivers/gpio/gpio-regmap.c
>> @@ -194,7 +194,7 @@ struct gpio_regmap *gpio_regmap_register(const
>> struct gpio_regmap_config *config
>>
>>      /* if we have a direction register we need both input and output */
>>      if ((config->reg_dir_out_base || config->reg_dir_in_base) &&
>> -        (!config->reg_dat_base || !config->reg_set_base))
>> +        (!config->reg_dat_base && !config->reg_set_base))
>>          return ERR_PTR(-EINVAL);
>>
>>      /* we don't support having both registers simultaneously for now */

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

end of thread, other threads:[~2021-03-02 21:21 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-02 18:06 [PATCH] gpio: regmap: fix direction register check Álvaro Fernández Rojas
2021-03-02 18:16 ` Michael Walle
2021-03-02 18:21   ` Álvaro Fernández Rojas

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).