diff options
author | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2013-08-20 00:50:28 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2013-08-20 00:50:28 -0400 |
commit | 0f1947f3561e7e6df7164cf1e0f14f541ddc29bd (patch) | |
tree | 565b325954a8a86c612ba6ad2076b63cbdfc3761 /drivers/hid | |
parent | eb3156e0a6cdde402cdf3bcc7e2ecc98d7ac5c49 (diff) |
hid: roccat-konepure: convert class code to use bin_attrs in groups
Now that attribute groups support binary attributes, use them instead of
the dev_bin_attrs field in struct class, as that is going away soon.
Cc: Jiri Kosina <jkosina@suse.cz>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/hid')
-rw-r--r-- | drivers/hid/hid-roccat-konepure.c | 67 |
1 files changed, 40 insertions, 27 deletions
diff --git a/drivers/hid/hid-roccat-konepure.c b/drivers/hid/hid-roccat-konepure.c index c79d0b06c143..fa02b1f44979 100644 --- a/drivers/hid/hid-roccat-konepure.c +++ b/drivers/hid/hid-roccat-konepure.c | |||
@@ -94,7 +94,8 @@ KONEPURE_SYSFS_W(thingy, THINGY) \ | |||
94 | KONEPURE_SYSFS_R(thingy, THINGY) | 94 | KONEPURE_SYSFS_R(thingy, THINGY) |
95 | 95 | ||
96 | #define KONEPURE_BIN_ATTRIBUTE_RW(thingy, THINGY) \ | 96 | #define KONEPURE_BIN_ATTRIBUTE_RW(thingy, THINGY) \ |
97 | { \ | 97 | KONEPURE_SYSFS_RW(thingy, THINGY); \ |
98 | static struct bin_attribute bin_attr_##thingy = { \ | ||
98 | .attr = { .name = #thingy, .mode = 0660 }, \ | 99 | .attr = { .name = #thingy, .mode = 0660 }, \ |
99 | .size = KONEPURE_SIZE_ ## THINGY, \ | 100 | .size = KONEPURE_SIZE_ ## THINGY, \ |
100 | .read = konepure_sysfs_read_ ## thingy, \ | 101 | .read = konepure_sysfs_read_ ## thingy, \ |
@@ -102,44 +103,56 @@ KONEPURE_SYSFS_R(thingy, THINGY) | |||
102 | } | 103 | } |
103 | 104 | ||
104 | #define KONEPURE_BIN_ATTRIBUTE_R(thingy, THINGY) \ | 105 | #define KONEPURE_BIN_ATTRIBUTE_R(thingy, THINGY) \ |
105 | { \ | 106 | KONEPURE_SYSFS_R(thingy, THINGY); \ |
107 | static struct bin_attribute bin_attr_##thingy = { \ | ||
106 | .attr = { .name = #thingy, .mode = 0440 }, \ | 108 | .attr = { .name = #thingy, .mode = 0440 }, \ |
107 | .size = KONEPURE_SIZE_ ## THINGY, \ | 109 | .size = KONEPURE_SIZE_ ## THINGY, \ |
108 | .read = konepure_sysfs_read_ ## thingy, \ | 110 | .read = konepure_sysfs_read_ ## thingy, \ |
109 | } | 111 | } |
110 | 112 | ||
111 | #define KONEPURE_BIN_ATTRIBUTE_W(thingy, THINGY) \ | 113 | #define KONEPURE_BIN_ATTRIBUTE_W(thingy, THINGY) \ |
112 | { \ | 114 | KONEPURE_SYSFS_W(thingy, THINGY); \ |
115 | static struct bin_attribute bin_attr_##thingy = { \ | ||
113 | .attr = { .name = #thingy, .mode = 0220 }, \ | 116 | .attr = { .name = #thingy, .mode = 0220 }, \ |
114 | .size = KONEPURE_SIZE_ ## THINGY, \ | 117 | .size = KONEPURE_SIZE_ ## THINGY, \ |
115 | .write = konepure_sysfs_write_ ## thingy \ | 118 | .write = konepure_sysfs_write_ ## thingy \ |
116 | } | 119 | } |
117 | 120 | ||
118 | KONEPURE_SYSFS_RW(actual_profile, ACTUAL_PROFILE) | 121 | KONEPURE_BIN_ATTRIBUTE_RW(actual_profile, ACTUAL_PROFILE); |
119 | KONEPURE_SYSFS_W(control, CONTROL) | 122 | KONEPURE_BIN_ATTRIBUTE_RW(info, INFO); |
120 | KONEPURE_SYSFS_RW(info, INFO) | 123 | KONEPURE_BIN_ATTRIBUTE_RW(sensor, SENSOR); |
121 | KONEPURE_SYSFS_W(talk, TALK) | 124 | KONEPURE_BIN_ATTRIBUTE_RW(tcu, TCU); |
122 | KONEPURE_SYSFS_W(macro, MACRO) | 125 | KONEPURE_BIN_ATTRIBUTE_RW(profile_settings, PROFILE_SETTINGS); |
123 | KONEPURE_SYSFS_RW(sensor, SENSOR) | 126 | KONEPURE_BIN_ATTRIBUTE_RW(profile_buttons, PROFILE_BUTTONS); |
124 | KONEPURE_SYSFS_RW(tcu, TCU) | 127 | KONEPURE_BIN_ATTRIBUTE_W(control, CONTROL); |
125 | KONEPURE_SYSFS_R(tcu_image, TCU_IMAGE) | 128 | KONEPURE_BIN_ATTRIBUTE_W(talk, TALK); |
126 | KONEPURE_SYSFS_RW(profile_settings, PROFILE_SETTINGS) | 129 | KONEPURE_BIN_ATTRIBUTE_W(macro, MACRO); |
127 | KONEPURE_SYSFS_RW(profile_buttons, PROFILE_BUTTONS) | 130 | KONEPURE_BIN_ATTRIBUTE_R(tcu_image, TCU_IMAGE); |
128 | 131 | ||
129 | static struct bin_attribute konepure_bin_attributes[] = { | 132 | static struct bin_attribute *konepure_bin_attributes[] = { |
130 | KONEPURE_BIN_ATTRIBUTE_RW(actual_profile, ACTUAL_PROFILE), | 133 | &bin_attr_actual_profile, |
131 | KONEPURE_BIN_ATTRIBUTE_W(control, CONTROL), | 134 | &bin_attr_info, |
132 | KONEPURE_BIN_ATTRIBUTE_RW(info, INFO), | 135 | &bin_attr_sensor, |
133 | KONEPURE_BIN_ATTRIBUTE_W(talk, TALK), | 136 | &bin_attr_tcu, |
134 | KONEPURE_BIN_ATTRIBUTE_W(macro, MACRO), | 137 | &bin_attr_profile_settings, |
135 | KONEPURE_BIN_ATTRIBUTE_RW(sensor, SENSOR), | 138 | &bin_attr_profile_buttons, |
136 | KONEPURE_BIN_ATTRIBUTE_RW(tcu, TCU), | 139 | &bin_attr_control, |
137 | KONEPURE_BIN_ATTRIBUTE_R(tcu_image, TCU_IMAGE), | 140 | &bin_attr_talk, |
138 | KONEPURE_BIN_ATTRIBUTE_RW(profile_settings, PROFILE_SETTINGS), | 141 | &bin_attr_macro, |
139 | KONEPURE_BIN_ATTRIBUTE_RW(profile_buttons, PROFILE_BUTTONS), | 142 | &bin_attr_tcu_image, |
140 | __ATTR_NULL | 143 | NULL, |
144 | }; | ||
145 | |||
146 | static const struct attribute_group konepure_group = { | ||
147 | .bin_attrs = konepure_bin_attributes, | ||
148 | }; | ||
149 | |||
150 | static const struct attribute_group *konepure_groups[] = { | ||
151 | &konepure_group, | ||
152 | NULL, | ||
141 | }; | 153 | }; |
142 | 154 | ||
155 | |||
143 | static int konepure_init_konepure_device_struct(struct usb_device *usb_dev, | 156 | static int konepure_init_konepure_device_struct(struct usb_device *usb_dev, |
144 | struct konepure_device *konepure) | 157 | struct konepure_device *konepure) |
145 | { | 158 | { |
@@ -282,7 +295,7 @@ static int __init konepure_init(void) | |||
282 | konepure_class = class_create(THIS_MODULE, "konepure"); | 295 | konepure_class = class_create(THIS_MODULE, "konepure"); |
283 | if (IS_ERR(konepure_class)) | 296 | if (IS_ERR(konepure_class)) |
284 | return PTR_ERR(konepure_class); | 297 | return PTR_ERR(konepure_class); |
285 | konepure_class->dev_bin_attrs = konepure_bin_attributes; | 298 | konepure_class->dev_groups = konepure_groups; |
286 | 299 | ||
287 | retval = hid_register_driver(&konepure_driver); | 300 | retval = hid_register_driver(&konepure_driver); |
288 | if (retval) | 301 | if (retval) |