From patchwork Mon Oct 2 07:05:34 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Kiszka X-Patchwork-Id: 728705 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1C5DAE784A5 for ; Mon, 2 Oct 2023 07:06:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235601AbjJBHGq (ORCPT ); Mon, 2 Oct 2023 03:06:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36076 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235646AbjJBHGp (ORCPT ); Mon, 2 Oct 2023 03:06:45 -0400 X-Greylist: delayed 62 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Mon, 02 Oct 2023 00:06:41 PDT Received: from mta-64-225.siemens.flowmailer.net (mta-64-225.siemens.flowmailer.net [185.136.64.225]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6D851B3 for ; Mon, 2 Oct 2023 00:06:41 -0700 (PDT) Received: by mta-64-225.siemens.flowmailer.net with ESMTPSA id 20231002070537944c19840ab7298e7d for ; Mon, 02 Oct 2023 09:05:37 +0200 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; s=fm1; d=siemens.com; i=jan.kiszka@siemens.com; h=Date:From:Subject:To:Message-ID:MIME-Version:Content-Type:Content-Transfer-Encoding:Cc:References:In-Reply-To; bh=UeQxNF/pyRJG0Fd9KRF4hH9/vU2c0g3HcHKzRK6U9Tk=; b=Du6iD3mNdhEvtl8fP2nUfdCb6OEcn7IPc39ERtmFLJzaP5tNxn2g6pxBkvCwoMhWmrC4h3 Vw0meGvBmgLbuKs+N5ty9zj+zV6d5s/Upi/LVsN1b+OYkmgTNBp8yRS/M3E54Pd/XB7ssHi7 zBlxJpJ5TdbTSY/4FGfPF3jBCB43o=; From: Jan Kiszka To: stable@vger.kernel.org, Mika Westerberg Cc: Wim Van Sebroeck , Guenter Roeck , linux-watchdog@vger.kernel.org, =?utf-8?q?Daniel_P_=2E_Berrang=C3=A9?= , Malin Jonsson Subject: [PATCH 1/2] watchdog: iTCO_wdt: No need to stop the timer in probe Date: Mon, 2 Oct 2023 09:05:34 +0200 Message-Id: <9eb28b8f238ee8bdd147bc66806321a9b7dcb90f.1696230335.git.jan.kiszka@siemens.com> In-Reply-To: References: MIME-Version: 1.0 X-Flowmailer-Platform: Siemens Feedback-ID: 519:519-294854:519-21489:flowmailer Precedence: bulk List-ID: X-Mailing-List: linux-watchdog@vger.kernel.org From: Mika Westerberg commit 1ae3e78c08209ac657c59f6f7ea21bbbd7f6a1d4 upstream. The watchdog core can handle pinging of the watchdog before userspace opens the device. For this reason instead of stopping the timer, just mark it as running and let the watchdog core take care of it. Cc: Malin Jonsson Signed-off-by: Mika Westerberg Reviewed-by: Guenter Roeck Link: https://lore.kernel.org/r/20210921102900.61586-1-mika.westerberg@linux.intel.com Signed-off-by: Guenter Roeck Signed-off-by: Wim Van Sebroeck --- drivers/watchdog/iTCO_wdt.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/drivers/watchdog/iTCO_wdt.c b/drivers/watchdog/iTCO_wdt.c index ced2fc0deb8c..96ff06d7d735 100644 --- a/drivers/watchdog/iTCO_wdt.c +++ b/drivers/watchdog/iTCO_wdt.c @@ -424,6 +424,16 @@ static unsigned int iTCO_wdt_get_timeleft(struct watchdog_device *wd_dev) return time_left; } +static void iTCO_wdt_set_running(struct iTCO_wdt_private *p) +{ + u16 val; + + /* Bit 11: TCO Timer Halt -> 0 = The TCO timer is * enabled */ + val = inw(TCO1_CNT(p)); + if (!(val & BIT(11))) + set_bit(WDOG_HW_RUNNING, &p->wddev.status); +} + /* * Kernel Interfaces */ @@ -566,8 +576,7 @@ static int iTCO_wdt_probe(struct platform_device *pdev) watchdog_set_drvdata(&p->wddev, p); platform_set_drvdata(pdev, p); - /* Make sure the watchdog is not running */ - iTCO_wdt_stop(&p->wddev); + iTCO_wdt_set_running(p); /* Check that the heartbeat value is within it's range; if not reset to the default */