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=1796385880; b=pKBAPOqmTkOjJoMo1Gc8kF4m2NTPqDfXBCjiGl7j+0Ga0BNNf6DJi4MoFUcCpaygylh6 yVgk36hhKf5hV4PBVSlVH41OURPbOUTBMueejy0ahd0CjhH3/5gOKawsyFbBzTFchs/Kk M9xiCVt3D3KSf+PyLXyb2kyZoGHZnpUvaOPI2aUrR9+P6WCU5I9YT2DKqYpBhSR2thsse XsYF2QD2ynNDrmxOqW8qutFMngqddlwPKzW/9xEzahr56cZlK0gn+fCP9TiFyjaKuCfzg pZ5ZJ7lKX+0adjSgnp3BiKGW+mZJskTkDhj+ROrFRTWqb0reJEsVCPrwMw2qJ3vswTw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796385880; 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=nqU2k9E0+LCyHWen8cfAK/qWKFVhYdjdJCQML0BpZbg=; b=We6cnid73AyMlW9qUCZsvSsQx6TA0qckl3vrRZNZq8BsuoVCk7DS+L1dkz5le3V7WH0E g9+1Pdc8N0U+E2XMU4atfMXtyXzE6hvtyCzMkPsOprIMtEAsYbwXS+dOAYnU/3Ba7+7np +1KK1E3K2jRLNvFYwFadzamKd1vNpceUmVFI2s4a+ED+azeJ2jC5krJHwcsSBcPAiiicz UIGuXl/3C4sEWR7DZwSJkU/SWutzC7pIAdKAGZcgxpP1OZwEISnIjwC2QIQV4tjTGC6EU IWk3saHvx76spX4vHgViuzDuIP7DVzaW9qU4mWKM9TN98xXdjbdf5dBJcs/htL9NLHQ== 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=Vht2+xvI; 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 1C2CB606A322; Fri, 4 Dec 2026 12:04:39 +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=Vht2+xvI Received: by smtp.kernel.org (Postfix) with ESMTPSA id 479CB1F000C2; Fri, 4 Dec 2026 12:04:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796385879; bh=nqU2k9E0+LCyHWen8cfAK/qWKFVhYdjdJCQML0BpZbg=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=Vht2+xvILsAlnX34ZIPjtY71Ah2ne3ayKvjer2cSgqu8g4WiymrQiZda6RkZmP9gq frF0aMQhm2Fs5Ue9S3CRaJfAH2LZ2iimJNDXNfamZJ1hChpkS85I3DXveTyX4yz9Cl iLJ3DNugcloAOe/rPgAtkVJ+PmYPJc89HaEEEY7U= 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.6 0732/1167] iio: proximity: sx9500: ignore event config writes that dont change state Date: Fri, 4 Dec 2026 19:02:39 +0900 Message-ID: <20261204100721.141228018@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204100702.047403948@linuxfoundation.org> References: <20261204100702.047403948@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 6.6-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 550e7d3cd5ee5..3264166c9fc18 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