All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] gpio: aspeed: Don't attempt to debounce if disabled
@ 2017-05-02  6:08 Joel Stanley
  2017-05-11 11:32 ` Linus Walleij
  0 siblings, 1 reply; 2+ messages in thread
From: Joel Stanley @ 2017-05-02  6:08 UTC (permalink / raw)
  To: Linus Walleij, Alexandre Courbot; +Cc: linux-gpio, linux-kernel, Andrew Jeffery

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


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

* Re: [PATCH] gpio: aspeed: Don't attempt to debounce if disabled
  2017-05-02  6:08 [PATCH] gpio: aspeed: Don't attempt to debounce if disabled Joel Stanley
@ 2017-05-11 11:32 ` Linus Walleij
  0 siblings, 0 replies; 2+ messages in thread
From: Linus Walleij @ 2017-05-11 11:32 UTC (permalink / raw)
  To: Joel Stanley; +Cc: Alexandre Courbot, linux-gpio, linux-kernel, Andrew Jeffery

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

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

end of thread, other threads:[~2017-05-11 11:32 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-05-02  6:08 [PATCH] gpio: aspeed: Don't attempt to debounce if disabled Joel Stanley
2017-05-11 11:32 ` Linus Walleij

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.