watchdog: ziirave: Use watchdog infrastructure to create sysfs attributes

The watchdog core now supports creating driver specific sysfs attributes
when creating the watchdog device.

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>
This commit is contained in:
Guenter Roeck 2016-01-03 15:11:57 -08:00 committed by Wim Van Sebroeck
parent faa584757b
commit 2c2f3080de
1 changed files with 3 additions and 17 deletions

View File

@ -207,10 +207,7 @@ static struct attribute *ziirave_wdt_attrs[] = {
&dev_attr_reset_reason.attr, &dev_attr_reset_reason.attr,
NULL NULL
}; };
ATTRIBUTE_GROUPS(ziirave_wdt);
static const struct attribute_group ziirave_wdt_sysfs_files = {
.attrs = ziirave_wdt_attrs,
};
static int ziirave_wdt_init_duration(struct i2c_client *client) static int ziirave_wdt_init_duration(struct i2c_client *client)
{ {
@ -260,6 +257,7 @@ static int ziirave_wdt_probe(struct i2c_client *client,
w_priv->wdd.min_timeout = ZIIRAVE_TIMEOUT_MIN; w_priv->wdd.min_timeout = ZIIRAVE_TIMEOUT_MIN;
w_priv->wdd.max_timeout = ZIIRAVE_TIMEOUT_MAX; w_priv->wdd.max_timeout = ZIIRAVE_TIMEOUT_MAX;
w_priv->wdd.parent = &client->dev; w_priv->wdd.parent = &client->dev;
w_priv->wdd.groups = ziirave_wdt_groups;
ret = watchdog_init_timeout(&w_priv->wdd, wdt_timeout, &client->dev); ret = watchdog_init_timeout(&w_priv->wdd, wdt_timeout, &client->dev);
if (ret) { if (ret) {
@ -327,26 +325,14 @@ static int ziirave_wdt_probe(struct i2c_client *client,
return -ENODEV; return -ENODEV;
ret = watchdog_register_device(&w_priv->wdd); ret = watchdog_register_device(&w_priv->wdd);
if (ret)
return ret;
ret = sysfs_create_group(&w_priv->wdd.dev->kobj, return ret;
&ziirave_wdt_sysfs_files);
if (ret) {
watchdog_unregister_device(&w_priv->wdd);
return ret;
}
return 0;
} }
static int ziirave_wdt_remove(struct i2c_client *client) static int ziirave_wdt_remove(struct i2c_client *client)
{ {
struct ziirave_wdt_data *w_priv = i2c_get_clientdata(client); struct ziirave_wdt_data *w_priv = i2c_get_clientdata(client);
sysfs_remove_group(&client->dev.kobj, &ziirave_wdt_sysfs_files);
watchdog_unregister_device(&w_priv->wdd); watchdog_unregister_device(&w_priv->wdd);
return 0; return 0;