Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp11354320rwb; Fri, 25 Nov 2022 14:37:48 -0800 (PST) X-Google-Smtp-Source: AA0mqf4aVKGPoU48EhZ6GMttc7wkZGPFtm37bKBi/POprm0PWykkwLKTmUqvTTE1EY6Tbrj/wP+A X-Received: by 2002:a63:e404:0:b0:477:f6be:b65b with SMTP id a4-20020a63e404000000b00477f6beb65bmr1054401pgi.362.1669415868733; Fri, 25 Nov 2022 14:37:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669415868; cv=none; d=google.com; s=arc-20160816; b=AO13qFzUHpfPFFQERj9rXxH1n7y+M60mq8PHJv6rDtPJxpFyByC+f7JuiPAOLDJuqn y8/W40ZsRbzBCuhQHERRuEVG9uv/e4hEOolV9hxMDQ33ATPRq+fmtnC85smaY197rJvX MFc8j4V3uv9gUBNBa87n5LOGvWtlBRWS9Xc1Jx1q1Y+YIRkqc4A7etLv6oAcM6fvihW5 LWlgLtPN1LRbHlXGzmgq+eeIV22PKAZxAvtlzg1rnGF2j50Jv8wcxV5k2GfkWuG5XdL0 eLCoXC8rJvbKXxX63yQ2baWhUtmHM3ho8p1dG4+KD/gUpNIMteMv/cfupFhbYintzQgc fh5g== 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:dkim-signature:from; bh=HEzNPHJHybcHWWVnEv3FMD/dt37sBdGxNoZNTQDQH7U=; b=smcXLR8V3X9SwDERtwJufK+8WGT+Ho/80xMG8yDWZkrK40K3BIyuT9mhVQ7+oUHeOt k1n13KysCLYHlZE3XZgWBja3xA0lz9JepfT+Gn3Y/HmJBrceQwtO2Q445ev5pocUYP1+ cZYkvLM5Kyat3X22qeoxftmdBwjblfA9riN9Jnd8sqh80hjgtaFxRI80EjFtEfIrPiUe fOdPtbVUvgPcM+MXHpNTFABr9e+gqH3HUSIcdlKdxvlSJWmbdEp1SUGst1120f5eXrau o5wAeJak2Y+Od33+GqeKgCbaocCOgV2FmJVCgalEZlCWqyl7M9/2r5uD5Sl9DMAvkiwY sVXw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@weissschuh.net header.s=mail header.b=oGL3K0ft; 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 i2-20020a639d02000000b0043c0b4f2b68si5495057pgd.318.2022.11.25.14.37.36; Fri, 25 Nov 2022 14:37:48 -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=oGL3K0ft; 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 S229748AbiKYWXd (ORCPT + 86 others); Fri, 25 Nov 2022 17:23:33 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39446 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229454AbiKYWXb (ORCPT ); Fri, 25 Nov 2022 17:23:31 -0500 Received: from todd.t-8ch.de (todd.t-8ch.de [159.69.126.157]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 18024205E3; Fri, 25 Nov 2022 14:23:31 -0800 (PST) From: =?UTF-8?q?Thomas=20Wei=C3=9Fschuh?= DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=weissschuh.net; s=mail; t=1669415009; bh=NQ+04B6zJQxzHILCfAFkhF13N2/TELUbaH94zEW62cA=; h=From:To:Cc:Subject:Date:From; b=oGL3K0ftiDi0H3tP1NKq0EhToZqpCPxDfWkxK+snQP0SbS2Z6YbgPIEKrH1XwAbgM 3GBM/xf75lgSbKmoFcGOI/CtOSqc+txkufagdaEHx5NKcEHmCQoD3Tpw7HssaPMDB+ TjmQYH5y76RsYzM+kZusZ/GrMisJiPBRbzEAAb/k= To: Wim Van Sebroeck , Guenter Roeck Cc: =?UTF-8?q?Thomas=20Wei=C3=9Fschuh?= , linux-watchdog@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] watchdog: Report firmware_version in sysfs Date: Fri, 25 Nov 2022 23:23:15 +0100 Message-Id: <20221125222315.4925-1-linux@weissschuh.net> X-Mailer: git-send-email 2.38.1 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Developer-Signature: v=1; a=ed25519-sha256; t=1669414993; l=1549; i=linux@weissschuh.net; s=20211113; h=from:subject; bh=NQ+04B6zJQxzHILCfAFkhF13N2/TELUbaH94zEW62cA=; b=efEVyF6r8ALLabqaD+48qPvQ0ZPwyjpW7rBNapW//ealEWU/pw+w2BVj8w101tmZmFGGOyWW5dNW DN+TjMYLDnZirs1+g8+4WyrgEjNihcAFyYuGLJUfalO3bzzaFbSW X-Developer-Key: i=linux@weissschuh.net; a=ed25519; pk=9LP6KM4vD/8CwHW7nouRBhWLyQLcK1MkP6aTZbzUlj4= Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,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 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. Signed-off-by: Thomas Weißschuh --- Userspace implementation: https://github.com/util-linux/util-linux/pull/1927 --- drivers/watchdog/watchdog_dev.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/drivers/watchdog/watchdog_dev.c b/drivers/watchdog/watchdog_dev.c index 55574ed42504..88c76e27873c 100644 --- a/drivers/watchdog/watchdog_dev.c +++ b/drivers/watchdog/watchdog_dev.c @@ -555,6 +555,15 @@ static ssize_t identity_show(struct device *dev, struct device_attribute *attr, } static DEVICE_ATTR_RO(identity); +static ssize_t firmware_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(firmware_version); + static ssize_t state_show(struct device *dev, struct device_attribute *attr, char *buf) { @@ -618,6 +627,7 @@ static umode_t wdt_is_visible(struct kobject *kobj, struct attribute *attr, static struct attribute *wdt_attrs[] = { &dev_attr_state.attr, &dev_attr_identity.attr, + &dev_attr_firmware_version.attr, &dev_attr_timeout.attr, &dev_attr_min_timeout.attr, &dev_attr_max_timeout.attr, base-commit: 0b1dcc2cf55ae6523c6fbd0d741b3ac28c9f4536 -- 2.38.1