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=1796381803; b=tWLMHRzFCwxjCDSwG3ouP+Fjwp9oy4yYjaH1Ak8fSLTNdoCFnT3V+BDxIRlszzyFsUmV 1Ez4Ov/8VtjZl3UYNzFO/5WFSt4v5vnK76cxfh+ohBjnsE1IScUJXw8InwfLd8+YnHxoV pMPSuzHwdVw/zy6KDAQ4EE6rDRlgqUkqN8gnmMLksFzBIx0KWECj1ejNTeXudeI5vBUyi SZ5NHTH1ZCk1CIXcTay+Z9MwoaFVAJSXHmV0AgavyjLZV30dWNocIbY9EPWagvn4FOItF FLAd2AQPC8IYsINRtxLBDAdLrqPNV8NMcW8BdV6uugnfEzmhFb/JLM2E7nGisysjMSw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796381803; 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=UNPUkJY7rnj7NarCBANHKPUnTx7yDJY+QbEQYB+c03o=; b=B43FBXyFOVhVB/0Z9Tl+SvqgizC0u/ObHAwWBuvVIhfpSif+fRUo20Q91r3ZvCari62D 1zoMudOK4nrpBOwuyVV6/m8v8yBPKgVMVPrHgvwdB/FzzO+mc+KeBqC4CHF5E1+uxN5h9 2wSazjlfQtekmI/WW2u278QI/sibWKSkb1LAj2spuvy5QWa62NPyFTOcOTPp4Vtxw3+t+ TWzlyVXQGXHLL7b6gvlwihpEYiUKOIUV/4dQO4XuqEjWXmgKUw8x/Tfa9Vn7TI/0E/RaE OrDpVfeqHAGdkvKdytO59ywgivPZsgSqJA/fCo7uqw0cbNGaQsi7kQ/gkA32kaGGcNA== 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=0bJGCEln; 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 E9AC1606A685; Fri, 4 Dec 2026 10:56:42 +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=0bJGCEln Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6D30E1F00897; Fri, 4 Dec 2026 10:56:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796381802; bh=UNPUkJY7rnj7NarCBANHKPUnTx7yDJY+QbEQYB+c03o=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=0bJGCElnhgQhzK7j3qwIbwxSwlp560S5oj2iqXQ3mNmDYyRL9rqe2aWPdfLe4nx6V ottL5tOV+eD3Y4JbOtUZ2B/1lzYqR/p/G3bNoYO08kxftmUNvI3DLyI9Od3CbPHQzB 5J0MCEl6+ICqy3nPNrDo/zp288O9vY6xwPNpw4LE= 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.18 179/703] HID: sensor: custom: Disable sensor before hub close on removal Date: Fri, 4 Dec 2026 19:01:18 +0900 Message-ID: <20261204100632.630962264@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204100627.522266145@linuxfoundation.org> References: <20261204100627.522266145@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.18-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 90e11c4533019..2aa71530a1a30 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