Skip to content

Commit ad8bc19

Browse files
t-8chWim Van Sebroeck
authored andcommitted
watchdog: report options 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. Signed-off-by: Thomas Weißschuh <[email protected]> Reviewed-by: Guenter Roeck <[email protected]> Link: https://lore.kernel.org/r/[email protected] [groeck: Fixed continuation line alignment] Signed-off-by: Guenter Roeck <[email protected]> Signed-off-by: Wim Van Sebroeck <[email protected]>
1 parent b852e7a commit ad8bc19

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

Documentation/ABI/testing/sysfs-class-watchdog

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,12 @@ Description:
66
device at boot. It is equivalent to WDIOC_GETBOOTSTATUS of
77
ioctl interface.
88

9+
What: /sys/class/watchdog/watchdogn/options
10+
Date: April 2023
11+
Contact: Thomas Weißschuh
12+
Description:
13+
It is a read only file. It contains options of watchdog device.
14+
915
What: /sys/class/watchdog/watchdogn/fw_version
1016
Date: April 2023
1117
Contact: Thomas Weißschuh

drivers/watchdog/watchdog_dev.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -547,6 +547,15 @@ static ssize_t pretimeout_show(struct device *dev,
547547
}
548548
static DEVICE_ATTR_RO(pretimeout);
549549

550+
static ssize_t options_show(struct device *dev, struct device_attribute *attr,
551+
char *buf)
552+
{
553+
struct watchdog_device *wdd = dev_get_drvdata(dev);
554+
555+
return sysfs_emit(buf, "0x%x\n", wdd->info->options);
556+
}
557+
static DEVICE_ATTR_RO(options);
558+
550559
static ssize_t fw_version_show(struct device *dev, struct device_attribute *attr,
551560
char *buf)
552561
{
@@ -627,6 +636,7 @@ static umode_t wdt_is_visible(struct kobject *kobj, struct attribute *attr,
627636
}
628637
static struct attribute *wdt_attrs[] = {
629638
&dev_attr_state.attr,
639+
&dev_attr_options.attr,
630640
&dev_attr_fw_version.attr,
631641
&dev_attr_identity.attr,
632642
&dev_attr_timeout.attr,

0 commit comments

Comments
 (0)