From nobody Tue Apr 7 14:36:48 2026 Received: from mail-wr1-f53.google.com (mail-wr1-f53.google.com [209.85.221.53]) (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 730713876BB for ; Thu, 12 Mar 2026 21:07:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.53 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773349637; cv=none; b=Op2hfgg2LKcBwJqM305a8rbMpDZfl/Y7Pgtuj67IZnhm6yDSgxF0BHFeGyxux1cD38C0GoAB0Oi/G4Qcw+kJTpkmfPvsS3AiK2XW1lS+m3MHzHFizMDZP1E1udWEM7BHEdUjsMQQ3d3oplLcfo2AnqZb/8KrDSYuOatqvo3FlvU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773349637; c=relaxed/simple; bh=9gG3wqs+eoj6PWo97on+0MLsVivSeibJ8oWlHghoREk=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=VKAmp00cM7Sz8V/gv3ZLwwEs4+YhbGftS/9VIFxAuKcP1JnBsHAG/utepoB8MKnHUoV0eG1NpJzI32nwrRJxH43u0dafn89d920Nn/fHTNuUxaEtyq6G8Cc1uqo5uglweW1j2KvcdLbmTKf6aY4SrkjYBUr5Tb8AnS9EYXSjMGE= 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=j8NNPBpX; arc=none smtp.client-ip=209.85.221.53 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="j8NNPBpX" Received: by mail-wr1-f53.google.com with SMTP id ffacd0b85a97d-439afc58ac7so1815337f8f.0 for ; Thu, 12 Mar 2026 14:07:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1773349635; x=1773954435; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=c7PJXadpofuFYWHdYoWUxU7FNlHspcolSnOK601aB6Q=; b=j8NNPBpXko2M5ZWNSyp56jjHjdwieZmN4RhXmJg407qiu3gt/qPF2kmS7UFVGXT9Ju ikSDZFeaoVcy/u7Ji2+bS1LD8QiQSwxdLFCjmLSJT0Ch0kTgpuAHKmBYdtz/bkHSSf23 oLAE54Wcoyo0iLg2Vy24IewBiTAe8Bd9rILmRtte7ETnCZy//QozQh90tB+3y3iScvpt TEKMNPpSFKpOGnMUMxCKkga7hgj/0J/ff0iLZa/ELjVNjQOOc8jBtb5nG4giLxQ/35SF uqkH+Wf/u9uItlDJGlNsGCDxbsrHm+Uw1iZQjNe4dZ5lZuYxlkRCwEJ4SqF0yWyk5++Y HAnA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1773349635; x=1773954435; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=c7PJXadpofuFYWHdYoWUxU7FNlHspcolSnOK601aB6Q=; b=VZeeWVwlbmYSxmZzzWRqvnI6JmlRRfrcsjOqk16aYG9tTyLS+jz6HAHnYDLeOAj8cA vddeEBEekNkV86XkQjE1BPVY5Mrm8KnA09NObYGTmkS9724x21bEPhVj2e8v53YLvego X+e/xfpNtKuxkkKcQJc3vY1jZJE1k+jUdqegNY9MrAeUa0u5uOULBezcfRRHJ6+hh3dS UnbvP/Gm3YWQv3WHHkpmCo+OnD4S0hc6CTuIk43TgFEDmOLoMFCezNSMqoxLZadSwrdK 3Gx6HqBn9eg5+qtpg8SrccyjZco2og2bGXWScsKUw7eLs8AOrqp38fbZl+nTBLsNZg92 ygOg== X-Forwarded-Encrypted: i=1; AJvYcCWvCwLsKqoya2rz2Mnz1u6DkNdI7+O+VPt4W6P18JW69/Tuo7cp2GDDPjr73yuFp9GNw7oglD61d4PATRI=@vger.kernel.org X-Gm-Message-State: AOJu0YzFi2LzDfiAudETX1kNUxs0WtPRnMVZIV8YZQ/vBQtVy19wzw2M R3F9J0giHLEkAP7A1twKZGaBZnSJaka+Ib5uy93Ll1Mb2t1gLIvrHmjl X-Gm-Gg: ATEYQzxtIKIh1wpBvJh54P6WQkt4wRS1fDyZ3X37BxPW7soVVuAEU2Vr2Pa7lvsEqVw 1SJxsEUfwenZI9ReoFlhuIEpMZGwNZokzTB5QEPU03YDmXWeTuHgLHetse9FFeNF4Vj4FwjWdmk 7OzwZT2Y7fTCbvoZsydW2vZ0S6v07umq2DEt0D+KmoJpFpuo+ioSG0TtXpTYaWCbDwI/cqe2qbs 93I/gLFvCqkmLYmTwM7HHiBZNN5hpID8WeeNPdll7+eqc6QL3kuYCSPqkfAPlJz2mzV7SvBxNqb MeX+A01jD4/taV9OofoMOMnVvZP4InTN+bePPtkmYYNNohtRAIWAEfT7BCKAKao7LXPp4S312s0 GSndw9tsmipzlZC9qSwtf6Cd69MUwIP+4zrt5NwT+eSk0gdE+15plgYDGuDRCVCO+7RTf0J+we/ z6d7lRQfeLLq4dAP7j2Vhhykr6+0yj/DN6feY= X-Received: by 2002:a05:6000:2c04:b0:439:d928:d783 with SMTP id ffacd0b85a97d-43a04dbbc7cmr2334916f8f.30.1773349632423; Thu, 12 Mar 2026 14:07:12 -0700 (PDT) Received: from localhost.localdomain ([147.235.207.31]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-439fe19aec5sm11025362f8f.4.2026.03.12.14.07.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 Mar 2026 14:07:12 -0700 (PDT) From: aviv.daum@gmail.com To: wim@linux-watchdog.org, linux@roeck-us.net Cc: linux-watchdog@vger.kernel.org, linux-kernel@vger.kernel.org, avivdaum Subject: [PATCH] watchdog: mtx-1_wdt: synchronize timer teardown in remove Date: Thu, 12 Mar 2026 23:06:45 +0200 Message-Id: <20260312210645.10613-1-aviv.daum@gmail.com> X-Mailer: git-send-email 2.34.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: avivdaum Replace the ad-hoc completion based teardown path with a proper timer synchronization call in remove. Stop the watchdog and delete the timer synchronously using timer_delete_sync(), then deregister the misc device. This removes the open FIXME about locking/testing of queue teardown and makes the driver follow the current timer API pattern used in watchdog drivers. Compile-tested: ARCH=3Dmips CROSS_COMPILE=3Dmips-linux-gnu- 32r2el_defconfig (drivers/watchdog/mtx-1_wdt.o, W=3D1/W=3D2) Compile-tested: ARCH=3Dmips CROSS_COMPILE=3Dmips-linux-gnu- mtx1_defconfig (drivers/watchdog/mtx-1_wdt.o, W=3D1/W=3D2) Compile-tested: ARCH=3Dmips CROSS_COMPILE=3Dmips-linux-gnu- malta_defconfig + WATCHDOG=3Dy + COMPILE_TEST=3Dy + WDT_MTX1=3Dm (drivers/watchdog/mtx-1_wdt.o, W=3D1/W=3D2) Signed-off-by: avivdaum --- drivers/watchdog/mtx-1_wdt.c | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/drivers/watchdog/mtx-1_wdt.c b/drivers/watchdog/mtx-1_wdt.c index f75426cfa..85fe006de 100644 --- a/drivers/watchdog/mtx-1_wdt.c +++ b/drivers/watchdog/mtx-1_wdt.c @@ -33,7 +33,6 @@ #include #include #include -#include #include #include #include @@ -46,7 +45,6 @@ static int ticks =3D 100 * HZ; =20 static struct { - struct completion stop; spinlock_t lock; int running; struct timer_list timer; @@ -69,8 +67,6 @@ static void mtx1_wdt_trigger(struct timer_list *unused) =20 if (mtx1_wdt_device.queue && ticks) mod_timer(&mtx1_wdt_device.timer, jiffies + MTX1_WDT_INTERVAL); - else - complete(&mtx1_wdt_device.stop); spin_unlock(&mtx1_wdt_device.lock); } =20 @@ -204,7 +200,6 @@ static int mtx1_wdt_probe(struct platform_device *pdev) } =20 spin_lock_init(&mtx1_wdt_device.lock); - init_completion(&mtx1_wdt_device.stop); mtx1_wdt_device.queue =3D 0; clear_bit(0, &mtx1_wdt_device.inuse); timer_setup(&mtx1_wdt_device.timer, mtx1_wdt_trigger, 0); @@ -222,11 +217,8 @@ static int mtx1_wdt_probe(struct platform_device *pdev) =20 static void mtx1_wdt_remove(struct platform_device *pdev) { - /* FIXME: do we need to lock this test ? */ - if (mtx1_wdt_device.queue) { - mtx1_wdt_device.queue =3D 0; - wait_for_completion(&mtx1_wdt_device.stop); - } + mtx1_wdt_stop(); + timer_delete_sync(&mtx1_wdt_device.timer); =20 misc_deregister(&mtx1_wdt_misc); } --=20 2.34.1