Received: by 2002:a05:6358:f14:b0:e5:3b68:ec04 with SMTP id b20csp847957rwj; Thu, 22 Dec 2022 16:11:08 -0800 (PST) X-Google-Smtp-Source: AMrXdXv26o7mzlqDDm/25eI+ApG9I8GEQBRuWeMqFYh8P1JdbmGFBbFnQWdnBhI2luhC357e0GvR X-Received: by 2002:a05:6a21:32a7:b0:ad:f2bf:bc50 with SMTP id yt39-20020a056a2132a700b000adf2bfbc50mr12004173pzb.13.1671754268638; Thu, 22 Dec 2022 16:11:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1671754268; cv=none; d=google.com; s=arc-20160816; b=D7VrroLXqspgdYfhxk3EJfYps5fwYJy7D+Lg8iV071q0+DOLH+7NH2jBNW2UzMyIZ/ 4SoquF/F5vM1iWROkAaoNa3FqT6qe+lfnFnGl9lid3m4l636X8IF3zEqauLLhe71fYGD zv6POI4AdMx8bxjpmbYOkZiL3jpS3zeVwkCPTkDYuWwg84NmCFe/EGn5bSib2BPUqfY+ +IRZ43/OYYslL+69onhNAcsIOd4LpMXmWdZnV0eFmxHT2Qcf2sjjG+E3Vv7jNhNe5Zce q3EVvB/yy9z6FsroCsJLu5l9QaHXDUmMZUMsz02Mr9t1J2Gl7nc0v/70p9CAZw7nC4Aj v7fg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:message-id:content-transfer-encoding :mime-version:subject:date:dkim-signature:from; bh=m7YHqP94C1MCIz9kIxKkL4Uq0CU8iH/KtDiBEoLOaJc=; b=cXwHJ6gU4OAICRcOxBw6fGrVNyyjBKR6+KL7uXXwPLVkM272NRBqfzX9gLpPrGAazh rxUHmWL5nOAV+yg0E79k28A1M5zEn8/s8uq87+bM+aLEC+rBCIp7s5yZW1/meHHbW0MD FkcInd0EQLDklsrUvmGk8DTtNdorC0ZX253EiPJZzrAPYgu/8Q8YtNRPWlTkYTSkFaVc HXPb5B8yF0Ht2Q/vquE2KwNw5jAqbh/zam/1KbHaWcTy/JVb7o/Qu0o46UQx9AyJ2NJY VnOa1pqO1xgC4pFHS04WsWl9q73AHvoyTjQbJQcNwiY3J54VTQzTq4aW9VkaUoKGDnxs dRCQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@weissschuh.net header.s=mail header.b=VP0YdWbZ; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c20-20020a634e14000000b0047856d87247si2193631pgb.603.2022.12.22.16.10.55; Thu, 22 Dec 2022 16:11:08 -0800 (PST) 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=fail header.i=@weissschuh.net header.s=mail header.b=VP0YdWbZ; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230042AbiLVXnn (ORCPT + 68 others); Thu, 22 Dec 2022 18:43:43 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38062 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229704AbiLVXnl (ORCPT ); Thu, 22 Dec 2022 18:43:41 -0500 Received: from todd.t-8ch.de (todd.t-8ch.de [159.69.126.157]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B305B252B9; Thu, 22 Dec 2022 15:43:39 -0800 (PST) From: Thomas =?utf-8?q?Wei=C3=9Fschuh?= DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=weissschuh.net; s=mail; t=1671752617; bh=YRRtbOkriQD0uKrpVN2szj1ZKTRTVm9GYpCO/Afsh8Y=; h=From:Date:Subject:To:Cc:From; b=VP0YdWbZMOG03Jh/TA3q3/ODmilc4hcQMMv/h9CqKbBY4/reriRjMfLY2aeu0/tQ/ UgK6LD47BkV00q0b44SH56mohfAI560cMfpbJGL3uyd8aaJAVvGu45Enkuwl+J2W3V 3IehfX5SmwvNoEfqEXno6J6twzug4y9WlMk0t8cQ= Date: Thu, 22 Dec 2022 23:43:31 +0000 Subject: [PATCH] watchdog: wdat_wdt: Avoid unimplemented get_timeleft MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Message-Id: <20221221-wdat_wdt-timeleft-v1-1-8e8a314c36cc@weissschuh.net> X-B4-Tracking: v=1; b=H4sIAKPrpGMC/x2NQQqDMBBFryKz7oDGjfYqUkqSmehAGksSa0G8u 4PwN+/D4x1QOAsXeDYHZP5JkTUpdI8G/GLTzCikDKY1ptPhTra+d6pY5cORQ0XXD9SS60caA6jn bGF02Sa/qJm2GPX8Zg7yv0PT6zwvXmsYlHgAAAA= To: Wim Van Sebroeck , Guenter Roeck Cc: linux-watchdog@vger.kernel.org, linux-kernel@vger.kernel.org, Thomas =?utf-8?q?Wei=C3=9Fschuh?= X-Mailer: b4 0.11.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1671752614; l=1576; i=linux@weissschuh.net; s=20221212; h=from:subject:message-id; bh=YRRtbOkriQD0uKrpVN2szj1ZKTRTVm9GYpCO/Afsh8Y=; b=kvC/KSiNttft91T/0qKLG3LekEaI63wN2JlXt1gan6g7uCqBxD28XSIGvODJHCJ6LBT+5MvWK7vt SgjgSpFpCYVQTvOD1IZtkbLc7/hKMHN0Lt5w2QV1rNpwv4MQ6Ywu X-Developer-Key: i=linux@weissschuh.net; a=ed25519; pk=KcycQgFPX2wGR5azS7RhpBqedglOZVgRPfdFSPB1LNw= X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,SPF_HELO_NONE,SPF_PASS autolearn=no 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 As per the specification the action QUERY_COUNTDOWN_PERIOD is optional. If the action is not implemented by the physical device the driver would always report "0" from get_timeleft(). Avoid confusing userspace by only providing get_timeleft() when implemented by the hardware. Signed-off-by: Thomas Weißschuh --- drivers/watchdog/wdat_wdt.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/watchdog/wdat_wdt.c b/drivers/watchdog/wdat_wdt.c index ce7a4a9e4b03..0ba99bed59fc 100644 --- a/drivers/watchdog/wdat_wdt.c +++ b/drivers/watchdog/wdat_wdt.c @@ -301,13 +301,12 @@ static const struct watchdog_info wdat_wdt_info = { .identity = "wdat_wdt", }; -static const struct watchdog_ops wdat_wdt_ops = { +static struct watchdog_ops wdat_wdt_ops = { .owner = THIS_MODULE, .start = wdat_wdt_start, .stop = wdat_wdt_stop, .ping = wdat_wdt_ping, .set_timeout = wdat_wdt_set_timeout, - .get_timeleft = wdat_wdt_get_timeleft, }; static int wdat_wdt_probe(struct platform_device *pdev) @@ -436,6 +435,9 @@ static int wdat_wdt_probe(struct platform_device *pdev) list_add_tail(&instr->node, instructions); } + if (wdat->instructions[ACPI_WDAT_GET_CURRENT_COUNTDOWN]) + wdat_wdt_ops.get_timeleft = wdat_wdt_get_timeleft; + wdat_wdt_boot_status(wdat); wdat_wdt_set_running(wdat); --- base-commit: 0a924817d2ed9396401e0557c6134276d2e26382 change-id: 20221221-wdat_wdt-timeleft-b38d0db39d9f Best regards, -- Thomas Weißschuh