diff options
author | Thomas Weißschuh <linux@weissschuh.net> | 2022-12-19 22:30:39 +0100 |
---|---|---|
committer | Wim Van Sebroeck <wim@linux-watchdog.org> | 2023-02-18 15:11:40 +0100 |
commit | b852e7a4a9ab6a1fb08c5aa36b1043672fd814dc (patch) | |
tree | 50ced2623ec8f3023b6f181447557b3d1e89fb89 /drivers/watchdog/watchdog_dev.c | |
parent | dt-bindings: watchdog: fsl-imx: document suspend in wait mode (diff) | |
download | linux-b852e7a4a9ab6a1fb08c5aa36b1043672fd814dc.tar.xz linux-b852e7a4a9ab6a1fb08c5aa36b1043672fd814dc.zip |
watchdog: report fw_version in sysfs
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 <linux@weissschuh.net>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Link: https://lore.kernel.org/r/20221216-watchdog-sysfs-v2-1-6189311103a9@weissschuh.net
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Wim Van Sebroeck <wim@linux-watchdog.org>
Diffstat (limited to 'drivers/watchdog/watchdog_dev.c')
-rw-r--r-- | drivers/watchdog/watchdog_dev.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/drivers/watchdog/watchdog_dev.c b/drivers/watchdog/watchdog_dev.c index 455a9a572d7b..bd5612fa2190 100644 --- a/drivers/watchdog/watchdog_dev.c +++ b/drivers/watchdog/watchdog_dev.c @@ -547,6 +547,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) { @@ -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_fw_version.attr, &dev_attr_identity.attr, &dev_attr_timeout.attr, &dev_attr_min_timeout.attr, |