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=1796379411; b=5b5SiuwXhYd/4z3t+8GDtTl0vOqeh3d85KWncjEEIDmmzmjxfFqbkvm+94u9EI6Mn03i u4v3wMwcx7tLH2zXK7TVLhF26HAf4m6dbodQWU63+rZCpjhf+Jv1Rk6B8CgWbb+ZXaZb1 /eLT2OR3kItDAI8QPRCqM3c6+wRsrl8WKTijt8AdCpeacK5b0FZEUcpy/h9PMqzaQz/Cx kvpmnvDSkL22GmdrEW5jho0CXO6+K/TZ7DYXHnmb5AIyy+5VWLfrL8R2AIgIEaFC49mHX BJq6zbrcif9LVyUhbdJ4umrNY+2tRCIP8PnwtJAt6smHmSl+QZlQrpzLX0QUCfAuQ9w== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796379411; 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=uBqc7aMgtv2ivr/QDcQCTnm5RNAgUs85sBcNYWqa4hA=; b=y00p+MXS9032apYGwexeNiMRR/CuLjoe4YoPVzAd0S/ACB67EIRqgrrB5TzQQmalf10Y 8Rm/45T+h8vfFda2+EhglcQ1ScnCoIgbZoYk54qtja1IyVIqND3VBN2IYa7FkNqwRCmp9 OpqnapqqpmOD7ryI6lnC/bSmpEbudke00XIM9zxJC05JwtMS9QnVGRqL1DdxlGhOx6o3d yErdcmNOXSy7GHoqVza1tGiHd4lrh2In5sm9jRu7EtJgVmlGX5Iezmn3yAGFacVioEtQg KE3VEmM2eYaBQZYLZW/Tqe18rueFc6njy2UPT9DG925/p8Xjilst86EhYiSPvOkP3XQ== 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=e0QughOu; 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 93AA0606A322; Fri, 4 Dec 2026 10:16:51 +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=e0QughOu Received: by smtp.kernel.org (Postfix) with ESMTPSA id 09B961F000CE; Fri, 4 Dec 2026 10:16:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796379411; bh=uBqc7aMgtv2ivr/QDcQCTnm5RNAgUs85sBcNYWqa4hA=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=e0QughOuIh+w+ZUSkuJU0d0ZRodVntQ38mCaimgWJusw64mA4llvBHbEa62d0n4kt ThUuK2eMFXE+PXgYAiqUfX5WSebh6Ubq2dn6LkyGz6MvBrMV8e/pAhcATyFDgZaDKq 5dCbK9tWRA1wm/PT5XrNM8U8D7tPdliKnJmhV6e8= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Arnav Kapoor , Jonathan Cameron , Sasha Levin Subject: [PATCH 6.12 017/555] iio: proximity: sx9500: ignore event config writes that dont change state Date: Fri, 4 Dec 2026 19:01:00 +0900 Message-ID: <20261204100604.649835787@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204100603.988357525@linuxfoundation.org> References: <20261204100603.988357525@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore X-Mailing-List: stable@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.12-stable review patch. If anyone has any objections, please let me know. ------------------ From: Arnav Kapoor commit b8ed9165906597b69a46fabf39ab41690721ebe8 upstream. sx9500_write_event_config() adjusts the channel and close/far user counts on every write, even when the event is already in the requested state. Writing 0 to a disabled event and then 1 leaves the counts at 0, so the channel and its interrupts stay off while the event reads as enabled. As channel_users[] is shared with raw reads, those can then wait forever for a conversion. Writing 1 twice and then 0 has the opposite effect. Return early when the state doesn't change, as sx_common_write_event_config() does. Fixes: 4193c0f1d863 ("iio: driver for Semtech SX9500 proximity solution") Signed-off-by: Arnav Kapoor Cc: stable@vger.kernel.org Signed-off-by: Jonathan Cameron [ Context: write_event_config() still takes int state here and tests state == 1; the added check is unchanged. ] Signed-off-by: Arnav Kapoor Signed-off-by: Sasha Levin --- drivers/iio/proximity/sx9500.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/iio/proximity/sx9500.c b/drivers/iio/proximity/sx9500.c index 3f4eace05cfc6..1041d3defe4e7 100644 --- a/drivers/iio/proximity/sx9500.c +++ b/drivers/iio/proximity/sx9500.c @@ -551,6 +551,12 @@ static int sx9500_write_event_config(struct iio_dev *indio_dev, mutex_lock(&data->mutex); + /* The user counts must only change when the state does. */ + if (data->event_enabled[chan->channel] == state) { + ret = 0; + goto out_unlock; + } + if (state == 1) { ret = sx9500_inc_chan_users(data, chan->channel); if (ret < 0) -- 2.53.0