Skip to contentSkip to conversation

FAILED: patch "[PATCH] gpiolib: cdev: clear debounce period if line set to output" failed to apply to 5.10-stable tree

PATCH In review [email protected] 2 participants 3 messages Feb 8, 2021 – Feb 10, 2021

Subsystems (3)
lore
Share & tools
lore

[email protected]

author maintainer
#0 lore raw

The patch below does not apply to the 5.10-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.

thanks,

greg k-h

------------------ original commit in Linus's tree ------------------

From 03a58ea5905fdbd93ff9e52e670d802600ba38cd Mon Sep 17 00:00:00 2001
From: Kent Gibson <[email protected]>
Date: Thu, 21 Jan 2021 22:10:38 +0800
Subject: [PATCH] gpiolib: cdev: clear debounce period if line set to output

When set_config changes a line from input to output debounce is implicitly disabled, as debounce makes no sense for outputs, but the debounce period is not being cleared and is still reported in the line info.

So clear the debounce period when the debouncer is stopped in edge_detector_stop().

Fixes 65cff7046406 ("gpiolib: cdev: support setting debounce")
drivers/gpio/gpiolib-cdev.c +2 -0
index 1a7b51163528..1631727bf0da 100644
@@ -776,6 +776,8 @@ static void edge_detector_stop(struct line *line)
 	cancel_delayed_work_sync(&line->work);
 	WRITE_ONCE(line->sw_debounced, 0);
 	WRITE_ONCE(line->eflags, 0);
+	if (line->desc)
+		WRITE_ONCE(line->desc->debounce_period_us, 0);
 	/* do not change line->level - see comment in debounced_value() */
 }
 
reviewer
#1 lore raw

PATCH 1/1 gpiolib: cdev: clear debounce period if line set to output

commit 03a58ea5905fdbd93ff9e52e670d802600ba38cd upstream.

When set_config changes a line from input to output debounce is implicitly disabled, as debounce makes no sense for outputs, but the debounce period is not being cleared and is still reported in the line info.

So clear the debounce period when the debouncer is stopped in edge_detector_stop().

Fixes 65cff7046406 ("gpiolib: cdev: support setting debounce")
---
 drivers/gpio/gpiolib-cdev.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/gpio/gpiolib-cdev.c +2 -0
index 12b679ca552c..3551aaf5a361 100644
@@ -756,6 +756,8 @@ static void edge_detector_stop(struct line *line)
 	cancel_delayed_work_sync(&line->work);
 	WRITE_ONCE(line->sw_debounced, 0);
 	line->eflags = 0;
+	if (line->desc)
+		WRITE_ONCE(line->desc->debounce_period_us, 0);
 	/* do not change line->level - see comment in debounced_value() */
 }
 
Signature · 1 line
2.30.0
author maintainer
#2 lore raw

Re: [BACKPORT 5.10 PATCH] gpiolib: cdev: clear debounce period if line set to output

Quoted 10 lines · Kent Gibson

commit 03a58ea5905fdbd93ff9e52e670d802600ba38cd upstream.

When set_config changes a line from input to output debounce is implicitly disabled, as debounce makes no sense for outputs, but the debounce period is not being cleared and is still reported in the line info.

So clear the debounce period when the debouncer is stopped in edge_detector_stop().

Quoted 8 lines
Fixes 65cff7046406 ("gpiolib: cdev: support setting debounce")
---
 drivers/gpio/gpiolib-cdev.c | 2 ++
 1 file changed, 2 insertions(+)

Now applied, thanks.

greg k-h