Received: by 2002:ac0:e34a:0:0:0:0:0 with SMTP id g10csp514984imn; Tue, 26 Jul 2022 02:00:07 -0700 (PDT) X-Google-Smtp-Source: AGRyM1seeJbMCShCFdmY8FgcOQeW6VCgNE/BzHVwznM1uKLthvv5pHM0aLmEBc6QajsFpI77jgrq X-Received: by 2002:a17:90a:b703:b0:1dd:1e2f:97d7 with SMTP id l3-20020a17090ab70300b001dd1e2f97d7mr35881335pjr.62.1658826007207; Tue, 26 Jul 2022 02:00:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658826007; cv=none; d=google.com; s=arc-20160816; b=jUMzZMKwm5UvTmppARacAhQFh12wB15LHPQD5EKW1IuvXE6+4x0/2zvGsZgJHVixOr HCmx+2Gv7zZgT+dtkOTt9tpLuTmhRfcAoZYIkWlGcut0uIsPwU29eBUFcQVXWamcdEsm Kua7iwZzWcdFEHBLXnehEIUTZNDmfksFJbczsSsEr0IEznj1xXEYmpqOwBMSXPEcTm6P CinxojWiAHmIezzNDhRiYys255IxDTz7rcYdRWMxbdWBtVxv+4T2mhjMPDsiQj9ISW0k 6E/sGi2kN1BZeKU94uFqYrAFO/t//Y2Nrffb01qSY2AbjOHHBCsBKbYUbxeGMGmQRg4L dJuw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=ql2LhgxfvEB61pFX7hWwJ80/vdd5BunRWAQF0vz+eDU=; b=eRr5zpcraErmHVfOoz3zknfr//5h7c0NkcMpgxb85At+BG+7EmDqVH8ct17yznHWLa fCwKMv/RbWeBa57NeAphXy0UFZG629NoM9nBWMfWU4Fo3XDMhQGyF74ub1DI1rX9ZkvE m4hplOuFo865NtNinfompynjo0QtWRzSUJrWTTbPlBq0uvE/R5iRze348nmeMriZC9Dj uSITCtuqexCSwlBOFlHgTzQf88WUBsl2TUp+T5cppKT7Zd7XyfETRnMtOOiSGR/LPcbV qkVp6N5Z4ZJRV6lZykhWFjACQxT62lkwcCa2O/JHgCj3/CDkwBYVXM/mzxlJ9lWj8aho P8YA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=BfnT7ng5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 7-20020a630907000000b0041998725e16si17346442pgj.508.2022.07.26.01.59.50; Tue, 26 Jul 2022 02:00:07 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=BfnT7ng5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232079AbiGZI4m (ORCPT + 99 others); Tue, 26 Jul 2022 04:56:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39810 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229746AbiGZI4l (ORCPT ); Tue, 26 Jul 2022 04:56:41 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DFAE7B4AD; Tue, 26 Jul 2022 01:56:40 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 8C7B0B8128F; Tue, 26 Jul 2022 08:56:39 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 091A2C341C0; Tue, 26 Jul 2022 08:56:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1658825798; bh=SMBADMV9je+BEusk6Ogun7zma2H0hMl2CeFThJT1Avg=; h=From:To:Cc:Subject:Date:From; b=BfnT7ng5u3yHSC1GNkZJ0TbbZQA6+U2ayCPn7p9JRsZSiNVG0cjeOkKlu8fi0DZdp cw+CBCodKycpuwzIJCuqDeW0GX2O/iUn3EmrF4tuCL9BuCICiBK6ksB24QDmXkjrb1 LNFs85uEQ5640j6wvjFRMteOHdGpgpS18q2TfqEX3q3/4rp+cn5DSnhsGOBoYVuB0n lwjBnQoVyoWp4FyQ8rlO9XSf75WmpO7PqfzLRsEFxN3LKuQCzla6cdiSaYIRO5b5Vb kd9xChigezw9X1JQccpNEYKj7R9H3QBrLqkqbZNXWZnUaAVTakyRkbB8b1syXIY3jT KtXmCkYl8SM8g== Received: by pali.im (Postfix) id AA6F282D; Tue, 26 Jul 2022 10:56:34 +0200 (CEST) From: =?UTF-8?q?Pali=20Roh=C3=A1r?= To: =?UTF-8?q?Marek=20Beh=C3=BAn?= , Wim Van Sebroeck , Guenter Roeck Cc: linux-watchdog@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] watchdog: armada_37xx_wdt: Fix .set_timeout callback Date: Tue, 26 Jul 2022 10:56:12 +0200 Message-Id: <20220726085612.10672-1-pali@kernel.org> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org ioctl(WDIOC_SETTIMEOUT) calls .set_timeout and .ping callbacks and it is expected that it changes current watchdog timeout. armada_37xx_wdt's .ping callback just reping counter 0 and does not touch counter 1 used for timeout. So it is needed to set counter 1 to the new value in .set_timeout callback to ensure ioctl(WDIOC_SETTIMEOUT) functionality. Fix it. Fixes: 54e3d9b518c8 ("watchdog: Add support for Armada 37xx CPU watchdog") Signed-off-by: Pali Rohár --- drivers/watchdog/armada_37xx_wdt.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/watchdog/armada_37xx_wdt.c b/drivers/watchdog/armada_37xx_wdt.c index 1635f421ef2c..b84cba94b135 100644 --- a/drivers/watchdog/armada_37xx_wdt.c +++ b/drivers/watchdog/armada_37xx_wdt.c @@ -179,6 +179,8 @@ static int armada_37xx_wdt_set_timeout(struct watchdog_device *wdt, dev->timeout = (u64)dev->clk_rate * timeout; do_div(dev->timeout, CNTR_CTRL_PRESCALE_MIN); + set_counter_value(dev, CNTR_ID_WDOG, dev->timeout); + return 0; } -- 2.20.1