From patchwork Fri May 15 14:00:57 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heiko Schocher X-Patchwork-Id: 245860 List-Id: U-Boot discussion From: hs at denx.de (Heiko Schocher) Date: Fri, 15 May 2020 16:00:57 +0200 Subject: [PATCH v5 1/3] gpio-uclass.c: save the GPIOD flags also in the gpio descriptor In-Reply-To: <20200515140100.3306517-1-hs@denx.de> References: <20200515140100.3306517-1-hs@denx.de> Message-ID: <20200515140100.3306517-2-hs@denx.de> save the GPIOD_ flags also in the gpio descriptor. Signed-off-by: Heiko Schocher Reviewed-by: Patrick Delaunay Reviewed-by: Simon Glass --- Changes in v5: - add comment from patrick, update the descriptor flags in _dm_gpio_set_dir_flags() if setting direction was OK. Changes in v4: - new in version 4 Changes in v3: None Changes in v2: None drivers/gpio/gpio-uclass.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/gpio/gpio-uclass.c b/drivers/gpio/gpio-uclass.c index d3cea11f76..d241263970 100644 --- a/drivers/gpio/gpio-uclass.c +++ b/drivers/gpio/gpio-uclass.c @@ -599,6 +599,10 @@ static int _dm_gpio_set_dir_flags(struct gpio_desc *desc, ulong flags) } } + /* save the flags also in descriptor */ + if (!ret) + desc->flags = flags; + return ret; } @@ -614,10 +618,6 @@ int dm_gpio_set_dir_flags(struct gpio_desc *desc, ulong flags) flags |= desc->flags; ret = _dm_gpio_set_dir_flags(desc, flags); - /* update the descriptor flags */ - if (ret) - desc->flags = flags; - return ret; }