From: Guenter Roeck <linux@roeck-us.net>
To: Jean Delvare <khali@linux-fr.org>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: lm-sensors@lm-sensors.org, linux-kernel@vger.kernel.org,
Guenter Roeck <linux@roeck-us.net>
Subject: [RFC PATCH 3/5] hwmon: (ds1621) Convert to use hwmon_device_register_groups
Date: Sat, 6 Jul 2013 10:24:53 -0700 [thread overview]
Message-ID: <1373131495-13465-4-git-send-email-linux@roeck-us.net> (raw)
In-Reply-To: <1373131495-13465-1-git-send-email-linux@roeck-us.net>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
---
drivers/hwmon/ds1621.c | 25 +++++++++----------------
1 file changed, 9 insertions(+), 16 deletions(-)
diff --git a/drivers/hwmon/ds1621.c b/drivers/hwmon/ds1621.c
index a26ba7a..f1d0fa0 100644
--- a/drivers/hwmon/ds1621.c
+++ b/drivers/hwmon/ds1621.c
@@ -358,11 +358,15 @@ static const struct attribute_group ds1621_group = {
.is_visible = ds1621_attribute_visible
};
+static const struct attribute_group *ds1621_groups[] = {
+ &ds1621_group,
+ NULL
+};
+
static int ds1621_probe(struct i2c_client *client,
const struct i2c_device_id *id)
{
struct ds1621_data *data;
- int err;
data = devm_kzalloc(&client->dev, sizeof(struct ds1621_data),
GFP_KERNEL);
@@ -377,22 +381,12 @@ static int ds1621_probe(struct i2c_client *client,
/* Initialize the DS1621 chip */
ds1621_init_client(client);
- /* Register sysfs hooks */
- err = sysfs_create_group(&client->dev.kobj, &ds1621_group);
- if (err)
- return err;
-
- data->hwmon_dev = hwmon_device_register(&client->dev);
- if (IS_ERR(data->hwmon_dev)) {
- err = PTR_ERR(data->hwmon_dev);
- goto exit_remove_files;
- }
+ data->hwmon_dev = hwmon_device_register_groups(&client->dev, data,
+ ds1621_groups);
+ if (IS_ERR(data->hwmon_dev))
+ return PTR_ERR(data->hwmon_dev);
return 0;
-
- exit_remove_files:
- sysfs_remove_group(&client->dev.kobj, &ds1621_group);
- return err;
}
static int ds1621_remove(struct i2c_client *client)
@@ -400,7 +394,6 @@ static int ds1621_remove(struct i2c_client *client)
struct ds1621_data *data = i2c_get_clientdata(client);
hwmon_device_unregister(data->hwmon_dev);
- sysfs_remove_group(&client->dev.kobj, &ds1621_group);
return 0;
}
--
1.7.9.7
next prev parent reply other threads:[~2013-07-06 17:25 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-07-06 17:24 [RFC PATCH 0/5] Introduce and use device_create_groups Guenter Roeck
2013-07-06 17:24 ` [RFC PATCH 1/5] driver core: Introduce device_create_groups Guenter Roeck
2013-07-06 17:47 ` Greg Kroah-Hartman
2013-07-06 19:22 ` Guenter Roeck
2013-07-06 17:24 ` [RFC PATCH 2/5] hwmon: Introduce hwmon_device_register_groups Guenter Roeck
2013-07-06 17:24 ` Guenter Roeck [this message]
2013-07-06 17:57 ` [RFC PATCH 3/5] hwmon: (ds1621) Convert to use hwmon_device_register_groups Greg Kroah-Hartman
2013-07-06 18:01 ` Jean Delvare
2013-07-06 19:18 ` Guenter Roeck
2013-07-06 19:31 ` Greg Kroah-Hartman
2013-07-06 19:48 ` Guenter Roeck
2013-07-06 19:59 ` Jean Delvare
2013-07-06 20:14 ` Guenter Roeck
2013-07-06 19:54 ` Jean Delvare
2013-07-06 20:45 ` Guenter Roeck
2013-07-06 17:24 ` [RFC PATCH 4/5] hwmon: (gpio-fan) " Guenter Roeck
2013-07-06 17:24 ` [RFC PATCH 5/5] hwmon: (ltc4245) " Guenter Roeck
2013-07-06 17:33 ` [RFC PATCH 0/5] Introduce and use device_create_groups Greg Kroah-Hartman
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1373131495-13465-4-git-send-email-linux@roeck-us.net \
--to=linux@roeck-us.net \
--cc=gregkh@linuxfoundation.org \
--cc=khali@linux-fr.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lm-sensors@lm-sensors.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox