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=1796383373; b=4nFiBspzKG2qRC7wKc2ry0cLOuSH1Cf6ur32sPzZPOEKaAgE5E0Ixw1fUl8csU0cybeb 2xoC08go3NUIaVXoX7HGDU+bCoLqzOtF+S3kYBabIce2o5aVTjE9FzDm+glUQBZfWyb7W lFKvFM6YFBRyWR8le8erd+bm+JSi2bUipAbiRB9xy0NZP3Qq/dqLVReYgwdt8j8AQ7DAE 4fJQZAg54E83nY40nypWeDZxlI5jDNktvrrcJRisqa1v7FYQ4CBfy0MKYo+LNjPVmOxF8 Ia/IyBkJt4LxUPn8wAMUfy5c8fjegrIjn1D5vuxLVv6HRz87iz8JsVsgWDvt5Ze6IEQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796383373; 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=QWEIVvQOWQ24oebR/4YTY5gaN7isyufa9UXLJlYFZ50=; b=eH1jhiSNAEnYtIe69nUMPIQIogqFHpPwXFo5uXjVj2G31/aI4gH75bEMNWDbolwa9JQS InJwwTF1SLuQvPz+BPRJ0HSF4IjVG2CgaJDFugnMkKqCeyaaFs85Nw35BQpvdQIhasD75 t0KXk8xGqN/bWTMgzct9SvRZGCmEVd9J0ftlij3zCFb8Y6nIucB8g15FSCciVV6YQKFKi mCUlrXuPg4f4/H1Lliy13BHJB3p3HZ/7KPTWJeHAYjC0006hdJ5zi2sT2/E75e70gCi68 asp7qmscERFQc3kyKJXUMRBZXIv8EQi7SJlgkdYmeEMvuCDwu5ln53EGjdxw3KXamuQ== 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=2jZdqDH6; 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 20999606A32C; Fri, 4 Dec 2026 11:22:53 +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=2jZdqDH6 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 94ED51F00897; Fri, 4 Dec 2026 11:22:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796383373; bh=QWEIVvQOWQ24oebR/4YTY5gaN7isyufa9UXLJlYFZ50=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=2jZdqDH68GkoP02ppPuE8VwN8jHyRCTArf4usEQB+cbdvq13GSUNzZX++oY3y8nuY DLrngQMpJjo1TCHbFVcG9va5K4vmlkpB4ZEVmMR0qohXZjOorpredS+lKwndsxy/GM Q7aPT1EUq9z326oh43oqdB4iYZVASm6iFFap6j8c= 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.12 199/555] HID: sensor: custom: Disable sensor before hub close on removal Date: Fri, 4 Dec 2026 19:04:02 +0900 Message-ID: <20261204100615.816298580@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: 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 cc0be03a49314..b8025ad8189ad 100644 --- a/drivers/hid/hid-sensor-custom.c +++ b/drivers/hid/hid-sensor-custom.c @@ -1053,6 +1053,13 @@ static void 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