From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pf1-f173.google.com (mail-pf1-f173.google.com [209.85.210.173]) (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 461A43F8EB5 for ; Fri, 15 May 2026 17:40:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.173 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778866857; cv=none; b=OUaLJLHHKB4jj0Nl5QKGZGEItBuMhtu8pEka+KdHWmjdW/XXf6ejYC1+G06qK5hg105YWasQtglwvqgE14WVCljeyO+b63x5ZVaLhsrde80/5C6ZJWoP+/T3hwkXMoVoV0ACbU8ilSu4qEObTyTamGhVxqblTUyVn9KesrU8Jyo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778866857; c=relaxed/simple; bh=97ly4BjJHtk0X0D0XIMtHD1ZVF5yf0y6F7zT1Ri/QBk=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=PmAAAVnIBNqQ4LnWjvJjFgrl+j5kxof9ZupgI39+pZD+xiKtvIW2m/+FwHiTuu4YSEbjiE9UtmfhS84EtjmQ4FRieV06w5PveArmiLS8HM9yF1O47innair1y6VzJsuRqAyCK4SXOmbV5pWctG/PyQFAvECgY5mp6+b/0VkyK3A= 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=OlRzfANP; arc=none smtp.client-ip=209.85.210.173 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="OlRzfANP" Received: by mail-pf1-f173.google.com with SMTP id d2e1a72fcca58-82f8893bff3so55856b3a.2 for ; Fri, 15 May 2026 10:40:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1778866855; x=1779471655; 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=XgncZFBSo1Y+nwYmK2FCTW++Gfuechd40CMtdCuk34Y=; b=OlRzfANPwHqRzVisOAOubUy8Hv9R867klGQbFmaiovocA/u2AXvNhf4yAbRPtSSyiN 9dev/AukNcGeTAD6JiaA2GCLX+KQXeYcktXU1TzIl8K4NbVLfUqI4HmtWICDZFqD/vKi RI4+SFy/1O/BAXx4MhJzU5MwJZcCtouD7+AQxIp5oyi2MYi8ZA3UmzJbEwumYFjMPP1J 7QShPxNBHeTCbvz0pAloajD7cz2YWZHO4ZJiQAU3xOdT5LMItoBj6bn1Knif0OJYeFAa twBgEa0v9mkdrLljYGTkhqrsmQgEad23lT+LrDa9wIa+SDxgOohyPCGpAImhTehO4TTb hnvg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1778866855; x=1779471655; 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=XgncZFBSo1Y+nwYmK2FCTW++Gfuechd40CMtdCuk34Y=; b=aA+1+bvinu8O3M4fQ6pkg9IFSBHgngMe1w60ZB7XAy5XUOG9iWYJf2z9MZ4ot3f8sd yHuAjFrqakjyq5rPq6QFrwrGX0zfkcZKdT9XoYYFpgei/nBotwwM2HhqM3U4rf7l+02P 3zB4MnzGoLEogLfnXyTJKrcFLAXL2f6yTJqRIWrpevjL4UBqtBTaS8/H+Q2DGkN0ZamG SikfQvJ0bAIZ1rutb7dungXOI63HUTysFc+TTkPXkZ5xlXq1J5QevoPxpO+TsbAjKMWa n92Eew88aTyQ5tHIDzgbtZBgFZAM2xXm/WaCs6I5WLTmiMUuWdEY85NimBxK1wKiEHS8 deUQ== X-Forwarded-Encrypted: i=1; AFNElJ/NzYXU/aEs/SL0ySaT7FO3o5T/9BMxlFTjG9LK9/EX3qLTfdpr6dpmfHlm8Cp+cZ6Ubjsn2nk/4iE2BHk=@vger.kernel.org X-Gm-Message-State: AOJu0YzZHRTtKqL1h0lFAsOoYz5+LpbZ2ARThi6UHiTD+087bFI5Q/eJ eLWrxOee+xIjugbyH+7u6d1qj50x2ogTDicazh+XNMDpMU578VTj1LRI X-Gm-Gg: Acq92OFD38Wf3t3g3MhWRl38FywYS1oxV6PNQ0cBSN0jiphAWxDQ3Xn/FVn6o/lf0cX OQ/jkzZeuNh2kvg597wk3DNkSgCBFPQ4dbNJC8ayTA/7bwWaC7e//82EDNee7AaAZim02/KzHES D4ggKhH/cDdi6D68AsAoBu59y2Tqg4YMxaGAnkX3sdeV4falPS6241ZYQvgAIO0W0J8e+48tp8v qeIpRjcbJsaA5GOoTMJghS9nG06Uou8KV7z69xCUh9W0NkyY9Sl/Uocz+thG5RHH/6XTy6lIA+i JeMumiT+WuzTcmabhm/Ztsfi66dpZ7gFmDN0QIq90T8LGOOUBhHLHQQ0/yDC6PwyFG2b+p4AO5r pzgBOD7G1ok8j2wPQgia9uTW86pi+8W3NIC7HcahlesqPr80mml0jz56Dhakw/AfuxX+dM2oWC8 nJgKiKPKC4hnRXq4o6x+ARMDy43QLMVDNYkKTpinBzXnB8OE0k X-Received: by 2002:a05:6a00:32cd:b0:83f:250d:5ab with SMTP id d2e1a72fcca58-83f33bc8888mr5959617b3a.7.1778866855475; Fri, 15 May 2026 10:40:55 -0700 (PDT) Received: from hu-ckantibh-hyd.qualcomm.com ([202.46.23.25]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-83f2875f0fbsm5579034b3a.57.2026.05.15.10.40.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 May 2026 10:40:55 -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, tglx@kernel.org, christophe.jaillet@wanadoo.fr, mingo@kernel.org, kees@kernel.org, nabijaczleweli@nabijaczleweli.xyz, kyungmin.park@samsung.com, linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v8 07/12] iio: ssp_sensors: Drop duplicated wdt timer and work cleanup Date: Fri, 15 May 2026 23:10:12 +0530 Message-Id: <20260515174017.3962168-8-sanjayembedded@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20260515174017.3962168-1-sanjayembedded@gmail.com> References: <20260515174017.3962168-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. Calling ssp_disable_wdt_timer() after IRQ teardown is safe, as the watchdog disable helper does not depend on interrupt delivery and ensures all watchdog activity is fully synchronized before returning. 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 v8: - Add more information about wdt shifted to specific location and address comment from Andy - v7 change: https://lore.kernel.org/all/20260426091710.3722035-7-sanjayembedded@gmail.com/ 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 f3ad2b38cc12..88bb8ab0cd9b 100644 --- a/drivers/iio/common/ssp_sensors/ssp_dev.c +++ b/drivers/iio/common/ssp_sensors/ssp_dev.c @@ -590,15 +590,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