Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1634154 > unrolled thread

[PATCH] gpio: aspeed: Don't attempt to debounce if disabled

Started byJoel Stanley <joel@jms.id.au>
First post2017-05-02 08:10 +0200
Last post2017-05-11 13:40 +0200
Articles 2 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] gpio: aspeed: Don't attempt to debounce if disabled Joel Stanley <joel@jms.id.au> - 2017-05-02 08:10 +0200
    Re: [PATCH] gpio: aspeed: Don't attempt to debounce if disabled Linus Walleij <linus.walleij@linaro.org> - 2017-05-11 13:40 +0200

#1634154 — [PATCH] gpio: aspeed: Don't attempt to debounce if disabled

FromJoel Stanley <joel@jms.id.au>
Date2017-05-02 08:10 +0200
Subject[PATCH] gpio: aspeed: Don't attempt to debounce if disabled
Message-ID<tCzax-2zn-1@gated-at.bofh.it>
We warn the user at driver probe time that debouncing is disabled.
However, if they request debouncing later on we print a confusing error
message:

 gpio_aspeed 1e780000.gpio: Failed to convert 5000us to cycles at 0Hz: -524

Instead bail out when the clock is not present.

Fixes: 5ae4cb94b3133 (gpio: aspeed: Add debounce support)
Signed-off-by: Joel Stanley <joel@jms.id.au>
---
 drivers/gpio/gpio-aspeed.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/gpio/gpio-aspeed.c b/drivers/gpio/gpio-aspeed.c
index ccea609676ee..4ca436e66bdb 100644
--- a/drivers/gpio/gpio-aspeed.c
+++ b/drivers/gpio/gpio-aspeed.c
@@ -646,6 +646,9 @@ static int enable_debounce(struct gpio_chip *chip, unsigned int offset,
 	int rc;
 	int i;
 
+	if (!gpio->clk)
+		return -EINVAL;
+
 	rc = usecs_to_cycles(gpio, usecs, &requested_cycles);
 	if (rc < 0) {
 		dev_warn(chip->parent, "Failed to convert %luus to cycles at %luHz: %d\n",
-- 
2.11.0

[toc] | [next] | [standalone]


#1639316

FromLinus Walleij <linus.walleij@linaro.org>
Date2017-05-11 13:40 +0200
Message-ID<tFUBP-5JW-5@gated-at.bofh.it>
In reply to#1634154
On Tue, May 2, 2017 at 8:08 AM, Joel Stanley <joel@jms.id.au> wrote:

> We warn the user at driver probe time that debouncing is disabled.
> However, if they request debouncing later on we print a confusing error
> message:
>
>  gpio_aspeed 1e780000.gpio: Failed to convert 5000us to cycles at 0Hz: -524
>
> Instead bail out when the clock is not present.
>
> Fixes: 5ae4cb94b3133 (gpio: aspeed: Add debounce support)
> Signed-off-by: Joel Stanley <joel@jms.id.au>

Patch applied for fixes.

Yours,
Linus Walleij

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web