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=1796389040; b=2M5DCAJoJgDCSw/7awUsWTMq39M0fNfDQ1lX0Y/97VVMK9aKs9dI6N7gA0Puo5bKbd0Z l8irI2iuLx2s9BY6EBeMcfJtIMVqFCHE1NsMSKix9EWudFaCjB5vnyw5XmJ0rvGJ6myE9 4EVAWA0Auokd2ITSyCLtyNDUQsIbd/faeIXF37zqHwf8mBjDfthFRlIIXQXMZK7cpDeiD Z46gA5zXNahdpbV8o37TGhLlzy0sBKbUOYvLWTf4GV+D4DZZrd5mdYG3SdNw4xuQJ9XjI lJ29zJ5dO5GLL8Gs+U//7YiQAo+0vvXTLneuWMFwGF68b9UZd8hSygEQaVOu9TYgpsQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796389040; 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=ufKlOroFIYt4z7Ri0kZoDLbecZviWPixZBXzJwQ94FQ=; b=BBemKtUQnOGFHMOGjiZxexg9IV9zctIryeiZAKYdLS3yD8985ZCbxtEQuavaNO3ZKe8V VUQfhwI3n4UHtsLCnDx8VJDBmYLKWo06Gic/KbzV/epNSAx4rNCL5gL7Y6UdL5Q9KKY9s UUUpEOgAfwV/yK4TjCCY5HJGUmBU13RQ7tr70h3c0WN05WCW3EGzYW5GhoNFC2rGiweKj auQdTL/xLEPGaERoA0G/NyUi7VFcdj75H66ZvTUjjgRlbqnRHgGmcfbu8Is6UzQEewsiA 5g+dfzfnosRE19MeL2sa6OupE0vQFjcAOY2TPfPVg2dob2y6sPwoNGcLCIWCptGFslg== 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=MrWSoBEQ; 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 27E0B606A322; Fri, 4 Dec 2026 12:57:20 +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=MrWSoBEQ Received: by smtp.kernel.org (Postfix) with ESMTPSA id 60E7B1F000C2; Fri, 4 Dec 2026 12:57:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796389039; bh=ufKlOroFIYt4z7Ri0kZoDLbecZviWPixZBXzJwQ94FQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=MrWSoBEQLye51D6c4+l7k8SVifeIi4OeK750C8GXsGA8nBhnBsL0hGPHZKxtKC8EZ za/0tct8mcsD8t6JaI+nN9BeisLCPgrO/BWJ0M2NwdTNs8MKO3w6pnsJ79PFoVRBE+ eQDCZZAYtsyPQYSQaD506+/jO7fgUTMiMMbWxvHE= 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.1 0804/1059] HID: sensor: custom: Disable sensor before hub close on removal Date: Fri, 4 Dec 2026 19:05:35 +0900 Message-ID: <20261204100704.853920402@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: 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.1-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 23f99a76077eb..5042a70649907 100644 --- a/drivers/hid/hid-sensor-custom.c +++ b/drivers/hid/hid-sensor-custom.c @@ -958,6 +958,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