Received: by 2002:ab2:6857:0:b0:1ef:ffd0:ce49 with SMTP id l23csp2618957lqp; Mon, 25 Mar 2024 04:46:05 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUaNjoO/lyMHKbc86jD8iIHfV2+FXtBalVYh9r4swtNOrYLP4DweWzoy2y3eZRD6fyy5+4gpFAP7wFKvl9H12TmewSsn5RFVmgG9I/rKw== X-Google-Smtp-Source: AGHT+IEso8rpZHGLMG7qv45xK/qZY3A4LzLcWxjacWgnhT7HR5dmZByvVgMcK0bDFQPU8j4zcRYS X-Received: by 2002:a05:6830:20c2:b0:6e6:a413:8a73 with SMTP id z2-20020a05683020c200b006e6a4138a73mr9153132otq.20.1711367165271; Mon, 25 Mar 2024 04:46:05 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711367165; cv=pass; d=google.com; s=arc-20160816; b=Rui/za3tagC7e0TKpLvbEMZZsKv7wpnvOCkSyAJHS2mhlcP5aAaDxrrtpGpbCeZxZT p49I9wwS5xgf0QkaqNVhGw+iAUdRHFVCB6EwfKtdL7f7IQiFK1CcP45D1BvCytOoER/+ iJeTm4OvzSvG/sJ8RuOG9UIA7lvHo+RhrkGPS+AzrwCm7xM9BJ82/5EtYHxD5K+jC7om Nc2p/jeXgFeW8iuo12atSvQIrJa0/jS8v23oNbZ5hb2QPATWholDkYdIAmKsRYS8wrKe BYTKRyqYUKwLMfjSpx0juUrHLwkGfFoExCMQ+omTV5D1eEa+ErvAPeM7hJOiSaSlQ6/U RCnA== 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=/qryxlefIRFzn23ye8JyuUvAgBTdR73rKaPO7d9YdwU=; fh=dcKls4TILnN58m/rp6CLqiBF+Gn2gEsOX9aNCx6x0lc=; b=vNHUxk/SKcvijdztdU2oTj/TA13WE333dqs8JGkJHk8WtFeBNPaYQGy9NWPxAn6y2s hL1qWoyS217nsK2Xnlhl/PEprIbQlvPsSbtDIpmNdnxmziF85DHm60b25eFANA6mWQBE bxxUCc5W5peL8kBeJapNDDY9LxVjuFh5cRd03nM/eEEoEE02yb/eZh5bx0PHKJZFIPFu Kd8Qq2oWZobSne49316KWeWCLtBz8MFpmjt3PeFu05nUockCBWiUWSr+FMcd+khNCp9q bE+1V2gAwHD9c8hcg318azSckG0BBcUcCbZubSCNlAVGnCCqHmdkCQhwkqs//zdOAkth txbg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=uAb0BSop; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-116207-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-116207-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id dt40-20020a05620a47a800b0078a5de016ccsi200434qkb.732.2024.03.25.04.46.05 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Mar 2024 04:46:05 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-116207-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=uAb0BSop; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-116207-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-116207-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 01D3C1C352E5 for ; Mon, 25 Mar 2024 11:46:05 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3E7903BCEE4; Mon, 25 Mar 2024 03:33:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="uAb0BSop" 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 ABE132853C4; Sun, 24 Mar 2024 23:43:42 +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=1711323822; cv=none; b=jctRRdfpI6WXnrvOENVIfj2ydE1/+c1ZjcydrN93R2Bn5UKGNh+d8ru+26fheQfUdxFoCnMpbGBFIlyX95Lrrfr1s+6L2P6Vv17pNiCW6yv7pLegloCLvUrwdQJ0qdRAgUiHzJElmBbQNsGw9iX9NnbDfL5oYMeufGmcrmESbWI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711323822; c=relaxed/simple; bh=1HX/XtXY9tKoIkbNvy21lYq1+GU7W/u60Q5A+0A38Ok=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=GZpsqlX24YL/1MaKpFxhPvSsm2DBOAmzFeWzqe/853/BcySUv9tvzG6uvHuoX63N6raFnZxowKYVSP3IY2CHvaMR/hdaH9zt0vyXqWc172DgW2CpH4u+hvt3QCAXS4BkaAFEDHbEYg1dS0I5UvmZoJC0fU3y9UB3SMIYWKSXtNc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=uAb0BSop; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id D35CFC433C7; Sun, 24 Mar 2024 23:43:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711323822; bh=1HX/XtXY9tKoIkbNvy21lYq1+GU7W/u60Q5A+0A38Ok=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=uAb0BSopGYh8f+pI3MyPiuEndSKCtiluacQKI5FA28HDthvTCjlthv3nOQr0OeeDo 0J5ZSrH6lKELxMQM7dETjv3NgYhT7d0dd+b9zylNIqFsbffkDdV87nYxXtItDqZmoe FDr+y0G890M/PlDg4R/S9KvBfhnNkdPUs6BN0Fg+x8rZD3lLD8OqIEEkxu9x8AGcxR 5eJEauHUCX9dhSwH1YSlxriQ0oJWTRuelCNFd2e3PASUGWCTTFQtUgAtKF8MZ21jCo lugU8peUCnnONbrULMtj3NW/0iyPuCrfxwAY/egSnvUFqirG65IAcj15YDO6d+ijed vcLVPtmMVGejg== 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 5.10 201/238] watchdog: stm32_iwdg: initialize default timeout Date: Sun, 24 Mar 2024 19:39:49 -0400 Message-ID: <20240324234027.1354210-202-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240324234027.1354210-1-sashal@kernel.org> References: <20240324234027.1354210-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 25188d6bbe152..16dd1aab7c676 100644 --- a/drivers/watchdog/stm32_iwdg.c +++ b/drivers/watchdog/stm32_iwdg.c @@ -21,6 +21,8 @@ #include #include +#define DEFAULT_TIMEOUT 10 + /* IWDG registers */ #define IWDG_KR 0x00 /* Key register */ #define IWDG_PR 0x04 /* Prescaler Register */ @@ -254,6 +256,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