diff options
author | Guenter Roeck <linux@roeck-us.net> | 2016-01-04 02:11:56 +0300 |
---|---|---|
committer | Wim Van Sebroeck <wim@iguana.be> | 2016-01-11 23:53:57 +0300 |
commit | faa584757b63aad42d19f1c6a6eac2c848618f83 (patch) | |
tree | b052c3091b4e14fbbb681d6eee5ad17d97267c3b /drivers/watchdog/watchdog_dev.c | |
parent | 62cd1c40ce1c7c16835b599751c7a002eb5bbdf5 (diff) | |
download | linux-faa584757b63aad42d19f1c6a6eac2c848618f83.tar.xz |
watchdog: Add support for creating driver specific sysfs attributes
The Zodiac watchdog driver attaches additional sysfs attributes to the
watchdog device. This has a number of problems: The watchdog device
lifetime differs from the driver lifetime, and the device structure
should therefore not be accessed from drivers. Also, creating sysfs
attributes after driver registration results in a potential race condition
if user space expects the attributes to exist but they don't exist yet.
Add support for creating driver specific sysfs attributes to the watchdog
core to solve the problems.
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Wim Van Sebroeck <wim@iguana.be>
Diffstat (limited to 'drivers/watchdog/watchdog_dev.c')
-rw-r--r-- | drivers/watchdog/watchdog_dev.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/watchdog/watchdog_dev.c b/drivers/watchdog/watchdog_dev.c index 3cab6f6e7f1c..e89ccb2e9603 100644 --- a/drivers/watchdog/watchdog_dev.c +++ b/drivers/watchdog/watchdog_dev.c @@ -744,8 +744,9 @@ int watchdog_dev_register(struct watchdog_device *wdd) if (ret) return ret; - dev = device_create(&watchdog_class, wdd->parent, devno, wdd, - "watchdog%d", wdd->id); + dev = device_create_with_groups(&watchdog_class, wdd->parent, + devno, wdd, wdd->groups, + "watchdog%d", wdd->id); if (IS_ERR(dev)) { watchdog_cdev_unregister(wdd); return PTR_ERR(dev); |