Received: by 2002:ab2:6857:0:b0:1ef:ffd0:ce49 with SMTP id l23csp2404235lqp; Sun, 24 Mar 2024 18:06:33 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUTscaMRx48hYPHGARJddqS/29AstrxqkxDWpcGPFVmDI9uAIRbX6dmO4PC6XFylK9iPXMVrbRhXUBCEBCxDKmDBRaKG6n+uibIGqG52g== X-Google-Smtp-Source: AGHT+IGmttD7s2k3mvoVAj0071mAH+XFLFVcm/n/t7Shr/kea7LTtkxwNZm3BOEQJLqM0CJ+y7fo X-Received: by 2002:a17:903:1206:b0:1e0:583c:f6ae with SMTP id l6-20020a170903120600b001e0583cf6aemr7913772plh.35.1711328793024; Sun, 24 Mar 2024 18:06:33 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711328793; cv=pass; d=google.com; s=arc-20160816; b=Eoblj3aD+qjaTuqJF2LbYb42NKcUCKneHeT/SZOfg9NLle+u4o3qy4rWXqfwMlcFGv B9sPBtfNMNuq964YbhklPbNnKbl61Bzn7S9ofCFMhjWc4m7YDuJk/OMblVCoDh2NGQmc eJvkeKEVOLMKoBmqi2simRmIMy24CNak+JR9lJi5R7oPDt/atJPDn0EUGhkZwFQQNIYk +wGIJ8gSuDTML1W+JYgnm4HuaDADFvZiCHaz2bcDrmkQLcUOYszWlci094MazSBmUKih fbdm44U73TyZJySu74h4otUBM7zW+EbCZLE15ukbxKvC2ixL490+mhhfo66vLK5sDBxi Wi8w== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=930QzWhPKRkMNXfZ76aBgpS1cUMylTI2NV/tDDLtUIE=; fh=dcKls4TILnN58m/rp6CLqiBF+Gn2gEsOX9aNCx6x0lc=; b=D9ZakP42Gyad9r4AVqksrlEWZ3LvDSJ/2o3Zz71/sWii3fIZHnMvWz/eLRSPG2NFDA BH7trpAtIFmnBZb1QCxvJqH8ewrnsPkUYZagbDK2Hwr9bw/uldI0iiIocHNTdvFFoxs0 /0QWTdavClGn6OZ9A3t+qCm+FNvNGCGH5RdutSU9OwHzS6XQd4cEoXMrAOrVCImWvnrX KHd/U7PkIuqYFBrMqh3kIKQw+W/netN0zD12aS7fV0O3oDgF48M97uiKKcQUWQAq+haT 0iz8D1spyorX4Ri0LHFgMFejscnjktTOey4mcexIWvCKAPFDjdxj0VWQxZhec9n6kUxp EDhw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=TelSwhp9; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-113473-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-113473-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id f7-20020a170902684700b001dcc84cec4esi4214931pln.577.2024.03.24.18.06.32 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 24 Mar 2024 18:06:33 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-113473-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=TelSwhp9; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-113473-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-113473-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 8D765B2476B for ; Mon, 25 Mar 2024 00:45:52 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3D5DD1B4503; Sun, 24 Mar 2024 22:44:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="TelSwhp9" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5362E13BC2B; Sun, 24 Mar 2024 22:44:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711320274; cv=none; b=gKD5elA1lt02Ad8cz+uanXwmsxggUaJiY8JJHv/VzZcn/zLmWTQ+yfmcqvO1j5Y9x/ThaUl9eZGOc2KG1fTwETyCd76ZvJzTgRoaZjDkl2bGBUm+QSYh5GkeiWGckzyWq+5bbVOTR9vjhnpsReL2sqapPPGvGanyrUVGAcrdmo0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711320274; c=relaxed/simple; bh=Vygp2TWkGLy0BzP36pH0XzONz44hyfZcDWMybmTjJT4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=BDW/8OhmQns4nNbAyVvVXKO99sVS/h/nO0yLbSyvZ2pWjGADPWcNQtg8DeSwDjvTmVW17j90A6NGGPjtobPclSL/WyXOOcjL3GgSiUvsPNoH5v/9s7bJ9dstu/nmNwxcbHCh9iIic2vKmPuCxgRgIl267YF+kncnbq9W8SU2BWY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=TelSwhp9; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7C0B0C433A6; Sun, 24 Mar 2024 22:44:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711320274; bh=Vygp2TWkGLy0BzP36pH0XzONz44hyfZcDWMybmTjJT4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TelSwhp9v3kYyF7iBeIr6hD9vhTWcgr9YViBXu1PQGK3hI7Z8o44XuvTAXiWw5vjN TDOSBxV/tVEg5PbsIDnnQZpUgRHsic3l+mta0xpRgd1o/uXiawJpmVPnX2TRigGOdj Lv2kjtxx+LYW7mbxVoeyjbkmiqoav05A/fyi/nGRCo9FA0ilwGsf5nYp3Xfkc3xex/ csUqSIdhHankDmA1hWOg4zsCjR2IBvXk+2XB1YHU19nL0k/oCort6hQbXoVc3bvkbg 11TVTm1QMlVmvNbUNdOfLdTDF2tWSF7mENJmr6+gsaJRURV87tiXaSR6rGL6AMgKn2 YbjrjMPuKlA8w== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Ben Wolsieffer , Guenter Roeck , Wim Van Sebroeck , Sasha Levin Subject: [PATCH 6.8 582/715] watchdog: stm32_iwdg: initialize default timeout Date: Sun, 24 Mar 2024 18:32:41 -0400 Message-ID: <20240324223455.1342824-583-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240324223455.1342824-1-sashal@kernel.org> References: <20240324223455.1342824-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit From: Ben Wolsieffer [ Upstream commit dbd7c0088b7f44aa0b9276ed3449df075a7b5b54 ] The driver never sets a default timeout value, therefore it is initialized to zero. When CONFIG_WATCHDOG_HANDLE_BOOT_ENABLED is enabled, the watchdog is started during probe. The kernel is supposed to automatically ping the watchdog from this point until userspace takes over, but this does not happen if the configured timeout is zero. A zero timeout causes watchdog_need_worker() to return false, so the heartbeat worker does not run and the system therefore resets soon after the driver is probed. This patch fixes this by setting an arbitrary non-zero default timeout. The default could be read from the hardware instead, but I didn't see any reason to add this complexity. This has been tested on an STM32F746. Fixes: 85fdc63fe256 ("drivers: watchdog: stm32_iwdg: set WDOG_HW_RUNNING at probe") Signed-off-by: Ben Wolsieffer Reviewed-by: Guenter Roeck Link: https://lore.kernel.org/r/20240228182723.12855-1-ben.wolsieffer@hefring.com Signed-off-by: Guenter Roeck Signed-off-by: Wim Van Sebroeck Signed-off-by: Sasha Levin --- drivers/watchdog/stm32_iwdg.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/watchdog/stm32_iwdg.c b/drivers/watchdog/stm32_iwdg.c index d9fd50df9802c..5404e03876202 100644 --- a/drivers/watchdog/stm32_iwdg.c +++ b/drivers/watchdog/stm32_iwdg.c @@ -20,6 +20,8 @@ #include #include +#define DEFAULT_TIMEOUT 10 + /* IWDG registers */ #define IWDG_KR 0x00 /* Key register */ #define IWDG_PR 0x04 /* Prescaler Register */ @@ -248,6 +250,7 @@ static int stm32_iwdg_probe(struct platform_device *pdev) wdd->parent = dev; wdd->info = &stm32_iwdg_info; wdd->ops = &stm32_iwdg_ops; + wdd->timeout = DEFAULT_TIMEOUT; wdd->min_timeout = DIV_ROUND_UP((RLR_MIN + 1) * PR_MIN, wdt->rate); wdd->max_hw_heartbeat_ms = ((RLR_MAX + 1) * wdt->data->max_prescaler * 1000) / wdt->rate; -- 2.43.0