gpio: regmap: fix direction register check
Subsystems (2)
PATCH 1/1 gpio: regmap: fix direction register check
If there's a direction register, we should also have dat or set registers. However, we only need one of them, not both.
--- drivers/gpio/gpio-regmap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpio/gpio-regmap.c +1 -1
@@ -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 */
Signature · 1 line
2.20.1
Am 2021-03-02 19:06, schrieb Álvaro Fernández Rojas:
Quoted 2 lines
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
Quoted 20 lines
Fixes ebe363197e52 ("gpio: add a reusable generic gpio_chip using regmap")Signed-off-by Álvaro Fernández Rojas <[email protected]>--- drivers/gpio/gpio-regmap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/gpio/gpio-regmap.c +0
-0@@ -194,7 +194,7 @@ struct gpio_regmap *gpio_regmap_register(conststruct
gpio_regmap_config*configdrivers/gpio/gpio-regmap.c +1
-1/* 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 */
Hi Michael,
Quoted 6 lines · Michael Walle
Am 2021-03-02 19:06, schrieb Álvaro Fernández Rojas:
Quoted 2 lines
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 :$.
Quoted 23 lines
-michael
Quoted 20 lines
Fixes ebe363197e52 ("gpio: add a reusable generic gpio_chip using regmap")Signed-off-by Álvaro Fernández Rojas <[email protected]>---
drivers/gpio/gpio-regmap.c | 2 +-1 file changed, 1 insertion(+), 1 deletion(-)drivers/gpio/gpio-regmap.c +0
-0@@ -194,7 +194,7 @@ struct gpio_regmap *gpio_regmap_register(conststruct
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 */