public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Stefan Achatz <stefan_achatz@web.de>
To: Greg Kroah-Hartman <gregkh@suse.de>,
	"Eric W. Biederman" <ebiederm@aristanetworks.com>,
	"Serge E. Hallyn" <serue@us.ibm.com>, Tejun Heo <tj@kernel.org>,
	Jiri Kosina <jkosina@suse.cz>,
	linux-input@vger.kernel.org, linux-kernel@vger.kernel.org,
	Dmitry Torokhov <dmitry.torokhov@gmail.com>,
	Benjamin Thery <benjamin.thery@bull.net>
Subject: [PATCH 2/2] HID: roccat: using new sysfs_create_bin_group() in kone driver
Date: Fri, 12 Nov 2010 19:18:41 +0100	[thread overview]
Message-ID: <1289585921.2629.13.camel@neuromancer> (raw)

hid-roccat-kone now uses new group functions for creating binary
sysfs attributes.

Signed-off-by: Stefan Achatz <erazor_de@users.sourceforge.net>
---
 drivers/hid/hid-roccat-kone.c |   53 ++++++++++++----------------------------
 1 files changed, 16 insertions(+), 37 deletions(-)

diff --git a/drivers/hid/hid-roccat-kone.c b/drivers/hid/hid-roccat-kone.c
index f776957..43f1693 100644
--- a/drivers/hid/hid-roccat-kone.c
+++ b/drivers/hid/hid-roccat-kone.c
@@ -710,6 +710,20 @@ static struct bin_attribute kone_profile5_attr = {
 	.write = kone_sysfs_write_profile5
 };
 
+static struct attribute *kone_bin_attributes[] = {
+	&kone_settings_attr.attr,
+	&kone_profile1_attr.attr,
+	&kone_profile2_attr.attr,
+	&kone_profile3_attr.attr,
+	&kone_profile4_attr.attr,
+	&kone_profile5_attr.attr,
+	NULL
+};
+
+static struct attribute_group kone_bin_attribute_group = {
+	.attrs = kone_bin_attributes
+};
+
 static int kone_create_sysfs_attributes(struct usb_interface *intf)
 {
 	int retval;
@@ -718,42 +732,12 @@ static int kone_create_sysfs_attributes(struct usb_interface *intf)
 	if (retval)
 		goto exit_1;
 
-	retval = sysfs_create_bin_file(&intf->dev.kobj, &kone_settings_attr);
+	retval = sysfs_create_bin_group(&intf->dev.kobj, &kone_bin_attribute_group);
 	if (retval)
 		goto exit_2;
 
-	retval = sysfs_create_bin_file(&intf->dev.kobj, &kone_profile1_attr);
-	if (retval)
-		goto exit_3;
-
-	retval = sysfs_create_bin_file(&intf->dev.kobj, &kone_profile2_attr);
-	if (retval)
-		goto exit_4;
-
-	retval = sysfs_create_bin_file(&intf->dev.kobj, &kone_profile3_attr);
-	if (retval)
-		goto exit_5;
-
-	retval = sysfs_create_bin_file(&intf->dev.kobj, &kone_profile4_attr);
-	if (retval)
-		goto exit_6;
-
-	retval = sysfs_create_bin_file(&intf->dev.kobj, &kone_profile5_attr);
-	if (retval)
-		goto exit_7;
-
 	return 0;
 
-exit_7:
-	sysfs_remove_bin_file(&intf->dev.kobj, &kone_profile4_attr);
-exit_6:
-	sysfs_remove_bin_file(&intf->dev.kobj, &kone_profile3_attr);
-exit_5:
-	sysfs_remove_bin_file(&intf->dev.kobj, &kone_profile2_attr);
-exit_4:
-	sysfs_remove_bin_file(&intf->dev.kobj, &kone_profile1_attr);
-exit_3:
-	sysfs_remove_bin_file(&intf->dev.kobj, &kone_settings_attr);
 exit_2:
 	sysfs_remove_group(&intf->dev.kobj, &kone_attribute_group);
 exit_1:
@@ -762,12 +746,7 @@ exit_1:
 
 static void kone_remove_sysfs_attributes(struct usb_interface *intf)
 {
-	sysfs_remove_bin_file(&intf->dev.kobj, &kone_profile5_attr);
-	sysfs_remove_bin_file(&intf->dev.kobj, &kone_profile4_attr);
-	sysfs_remove_bin_file(&intf->dev.kobj, &kone_profile3_attr);
-	sysfs_remove_bin_file(&intf->dev.kobj, &kone_profile2_attr);
-	sysfs_remove_bin_file(&intf->dev.kobj, &kone_profile1_attr);
-	sysfs_remove_bin_file(&intf->dev.kobj, &kone_settings_attr);
+	sysfs_remove_group(&intf->dev.kobj, &kone_bin_attribute_group);
 	sysfs_remove_group(&intf->dev.kobj, &kone_attribute_group);
 }
 
-- 
1.7.2.3




             reply	other threads:[~2010-11-12 18:21 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-11-12 18:18 Stefan Achatz [this message]
2010-11-13  0:21 ` [PATCH 2/2] HID: roccat: using new sysfs_create_bin_group() in kone driver Eric Biederman
2010-11-13  0:52   ` Greg KH
2010-11-13  6:06     ` Dmitry Torokhov
2010-11-13 14:39       ` Greg KH
2010-11-13 16:34         ` Stefan Achatz
2010-11-14  0:03           ` Greg KH

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=1289585921.2629.13.camel@neuromancer \
    --to=stefan_achatz@web.de \
    --cc=benjamin.thery@bull.net \
    --cc=dmitry.torokhov@gmail.com \
    --cc=ebiederm@aristanetworks.com \
    --cc=gregkh@suse.de \
    --cc=jkosina@suse.cz \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=serue@us.ibm.com \
    --cc=tj@kernel.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