Received: by 2002:a05:6358:f14:b0:e5:3b68:ec04 with SMTP id b20csp3138105rwj; Mon, 19 Dec 2022 13:43:02 -0800 (PST) X-Google-Smtp-Source: AA0mqf5hClc1K5zil/PLc9WtgC/r9H6YbfIy4gVcad3Q4Q9ketVm/qELXUzs4h+6uxSRIpIraasB X-Received: by 2002:a05:6a20:c705:b0:a2:c3b0:f637 with SMTP id hi5-20020a056a20c70500b000a2c3b0f637mr51825824pzb.26.1671486182287; Mon, 19 Dec 2022 13:43:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1671486182; cv=none; d=google.com; s=arc-20160816; b=uvEiW8RJbUoOucJmShIyFER03lBXG7X21OD2eiMB/LTtVp6EOwAfTLg/KNuM1s/fN4 MICgPQ5ur2rAgP906p5srhMLLceWB8NUnJ4m9F8NCisJZH7ooC6tPeUEQZXXELQqR2S1 Ab3AO9Qc9ydaAP/Md7BCkIHWqbwShcEKChRxahgJ+/J/cHd2uQxrbQDWmh4eH+LrfNJc YSiz/jugxJ26ptlvzDh5fxD1YQCs5dqFBl+7z9CU4KGYPs/rqN9mLKcK/IgWL2Lyarw/ OGYV2/atEc68qCC7kbtGOMLqm8zyvRo4bsW5brO1zYxJeipj8XhnXVhN5CKO1BCLZAGb CILg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:in-reply-to:references:message-id :content-transfer-encoding:mime-version:subject:date:dkim-signature :from; bh=vnij9Uq1JQomBjKNI/4DDKyKSRH90h3viDpZM6pfxsA=; b=ZbOkFtmxr9roVdia3tqfC3WdDigTEfaByLy9s50FCPrIubd801EPTOc2PKK569kW0K trU8Jmm3w/vbZVNAYfEoAYhp6AKDlkYilH3hcxa+iiMvEVGcqZPOh60JhoydEaausgJZ EPfMu5dPR8Rpil+jrzSmoMU3Nb5qHNG7/+vobh9G0NMMWg9BG1LyxcXfgdAkic3vI7PQ rSdWDejTLG2i55xcHq11FT3oP2DEdGYwCVf/qJjkx7naK9wWm+pdhUtkiRPqnUtm6k2a DCkUgJBH8stdrcsq3+Z283UuMo8klWk79y3My9mK/90BiMNG3+wrxq6cos46+4SURwvQ yXsA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@weissschuh.net header.s=mail header.b=fpxDsYoz; 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 i7-20020a632207000000b004790794f31csi11323195pgi.588.2022.12.19.13.42.52; Mon, 19 Dec 2022 13:43:02 -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=fpxDsYoz; 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 S230007AbiLSVbE (ORCPT + 71 others); Mon, 19 Dec 2022 16:31:04 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51566 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232758AbiLSVa4 (ORCPT ); Mon, 19 Dec 2022 16:30:56 -0500 Received: from todd.t-8ch.de (todd.t-8ch.de [IPv6:2a01:4f8:c010:41de::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9CE3FF000; Mon, 19 Dec 2022 13:30:53 -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=1671485451; bh=Fa2g4bN8T2fJYrUVKPR4XgCbGFZG+GXnu+qNhNRb8TY=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=fpxDsYozRYo3qwQv2CmVeB30VH6EARsb/FDKl7bpuGIxk0QdukCg9yRrE3bw2ZR4f 7jhvPYHHqr9C03xGUmKS5LPdTJSF449ylieKpqMwqEC5c73AuULQqzAMrdYsZSNg8p /sHtgCP0PEniouX/1W5hxUDXPajEP/gtW2e9jnbE= Date: Mon, 19 Dec 2022 21:30:39 +0000 Subject: [PATCH v2 1/2] watchdog: report fw_version in sysfs MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Message-Id: <20221216-watchdog-sysfs-v2-1-6189311103a9@weissschuh.net> References: <20221216-watchdog-sysfs-v2-0-6189311103a9@weissschuh.net> In-Reply-To: <20221216-watchdog-sysfs-v2-0-6189311103a9@weissschuh.net> To: Wim Van Sebroeck , Guenter Roeck Cc: linux-kernel@vger.kernel.org, linux-watchdog@vger.kernel.org, Thomas =?utf-8?q?Wei=C3=9Fschuh?= , Wim Van Sebroeck X-Mailer: b4 0.11.0-dev-e429b X-Developer-Signature: v=1; a=ed25519-sha256; t=1671485447; l=2245; i=linux@weissschuh.net; s=20221212; h=from:subject:message-id; bh=Fa2g4bN8T2fJYrUVKPR4XgCbGFZG+GXnu+qNhNRb8TY=; b=sCZpnkOKFcDJi8tGB+H4kXRfBbuz9WDBTrHxyu3nrYHimprtleLfDr9n0lte5G7aFjVs4R7xAmFX fm/6zbqKB45EHzrSZjiObLpAzRr1qgCKLcN8AMMFGum6scfYht2B 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 This synchronizes the information reported by ioctl and sysfs. The mismatch is confusing because "wdctl" from util-linux uses the ioctl when used with root privileges and sysfs without. The file is called "fw_version" instead of "firmware_version" as "firmware_version" is already used as custom attribute by single drivers. Signed-off-by: Thomas Weißschuh --- Documentation/ABI/testing/sysfs-class-watchdog | 7 +++++++ drivers/watchdog/watchdog_dev.c | 10 ++++++++++ 2 files changed, 17 insertions(+) diff --git a/Documentation/ABI/testing/sysfs-class-watchdog b/Documentation/ABI/testing/sysfs-class-watchdog index 585caecda3a5..27c000238fe4 100644 --- a/Documentation/ABI/testing/sysfs-class-watchdog +++ b/Documentation/ABI/testing/sysfs-class-watchdog @@ -6,6 +6,13 @@ Description: device at boot. It is equivalent to WDIOC_GETBOOTSTATUS of ioctl interface. +What: /sys/class/watchdog/watchdogn/fw_version +Date: April 2023 +Contact: Thomas Weißschuh +Description: + It is a read only file. It contains firmware version of + watchdog device. + What: /sys/class/watchdog/watchdogn/identity Date: August 2015 Contact: Wim Van Sebroeck diff --git a/drivers/watchdog/watchdog_dev.c b/drivers/watchdog/watchdog_dev.c index 55574ed42504..7feeda02a531 100644 --- a/drivers/watchdog/watchdog_dev.c +++ b/drivers/watchdog/watchdog_dev.c @@ -546,6 +546,15 @@ static ssize_t pretimeout_show(struct device *dev, } static DEVICE_ATTR_RO(pretimeout); +static ssize_t fw_version_show(struct device *dev, struct device_attribute *attr, + char *buf) +{ + struct watchdog_device *wdd = dev_get_drvdata(dev); + + return sysfs_emit(buf, "%d\n", wdd->info->firmware_version); +} +static DEVICE_ATTR_RO(fw_version); + static ssize_t identity_show(struct device *dev, struct device_attribute *attr, char *buf) { @@ -617,6 +626,7 @@ static umode_t wdt_is_visible(struct kobject *kobj, struct attribute *attr, } static struct attribute *wdt_attrs[] = { &dev_attr_state.attr, + &dev_attr_fw_version.attr, &dev_attr_identity.attr, &dev_attr_timeout.attr, &dev_attr_min_timeout.attr, -- 2.39.0