From patchwork Mon Nov 15 20:32:56 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Achatz X-Patchwork-Id: 326332 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id oAFKXhWh020998 for ; Mon, 15 Nov 2010 20:33:45 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758261Ab0KOUdB (ORCPT ); Mon, 15 Nov 2010 15:33:01 -0500 Received: from mail-in-01.arcor-online.net ([151.189.21.41]:43589 "EHLO mail-in-01.arcor-online.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758244Ab0KOUc7 (ORCPT ); Mon, 15 Nov 2010 15:32:59 -0500 Received: from mail-in-11-z2.arcor-online.net (mail-in-11-z2.arcor-online.net [151.189.8.28]) by mx.arcor.de (Postfix) with ESMTP id 16A4F5A110; Mon, 15 Nov 2010 21:32:58 +0100 (CET) Received: from mail-in-02.arcor-online.net (mail-in-02.arcor-online.net [151.189.21.42]) by mail-in-11-z2.arcor-online.net (Postfix) with ESMTP id 099991CBA20; Mon, 15 Nov 2010 21:32:58 +0100 (CET) Received: from [192.168.0.7] (dslb-088-067-009-161.pools.arcor-ip.net [88.67.9.161]) (Authenticated sender: screamingfist@arcor.de) by mail-in-02.arcor-online.net (Postfix) with ESMTPSA id 7D79830590; Mon, 15 Nov 2010 21:32:57 +0100 (CET) X-DKIM: Sendmail DKIM Filter v2.8.2 mail-in-02.arcor-online.net 7D79830590 Subject: [PATCH 3/3] HID: roccat: using new sysfs_create_bin_group() in pyra driver From: Stefan Achatz Reply-To: erazor_de@users.sourceforge.net To: Jiri Kosina , Greg Kroah-Hartman , linux-input@vger.kernel.org, linux-kernel@vger.kernel.org Date: Mon, 15 Nov 2010 21:32:56 +0100 Message-ID: <1289853176.2188.48.camel@neuromancer> Mime-Version: 1.0 X-Mailer: Evolution 2.30.3 (2.30.3-1.fc13) Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter1.kernel.org [140.211.167.41]); Mon, 15 Nov 2010 20:33:45 +0000 (UTC) diff --git a/drivers/hid/hid-roccat-pyra.c b/drivers/hid/hid-roccat-pyra.c index 0dad5c6..f19b8e7 100644 --- a/drivers/hid/hid-roccat-pyra.c +++ b/drivers/hid/hid-roccat-pyra.c @@ -527,6 +527,27 @@ static struct bin_attribute pyra_settings_attr = { .write = pyra_sysfs_write_settings }; +static struct attribute *pyra_bin_attributes[] = { + &pyra_profile_settings_attr.attr, + &pyra_profile1_settings_attr.attr, + &pyra_profile2_settings_attr.attr, + &pyra_profile3_settings_attr.attr, + &pyra_profile4_settings_attr.attr, + &pyra_profile5_settings_attr.attr, + &pyra_profile_buttons_attr.attr, + &pyra_profile1_buttons_attr.attr, + &pyra_profile2_buttons_attr.attr, + &pyra_profile3_buttons_attr.attr, + &pyra_profile4_buttons_attr.attr, + &pyra_profile5_buttons_attr.attr, + &pyra_settings_attr.attr, + NULL +}; + +static struct attribute_group pyra_bin_attribute_group = { + .attrs = pyra_bin_attributes +}; + static int pyra_create_sysfs_attributes(struct usb_interface *intf) { int retval; @@ -535,97 +556,12 @@ static int pyra_create_sysfs_attributes(struct usb_interface *intf) if (retval) goto exit_1; - retval = sysfs_create_bin_file(&intf->dev.kobj, - &pyra_profile_settings_attr); + retval = sysfs_create_bin_group(&intf->dev.kobj, &pyra_bin_attribute_group); if (retval) goto exit_2; - retval = sysfs_create_bin_file(&intf->dev.kobj, - &pyra_profile1_settings_attr); - if (retval) - goto exit_3; - - retval = sysfs_create_bin_file(&intf->dev.kobj, - &pyra_profile2_settings_attr); - if (retval) - goto exit_4; - - retval = sysfs_create_bin_file(&intf->dev.kobj, - &pyra_profile3_settings_attr); - if (retval) - goto exit_5; - - retval = sysfs_create_bin_file(&intf->dev.kobj, - &pyra_profile4_settings_attr); - if (retval) - goto exit_6; - - retval = sysfs_create_bin_file(&intf->dev.kobj, - &pyra_profile5_settings_attr); - if (retval) - goto exit_7; - - retval = sysfs_create_bin_file(&intf->dev.kobj, - &pyra_profile_buttons_attr); - if (retval) - goto exit_8; - - retval = sysfs_create_bin_file(&intf->dev.kobj, - &pyra_profile1_buttons_attr); - if (retval) - goto exit_9; - - retval = sysfs_create_bin_file(&intf->dev.kobj, - &pyra_profile2_buttons_attr); - if (retval) - goto exit_10; - - retval = sysfs_create_bin_file(&intf->dev.kobj, - &pyra_profile3_buttons_attr); - if (retval) - goto exit_11; - - retval = sysfs_create_bin_file(&intf->dev.kobj, - &pyra_profile4_buttons_attr); - if (retval) - goto exit_12; - - retval = sysfs_create_bin_file(&intf->dev.kobj, - &pyra_profile5_buttons_attr); - if (retval) - goto exit_13; - - retval = sysfs_create_bin_file(&intf->dev.kobj, - &pyra_settings_attr); - if (retval) - goto exit_14; - return 0; -exit_14: - sysfs_remove_bin_file(&intf->dev.kobj, &pyra_profile5_buttons_attr); -exit_13: - sysfs_remove_bin_file(&intf->dev.kobj, &pyra_profile4_buttons_attr); -exit_12: - sysfs_remove_bin_file(&intf->dev.kobj, &pyra_profile3_buttons_attr); -exit_11: - sysfs_remove_bin_file(&intf->dev.kobj, &pyra_profile2_buttons_attr); -exit_10: - sysfs_remove_bin_file(&intf->dev.kobj, &pyra_profile1_buttons_attr); -exit_9: - sysfs_remove_bin_file(&intf->dev.kobj, &pyra_profile_buttons_attr); -exit_8: - sysfs_remove_bin_file(&intf->dev.kobj, &pyra_profile5_settings_attr); -exit_7: - sysfs_remove_bin_file(&intf->dev.kobj, &pyra_profile4_settings_attr); -exit_6: - sysfs_remove_bin_file(&intf->dev.kobj, &pyra_profile3_settings_attr); -exit_5: - sysfs_remove_bin_file(&intf->dev.kobj, &pyra_profile2_settings_attr); -exit_4: - sysfs_remove_bin_file(&intf->dev.kobj, &pyra_profile1_settings_attr); -exit_3: - sysfs_remove_bin_file(&intf->dev.kobj, &pyra_profile_settings_attr); exit_2: sysfs_remove_group(&intf->dev.kobj, &pyra_attribute_group); exit_1: @@ -634,19 +570,7 @@ exit_1: static void pyra_remove_sysfs_attributes(struct usb_interface *intf) { - sysfs_remove_bin_file(&intf->dev.kobj, &pyra_settings_attr); - sysfs_remove_bin_file(&intf->dev.kobj, &pyra_profile5_buttons_attr); - sysfs_remove_bin_file(&intf->dev.kobj, &pyra_profile4_buttons_attr); - sysfs_remove_bin_file(&intf->dev.kobj, &pyra_profile3_buttons_attr); - sysfs_remove_bin_file(&intf->dev.kobj, &pyra_profile2_buttons_attr); - sysfs_remove_bin_file(&intf->dev.kobj, &pyra_profile1_buttons_attr); - sysfs_remove_bin_file(&intf->dev.kobj, &pyra_profile_buttons_attr); - sysfs_remove_bin_file(&intf->dev.kobj, &pyra_profile5_settings_attr); - sysfs_remove_bin_file(&intf->dev.kobj, &pyra_profile4_settings_attr); - sysfs_remove_bin_file(&intf->dev.kobj, &pyra_profile3_settings_attr); - sysfs_remove_bin_file(&intf->dev.kobj, &pyra_profile2_settings_attr); - sysfs_remove_bin_file(&intf->dev.kobj, &pyra_profile1_settings_attr); - sysfs_remove_bin_file(&intf->dev.kobj, &pyra_profile_settings_attr); + sysfs_remove_bin_group(&intf->dev.kobj, &pyra_bin_attribute_group); sysfs_remove_group(&intf->dev.kobj, &pyra_attribute_group); }