From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pf1-f179.google.com (mail-pf1-f179.google.com [209.85.210.179]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id ACD3E282F3D for ; Sun, 26 Apr 2026 09:17:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.179 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777195068; cv=none; b=tnJQggoXxXuVLCM8KuCnGvlFwF2CgyJ3x3Hx7BnvVLbqyvo4xD+9PFrBCF67Gg7yfHgp43Mx4fPUQkToCeKXxAunHD6jR1q+MPfYzC+Mqtdj9D9/RAA2B6Lcw7W8m3RtulI7oN4dIMZy3eQ/kLMQKodifiUg2g4jlRgq8QDZAmA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777195068; c=relaxed/simple; bh=0cP/SpEuIRnMTsbwa6oOuewBFl9Xc1IhNPqjtx4GWJo=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=JPafDKzR62IMcHeDgnGWMdMxG+V8XfNBYDq4N70eVB1kJICYuxHTeCZ1pkPsCyZHyQ/oOpExmHA5BjU1FWaY6TGibDf7JWDfyIBUTagU4fGOBHxqUZZ3wSS2/b/RwhFUKUmuFFjj3+tFaioSMi3LaM9wIBQekq86yZbrEusvvDo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=QegaQhjr; arc=none smtp.client-ip=209.85.210.179 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="QegaQhjr" Received: by mail-pf1-f179.google.com with SMTP id d2e1a72fcca58-82f0884bcfaso6313420b3a.1 for ; Sun, 26 Apr 2026 02:17:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1777195065; x=1777799865; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=+RvA9yofPmrJVN1v7H/Y57b209Sd9mb+5g5ouS/KXC4=; b=QegaQhjr3WUP0lBleJbOGZM2D6nvdUQjDjxk43JUrmswUBpIW0cnTvDzhiZ/G5CGch tCiB/mA3s83OzO4iK1EVXohiyeL28hs6ot4SxGn65FVFo6e+Q+w6g9bJdc8v4H5C+mSk hSISR0yupjz7u7ISUFx8d1r6Q2KlltqIPRbY9Bco1NXm5+4Xfcp2k5BSd/CbUS8fTFPY IfAIwKXxrwt/kppyK0OBRfLTqrOD2rVHAw8Dvv9gjFlklhYht/wBbWnPR8cVwswvB1i6 4B8C2STzPTK2EEm4X0kLBLJ6YIOngFCbBAkO6UqDz+eqI9dkK0cypNVJgvzlBEergeH9 caZw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1777195065; x=1777799865; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=+RvA9yofPmrJVN1v7H/Y57b209Sd9mb+5g5ouS/KXC4=; b=UeQ9ZK0CsQCHiRras1sA6wSnPG4sPkKQrsKiJnX/FlxVo2FdOhRXkeZfrUZoby8iqV FHsw37BeRxV/WfTIioyY78q6vLULVGgJPW14sTc8Z0zKIuP4MktD5BBGUjeikhZ4yApv qqI4DXTUT4e3sjsInXx3OsMYBvDR91pJHZX9udtI/SgmQoX2dh+d18FE5VNsdwIe97XA +Y0hXfmzR0DUmoYh64kGZqVj4b+hWtMdNtbzK4OOWZkFDTfT2FpSMOt8QYtgzYqO3vSh Ed478kAFAiVknqcK64K6h6QX2Y4Nh+s6T5UZuwIgxwE0DxybayXerYWKphDVFCsQb6KL 7cJQ== X-Forwarded-Encrypted: i=1; AFNElJ/uOr3m5tkhgZnqIogpF0dUwgFgLvqQT83EEBRBteSK4JqA2dV46kBZgodgQGupA3WImiEMbEsleG5k66w=@vger.kernel.org X-Gm-Message-State: AOJu0YzPpZ4W/17iNb8crYAni0r0LwhTaoAU0cVjChukWIRWxMZo6EDW qCd2vHT6XBglDYoVRUSQWwP3PeHrGsIds5K5xLSt2W2GCkHt9a0gAPGA X-Gm-Gg: AeBDiesnREPOJGEr7oyzGVswfCiKQcSiaf1G2Nq3KJlx/rw5dffp228OaWwHtNqqu4/ 0zq4C/ddBzu+po82xbK31bAMe5PUJbavkDfywk35GFk+Y2orZMsoM06ilo/nQPJDJOpSFQmtzKK 6I/fp8N1AIRl4VXUHR7dp9VfEbZ5OHM7rbuEzO1j20EYj9J0LFzWtDfAW+imEFmX37m3lrs93SP w+BhgKa3ZV+Bafyq2I1ozPYgQ+IgSSF1wzmHA1Fdk8IJ/rtFzKP6Hm9i3Rbl5Zlc21xcLuTxk6u vRxhdKm3E8+G8L2fjSL1sCNUWO+GWfggVHuCnazqUu92oO1O+7AQZC+eE2ypbJC/qdC4vmaf3XP oTI2+UoBLheahmnqdbAYQytISg+BFna/GRwM8mVda55CLDf9fk8IWrIy/ZaG/fpWeFFFgV7X2id WMqx9lB10C633ejrt+OdSOdby+F25EJRm1Uasfzg114IjxUCbwctk2Iin0OmQ= X-Received: by 2002:a05:6a00:8011:b0:81e:12f1:d8a with SMTP id d2e1a72fcca58-82f8c90497bmr41155497b3a.34.1777195065545; Sun, 26 Apr 2026 02:17:45 -0700 (PDT) Received: from hu-ckantibh-hyd.qualcomm.com ([202.46.23.25]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-82f8e982fd3sm36145226b3a.10.2026.04.26.02.17.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 26 Apr 2026 02:17:45 -0700 (PDT) From: Sanjay Chitroda X-Google-Original-From: Sanjay Chitroda To: jic23@kernel.org Cc: dlechner@baylibre.com, nuno.sa@analog.com, andy@kernel.org, sanjayembeddedse@gmail.com, mingo@kernel.org, christophe.jaillet@wanadoo.fr, nabijaczleweli@nabijaczleweli.xyz, kees@kernel.org, kyungmin.park@samsung.com, k.wrona@samsung.com, linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v7 6/9] iio: ssp_sensors: Drop duplicated wdt timer and work cleanup Date: Sun, 26 Apr 2026 14:47:07 +0530 Message-Id: <20260426091710.3722035-7-sanjayembedded@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20260426091710.3722035-1-sanjayembedded@gmail.com> References: <20260426091710.3722035-1-sanjayembedded@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: Sanjay Chitroda The SSP remove path cleans up the watchdog timer and associated work both via ssp_disable_wdt_timer() and through explicit timer and work teardown. ssp_disable_wdt_timer() already performs a synchronous teardown of the watchdog timer and watchdog work, guaranteeing that no timer callbacks or watchdog work can be running or requeued once it returns. In addition, the remove path disables interrupts and frees IRQ handler using ssp_disable_mcu() and free_irq(). The refresh work is also cancelled, preventing wdt_timer being re-armed before teardown. This ensures that no new refresh or watchdog activity can be triggered from the IRQ thread and refresh workqueue. As a result, the additional timer and work cancellation is redundant and does not provide additional ordering or race protection. Remove the duplicated cleanup and rely on the centralized watchdog disable helper. Signed-off-by: Sanjay Chitroda --- Changes in v7: - Following comment from Andy, Study the timer, work and IRQ relationship and how it would work internally for ssp_sensors and changes looks correct; updated the commit message to explain the race condition and information on resource release during teardown. - v6 change: https://lore.kernel.org/all/20260415050749.3858046-5-sanjayembedded@gmail.com/ --- drivers/iio/common/ssp_sensors/ssp_dev.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/drivers/iio/common/ssp_sensors/ssp_dev.c b/drivers/iio/common/ssp_sensors/ssp_dev.c index fa47282b39c0..29b17118ba2a 100644 --- a/drivers/iio/common/ssp_sensors/ssp_dev.c +++ b/drivers/iio/common/ssp_sensors/ssp_dev.c @@ -596,15 +596,12 @@ static void ssp_remove(struct spi_device *spi) "SSP_MSG2SSP_AP_STATUS_SHUTDOWN failed\n"); ssp_disable_mcu(data); - ssp_disable_wdt_timer(data); - ssp_clean_pending_list(data); free_irq(data->spi->irq, data); cancel_delayed_work_sync(&data->work_refresh); - timer_delete_sync(&data->wdt_timer); - cancel_work_sync(&data->work_wdt); + ssp_disable_wdt_timer(data); mutex_destroy(&data->comm_lock); mutex_destroy(&data->pending_lock); -- 2.34.1