linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dmitry Osipenko <digetx@gmail.com>
To: Thierry Reding <thierry.reding@gmail.com>,
	Jonathan Hunter <jonathanh@nvidia.com>,
	Linus Walleij <linus.walleij@linaro.org>,
	Bartosz Golaszewski <bgolaszewski@baylibre.com>
Cc: linux-gpio@vger.kernel.org, linux-tegra@vger.kernel.org,
	devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org
Subject: [PATCH v1 2/3] gpio: tegra: Properly handle irq_set_irq_wake() error
Date: Sun, 15 Dec 2019 21:30:46 +0300	[thread overview]
Message-ID: <20191215183047.9414-3-digetx@gmail.com> (raw)
In-Reply-To: <20191215183047.9414-1-digetx@gmail.com>

Technically upstream interrupt controller may fail changing of GPIO's bank
wake-state and in this case the GPIO's wake-state shouldn't be changed.

Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
---
 drivers/gpio/gpio-tegra.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/gpio/gpio-tegra.c b/drivers/gpio/gpio-tegra.c
index f6a382fbd12d..4790dfec7758 100644
--- a/drivers/gpio/gpio-tegra.c
+++ b/drivers/gpio/gpio-tegra.c
@@ -497,6 +497,11 @@ static int tegra_gpio_irq_set_wake(struct irq_data *d, unsigned int enable)
 	struct tegra_gpio_bank *bank = irq_data_get_irq_chip_data(d);
 	unsigned int gpio = d->hwirq;
 	u32 port, bit, mask;
+	int err;
+
+	err = irq_set_irq_wake(bank->irq, enable);
+	if (err)
+		return err;
 
 	port = GPIO_PORT(gpio);
 	bit = GPIO_BIT(gpio);
@@ -507,7 +512,7 @@ static int tegra_gpio_irq_set_wake(struct irq_data *d, unsigned int enable)
 	else
 		bank->wake_enb[port] &= ~mask;
 
-	return irq_set_irq_wake(bank->irq, enable);
+	return 0;
 }
 #endif
 
-- 
2.24.0


  parent reply	other threads:[~2019-12-15 18:31 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-15 18:30 [PATCH v1 0/3] Tegra GPIO: Minor code clean up Dmitry Osipenko
2019-12-15 18:30 ` [PATCH v1 1/3] gpio: tegra: Use generic readl_relaxed/writel_relaxed accessors Dmitry Osipenko
2019-12-19 11:01   ` Bartosz Golaszewski
2019-12-19 15:25     ` Dmitry Osipenko
2019-12-19 15:57     ` Ben Dooks
2019-12-19 16:34       ` Dmitry Osipenko
2019-12-15 18:30 ` Dmitry Osipenko [this message]
2019-12-15 18:30 ` [PATCH v1 3/3] gpio: tegra: Use NOIRQ phase for suspend/resume Dmitry Osipenko
2019-12-16 14:45 ` [PATCH v1 0/3] Tegra GPIO: Minor code clean up Dmitry Osipenko
2019-12-19 14:53 ` Thierry Reding
2019-12-19 15:26   ` Dmitry Osipenko
2020-01-06 22:59 ` Linus Walleij
2020-01-07  8:25   ` Bartosz Golaszewski
2020-01-07  9:29     ` Linus Walleij
2020-01-07  9:31       ` Bartosz Golaszewski
2020-01-07 12:38         ` Linus Walleij

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20191215183047.9414-3-digetx@gmail.com \
    --to=digetx@gmail.com \
    --cc=bgolaszewski@baylibre.com \
    --cc=devel@driverdev.osuosl.org \
    --cc=jonathanh@nvidia.com \
    --cc=linus.walleij@linaro.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tegra@vger.kernel.org \
    --cc=thierry.reding@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).