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=1796388619; b=5SIj42eHjV3PSNFwp2LLKzmi4V6Z/5fw2qPRStNhjucJBz4PwYm4n6o3aptICVO7SKeJ u11d+/g89xoGroHVbZpMK5kpQmXzIotcFS5bMbr5VSIPFvVnayoaXKLr3qNhVm2qPDO8H F642dsaJaRO802w2ThqkGFEY2BhMD0i7OFSfv20092927RgkwhX5K8CXIzrLxMfS5mzIQ kO4ogOtj4nTMoh1olnFgTcOsBI8pGJFo1zKDWTdswrONBqCZO1Qr5HeMhrv9gifLxC3xO hQTJzqfi1x0l8CQQIsJN2bgNu5JSjerN7ok/5l7jTkBNlughYLbL0LUQOFtQkijEdNQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796388619; 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=ZBPbe7sr+XuOioN91sPLmqHUCV1akaBQfUfDD/E009I=; b=upw6BsWYzJfEWLeAYni3J3wirMY1DM9WMBii7UHUNwgW6uL3ow5odUJbOoWatZtXVJL4 /AcXONWh1t6LGXnh8mR+5LS1zsrhC4eE6klfji8ic0ddXdnYxvbxQGdJgCfxs836e1lwM xnDGWXWFR/k8abFVQhcnh+zHasixFrzqjpp7GfYVzOeUVzHHs0fwLvLMhJi9DMokXnD5Q wCWQ9TJydgGmt1TkkZ/6QVz0mLgEXLYCzSBzg4Y+e1HuOCKdTocEmPnu0s9RAsIlUYWKv LoX9UODGWqBtOwZPF/OQj4vAlBMIlOgXstkFdo/24M7WaQ4wwzz0fGvJweNMgosLYYQ== 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=01WTI18L; 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 19AA9606A322; Fri, 4 Dec 2026 12:50: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=01WTI18L Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8AA781F00897; Fri, 4 Dec 2026 12:50:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796388619; bh=ZBPbe7sr+XuOioN91sPLmqHUCV1akaBQfUfDD/E009I=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=01WTI18LUtTgqtBxid9nHvl/YPZG3I6QJYu+oIAUy24kB/uYQ7vi5iinO53NQV9HU arLFAHVtA6snGmcuJEhTYct1XT35ng0CNbdC38ehbn/J/OAXEo7OBcdq8UEhbkSiNx YO0xRYM75gO96aXekxdfRQSuuhnHSU8rW0/84wR8= 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.1 0690/1059] iio: proximity: sx9500: ignore event config writes that dont change state Date: Fri, 4 Dec 2026 19:03:41 +0900 Message-ID: <20261204100701.864199570@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204100643.980430235@linuxfoundation.org> References: <20261204100643.980430235@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.1-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 d4670864ddc7e..1eff1c96e3b46 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