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=1796386272; b=DvmqDUVAct2vC6KvUlqqnTWPq2RVOXyyhWBF8xOMC3yItq9esQZlkD5ZimkHfcMrtQmd KoJ8u5plgfG4DH49DBAZqh5JVE5DaPHVMjEpKxphefw/3E1c2JppwdQwoOFl65FxkiGJ1 EP57dD2NFm6MzD1biG7QP6QegaMX6/RV09/O9D0tBsnMe58paEFSA1LNenMDRnPpPnwa9 I2pBr21PrI2TttnPU3ewU8LERdSBnat+NvOEMceUO544l9Rvck2RPhXWas9sybZ1lgfTI Ap1XNICRt91CSMLG4Oes6UEsHIMOcDGBXtL7GdijduOPJB0YqD6fRFX28uLQeNfQwRQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796386272; 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=xJPZlCJwDlVbrdsoG0488V7OyxAJizz8cmxUro0X8eQ=; b=r3WCYCbTNMURtTPBoEXI9jFlCzgg1cixfunZp4/nY3NStWwgirm3Ndpig3XgI/pQRQ6U OSlN/f0TTy+bO0g9E4kOh2Dbn2FQ459jMnNPpN026ECHLK9sDez8LSkn3tiYbbTx2CFso Le2NlL42MqWxIpX4lnMeR96MTe5ZDdqii3TsNvEyfSPuQU0KRWAhaB1HjloiTYBlvfN6w 6MnbMeRhGlZ7IFgRwK9cTSg3UsAX+J7b5hyvTqQAZMn5GVgq06/KLzC/BsSr3MYST5PZQ Gfn7FP6ypyXs72+cZ2sCx13oo5ooCKomVH+ZULPG3L5tpENmOGCUAhpS/lEQp7FJJEg== 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=eZrvRt+i; 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 2A9B3606A336; Fri, 4 Dec 2026 12:11:12 +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=eZrvRt+i Received: by smtp.kernel.org (Postfix) with ESMTPSA id 58C931F00931; Fri, 4 Dec 2026 12:11:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796386271; bh=xJPZlCJwDlVbrdsoG0488V7OyxAJizz8cmxUro0X8eQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=eZrvRt+io+gbGlDj3h4437xdEUg1izFlmWhxOLy1JT2TFbLsWJYLNp6DRo17vZwc3 B9cHlOdrfxVFmoWvenCi3bmpzZ68PsytWKvEIyQpUdc56PFIsYQd0a4bF8mn1Q8zub yemDtt4Qn5cko2l6bz+azUn31DoB4eErNfZp4QeQ= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Semyon Maryasin , Joshua Crofts , Zhang Lixu , Srinivas Pandruvada , Jonathan Cameron , Jiri Kosina , Sasha Levin Subject: [PATCH 6.6 0892/1167] HID: sensor: custom: Disable sensor before hub close on removal Date: Fri, 4 Dec 2026 19:05:19 +0900 Message-ID: <20261204100725.432426347@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: 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.6-stable review patch. If anyone has any objections, please let me know. ------------------ From: Srinivas Pandruvada [ Upstream commit 6e66d69837cf07a00cbcdeb6198e08332b422b6c ] When removing an enabled sensor, set its power and reporting states to off before closing the hub. Keep the field descriptors alive until the state update has completed, and release the hub's open reference. Fixes: 4a7de0519df5 ("HID: sensor: Custom and Generic sensor support") Reported-by: Semyon Maryasin Closes: https://lore.kernel.org/all/CAM2dg7ewfVJSP4rFyhkCB1Rmd1+X56sAg=eUdbPthG2xrLqwQQ@mail.gmail.com/ Reviewed-by: Joshua Crofts Tested-by: Semyon Maryasin Tested-by: Zhang Lixu Signed-off-by: Srinivas Pandruvada Reviewed-by: Jonathan Cameron Signed-off-by: Jiri Kosina Signed-off-by: Sasha Levin --- drivers/hid/hid-sensor-custom.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/hid/hid-sensor-custom.c b/drivers/hid/hid-sensor-custom.c index d993e0b2bb65d..7cd85fc8f2d3e 100644 --- a/drivers/hid/hid-sensor-custom.c +++ b/drivers/hid/hid-sensor-custom.c @@ -1054,6 +1054,13 @@ static int hid_sensor_custom_remove(struct platform_device *pdev) /* Remove enable_sensor first as it uses fields via power_state/report_state. */ sysfs_remove_group(&sensor_inst->pdev->dev.kobj, &enable_sensor_attr_group); + mutex_lock(&sensor_inst->mutex); + if (sensor_inst->enable) { + set_power_report_state(sensor_inst, false); + sensor_hub_device_close(hsdev); + sensor_inst->enable = false; + } + mutex_unlock(&sensor_inst->mutex); hid_sensor_custom_remove_attributes(sensor_inst); sensor_hub_remove_callback(hsdev, hsdev->usage); -- 2.53.0