From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796381479; b=vrCV1NP9g3dXEIhVpEKuDF+14P3CIhTUrT1T4WmzC/aW7K4xWAEVCdVNnSPiHO46p2Zo dolAPy0EcLE5xZbIqkx53MChHHK836YPxRZptkxKUj3tWzmQ5ErOt8yXJt+umfsaIlKA4 cKpJ0Qrbl1T+vKrkEDZxwgf5WyMhh3RD8B0lr1pxxK0BQYW4fpCRyp09G9etQflksQgIx XUQS2d/vD4+DqdCmwQuoCoZhxj3CzSD+lj+ZnazbOSjjOlOu1CUkDTqTmOPyL4rhB/96u GbbKQkUlCDx1k9IXX7YK03oIET0P4DO996RsIMRIbAdNGdEeuWcnRJjHunGpDm0OJvw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796381479; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:User-Agent:X-stable:X-Patchwork-Hint: MIME-Version:Content-Transfer-Encoding; bh=0fBTc0IDqsG9eumMducDjxf2dp7LTZxn+reb1Akilhw=; b=EWgatSTFmYfkATb+VHKmKrlz7oxJFD621dLzJd2iDVz40SqpRkybNp3goURpZ8zS8jys zcVZChFiyhyO/fZVMMpoORZ7fONcvaRkyFZDCja0VgbgcYc4PqB0g9d3egLkEnPL0sOpU QW1OvpkoThX+6SdklNZQu6dbVPbuwEV2F29V2KzvQM4KyNw+7Y+o4s5H46BkmeKwqizHw fHNKipfkgyI75Dlf3y4g+jufrJqQ4H4BTb9tkfAej1EblsppZgmpqa8C4gu7Oz1B0bQ+c iBHAxLvqnRnPGzZ237riKkpzo/KLZ961Bgfz3e4E88bjrvUIf6bDq/Z0lNfE4Pknt2g== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b="J8sE8Y/n"; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9332F606A339; Fri, 4 Dec 2026 10:51:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=J8sE8Y/n Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0CE691F00897; Fri, 4 Dec 2026 10:51:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796381479; bh=0fBTc0IDqsG9eumMducDjxf2dp7LTZxn+reb1Akilhw=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=J8sE8Y/nXBkXN/cuSwsmjEfYe5Tws71kQaKA+h3yR0jalINdABLNgbKJjdvZWCmQc U5wArZaWLDktIgLacN4C2vcXmpKh/CvMEtrgYHT1c4cHCeDTZpiiu4g1m4FavAS3jJ Mp5+4PGcKQJya96RxDLhHvHr0l/oVCwwAzTRZqi0= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Kent Gibson , Bartosz Golaszewski , Sasha Levin Subject: [PATCH 7.3 722/742] gpiolib: clear debounce period before the "requested" flag Date: Fri, 4 Dec 2026 19:09:46 +0900 Message-ID: <20261204100654.262093308@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204100635.034361255@linuxfoundation.org> References: <20261204100635.034361255@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore X-Mailing-List: patches@lists.linux.dev List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 7.3-stable review patch. If anyone has any objections, please let me know. ------------------ From: Bartosz Golaszewski [ Upstream commit 8509d643ffb7be508568c696c9fe45eb1f84c33c ] The debounce_period_us field is protected by the GPIOD_FLAG_REQUESTED flag, so it should be cleared before the flag, else it could potentially race with a new request. Suggested-by: Kent Gibson Closes: https://lore.kernel.org/all/20261105042905.GB8436@rigel/ Fixes: 81625f362497 ("gpio: cdev: go back to storing debounce period in the GPIO descriptor") Reviewed-by: Kent Gibson Link: https://patch.msgid.link/20261110-gpio-desc-flags-atomic-v3-3-2f463bce8086@oss.qualcomm.com Signed-off-by: Bartosz Golaszewski Signed-off-by: Sasha Levin --- drivers/gpio/gpiolib.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c index fbd07bdb013af..c69fabe1d689c 100644 --- a/drivers/gpio/gpiolib.c +++ b/drivers/gpio/gpiolib.c @@ -2690,6 +2690,10 @@ void gpiod_free_commit(struct gpio_desc *desc) if (guard.gc->free) guard.gc->free(guard.gc, gpiod_hwgpio(desc)); +#ifdef CONFIG_GPIO_CDEV + WRITE_ONCE(desc->debounce_period_us, 0); +#endif + clear_bit(GPIOD_FLAG_ACTIVE_LOW, &flags); clear_bit(GPIOD_FLAG_REQUESTED, &flags); clear_bit(GPIOD_FLAG_OPEN_DRAIN, &flags); @@ -2707,9 +2711,6 @@ void gpiod_free_commit(struct gpio_desc *desc) #endif desc_set_label(desc, NULL); WRITE_ONCE(desc->flags, flags); -#ifdef CONFIG_GPIO_CDEV - WRITE_ONCE(desc->debounce_period_us, 0); -#endif gpiod_line_state_notify(desc, GPIO_V2_LINE_CHANGED_RELEASED); } } -- 2.53.0