Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1300406 > unrolled thread

[PATCH 2/3] watchdog: ziirave: Use watchdog infrastructure to create sysfs attributes

Started byGuenter Roeck <linux@roeck-us.net>
First post2016-01-04 00:20 +0100
Last post2016-01-08 11:20 +0100
Articles 2 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH 2/3] watchdog: ziirave: Use watchdog infrastructure to create sysfs attributes Guenter Roeck <linux@roeck-us.net> - 2016-01-04 00:20 +0100
    Re: [PATCH 2/3] watchdog: ziirave: Use watchdog infrastructure to  create sysfs attributes Martyn Welch <martyn.welch@collabora.co.uk> - 2016-01-08 11:20 +0100

#1300406 — [PATCH 2/3] watchdog: ziirave: Use watchdog infrastructure to create sysfs attributes

FromGuenter Roeck <linux@roeck-us.net>
Date2016-01-04 00:20 +0100
Subject[PATCH 2/3] watchdog: ziirave: Use watchdog infrastructure to create sysfs attributes
Message-ID<qN06l-3AM-11@gated-at.bofh.it>
The watchdog core now supports creating driver specific sysfs attributes
when creating the watchdog device.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
---
 drivers/watchdog/ziirave_wdt.c | 20 +++-----------------
 1 file changed, 3 insertions(+), 17 deletions(-)

diff --git a/drivers/watchdog/ziirave_wdt.c b/drivers/watchdog/ziirave_wdt.c
index b498fdcc231a..0c7cb7302cf0 100644
--- a/drivers/watchdog/ziirave_wdt.c
+++ b/drivers/watchdog/ziirave_wdt.c
@@ -207,10 +207,7 @@ static struct attribute *ziirave_wdt_attrs[] = {
 	&dev_attr_reset_reason.attr,
 	NULL
 };
-
-static const struct attribute_group ziirave_wdt_sysfs_files = {
-	.attrs  = ziirave_wdt_attrs,
-};
+ATTRIBUTE_GROUPS(ziirave_wdt);
 
 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.max_timeout = ZIIRAVE_TIMEOUT_MAX;
 	w_priv->wdd.parent = &client->dev;
+	w_priv->wdd.groups = ziirave_wdt_groups;
 
 	ret = watchdog_init_timeout(&w_priv->wdd, wdt_timeout, &client->dev);
 	if (ret) {
@@ -327,26 +325,14 @@ static int ziirave_wdt_probe(struct i2c_client *client,
 		return -ENODEV;
 
 	ret = watchdog_register_device(&w_priv->wdd);
-	if (ret)
-		return ret;
-
-	ret = sysfs_create_group(&w_priv->wdd.dev->kobj,
-				 &ziirave_wdt_sysfs_files);
-	if (ret) {
-		watchdog_unregister_device(&w_priv->wdd);
 
-		return ret;
-	}
-
-	return 0;
+	return ret;
 }
 
 static int ziirave_wdt_remove(struct i2c_client *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);
 
 	return 0;
-- 
2.1.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [next] | [standalone]


#1304330 — Re: [PATCH 2/3] watchdog: ziirave: Use watchdog infrastructure to create sysfs attributes

FromMartyn Welch <martyn.welch@collabora.co.uk>
Date2016-01-08 11:20 +0100
SubjectRe: [PATCH 2/3] watchdog: ziirave: Use watchdog infrastructure to create sysfs attributes
Message-ID<qOCjg-5hH-9@gated-at.bofh.it>
In reply to#1300406

On 03/01/16 23:11, Guenter Roeck wrote:
> The watchdog core now supports creating driver specific sysfs attributes
> when creating the watchdog device.
>
> Signed-off-by: Guenter Roeck <linux@roeck-us.net>

Acked-by: Martyn Welch <martyn.welch@collabora.co.uk>

(Sorry for the delayed response, this email got caught by my spam filtering)

> ---
>   drivers/watchdog/ziirave_wdt.c | 20 +++-----------------
>   1 file changed, 3 insertions(+), 17 deletions(-)
>
> diff --git a/drivers/watchdog/ziirave_wdt.c b/drivers/watchdog/ziirave_wdt.c
> index b498fdcc231a..0c7cb7302cf0 100644
> --- a/drivers/watchdog/ziirave_wdt.c
> +++ b/drivers/watchdog/ziirave_wdt.c
> @@ -207,10 +207,7 @@ static struct attribute *ziirave_wdt_attrs[] = {
>   	&dev_attr_reset_reason.attr,
>   	NULL
>   };
> -
> -static const struct attribute_group ziirave_wdt_sysfs_files = {
> -	.attrs  = ziirave_wdt_attrs,
> -};
> +ATTRIBUTE_GROUPS(ziirave_wdt);
>
>   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.max_timeout = ZIIRAVE_TIMEOUT_MAX;
>   	w_priv->wdd.parent = &client->dev;
> +	w_priv->wdd.groups = ziirave_wdt_groups;
>
>   	ret = watchdog_init_timeout(&w_priv->wdd, wdt_timeout, &client->dev);
>   	if (ret) {
> @@ -327,26 +325,14 @@ static int ziirave_wdt_probe(struct i2c_client *client,
>   		return -ENODEV;
>
>   	ret = watchdog_register_device(&w_priv->wdd);
> -	if (ret)
> -		return ret;
> -
> -	ret = sysfs_create_group(&w_priv->wdd.dev->kobj,
> -				 &ziirave_wdt_sysfs_files);
> -	if (ret) {
> -		watchdog_unregister_device(&w_priv->wdd);
>
> -		return ret;
> -	}
> -
> -	return 0;
> +	return ret;
>   }
>
>   static int ziirave_wdt_remove(struct i2c_client *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);
>
>   	return 0;
>

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web