diff options
author | Stefan Achatz <stefan_achatz@web.de> | 2012-11-11 00:21:02 -0500 |
---|---|---|
committer | Jiri Kosina <jkosina@suse.cz> | 2012-11-12 09:30:27 -0500 |
commit | 6e5920ddbbc114d9f7864b14a8db42e714a8b99f (patch) | |
tree | 7595868c9cf3b33ce5267c3c7c580c128d092a23 | |
parent | be34380ef818c182860c06f048cbea821203f9b7 (diff) |
HID: roccat: clean up isku driver
Removed unneeded structures from header.
Using enums instead of sizeof(struct) to unify drivers.
Signed-off-by: Stefan Achatz <erazor_de@users.sourceforge.net>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
-rw-r--r-- | drivers/hid/hid-roccat-isku.c | 42 | ||||
-rw-r--r-- | drivers/hid/hid-roccat-isku.h | 76 |
2 files changed, 37 insertions, 81 deletions
diff --git a/drivers/hid/hid-roccat-isku.c b/drivers/hid/hid-roccat-isku.c index 5669916c2943..020d6cda8975 100644 --- a/drivers/hid/hid-roccat-isku.c +++ b/drivers/hid/hid-roccat-isku.c | |||
@@ -167,7 +167,7 @@ static ssize_t isku_sysfs_write_ ## thingy(struct file *fp, struct kobject *kobj | |||
167 | loff_t off, size_t count) \ | 167 | loff_t off, size_t count) \ |
168 | { \ | 168 | { \ |
169 | return isku_sysfs_write(fp, kobj, buf, off, count, \ | 169 | return isku_sysfs_write(fp, kobj, buf, off, count, \ |
170 | sizeof(struct isku_ ## thingy), ISKU_COMMAND_ ## THINGY); \ | 170 | ISKU_SIZE_ ## THINGY, ISKU_COMMAND_ ## THINGY); \ |
171 | } | 171 | } |
172 | 172 | ||
173 | #define ISKU_SYSFS_R(thingy, THINGY) \ | 173 | #define ISKU_SYSFS_R(thingy, THINGY) \ |
@@ -176,32 +176,32 @@ static ssize_t isku_sysfs_read_ ## thingy(struct file *fp, struct kobject *kobj, | |||
176 | loff_t off, size_t count) \ | 176 | loff_t off, size_t count) \ |
177 | { \ | 177 | { \ |
178 | return isku_sysfs_read(fp, kobj, buf, off, count, \ | 178 | return isku_sysfs_read(fp, kobj, buf, off, count, \ |
179 | sizeof(struct isku_ ## thingy), ISKU_COMMAND_ ## THINGY); \ | 179 | ISKU_SIZE_ ## THINGY, ISKU_COMMAND_ ## THINGY); \ |
180 | } | 180 | } |
181 | 181 | ||
182 | #define ISKU_SYSFS_RW(thingy, THINGY) \ | 182 | #define ISKU_SYSFS_RW(thingy, THINGY) \ |
183 | ISKU_SYSFS_R(thingy, THINGY) \ | 183 | ISKU_SYSFS_R(thingy, THINGY) \ |
184 | ISKU_SYSFS_W(thingy, THINGY) | 184 | ISKU_SYSFS_W(thingy, THINGY) |
185 | 185 | ||
186 | #define ISKU_BIN_ATTR_RW(thingy) \ | 186 | #define ISKU_BIN_ATTR_RW(thingy, THINGY) \ |
187 | { \ | 187 | { \ |
188 | .attr = { .name = #thingy, .mode = 0660 }, \ | 188 | .attr = { .name = #thingy, .mode = 0660 }, \ |
189 | .size = sizeof(struct isku_ ## thingy), \ | 189 | .size = ISKU_SIZE_ ## THINGY, \ |
190 | .read = isku_sysfs_read_ ## thingy, \ | 190 | .read = isku_sysfs_read_ ## thingy, \ |
191 | .write = isku_sysfs_write_ ## thingy \ | 191 | .write = isku_sysfs_write_ ## thingy \ |
192 | } | 192 | } |
193 | 193 | ||
194 | #define ISKU_BIN_ATTR_R(thingy) \ | 194 | #define ISKU_BIN_ATTR_R(thingy, THINGY) \ |
195 | { \ | 195 | { \ |
196 | .attr = { .name = #thingy, .mode = 0440 }, \ | 196 | .attr = { .name = #thingy, .mode = 0440 }, \ |
197 | .size = sizeof(struct isku_ ## thingy), \ | 197 | .size = ISKU_SIZE_ ## THINGY, \ |
198 | .read = isku_sysfs_read_ ## thingy, \ | 198 | .read = isku_sysfs_read_ ## thingy, \ |
199 | } | 199 | } |
200 | 200 | ||
201 | #define ISKU_BIN_ATTR_W(thingy) \ | 201 | #define ISKU_BIN_ATTR_W(thingy, THINGY) \ |
202 | { \ | 202 | { \ |
203 | .attr = { .name = #thingy, .mode = 0220 }, \ | 203 | .attr = { .name = #thingy, .mode = 0220 }, \ |
204 | .size = sizeof(struct isku_ ## thingy), \ | 204 | .size = ISKU_SIZE_ ## THINGY, \ |
205 | .write = isku_sysfs_write_ ## thingy \ | 205 | .write = isku_sysfs_write_ ## thingy \ |
206 | } | 206 | } |
207 | 207 | ||
@@ -220,19 +220,19 @@ ISKU_SYSFS_R(info, INFO) | |||
220 | ISKU_SYSFS_W(control, CONTROL) | 220 | ISKU_SYSFS_W(control, CONTROL) |
221 | 221 | ||
222 | static struct bin_attribute isku_bin_attributes[] = { | 222 | static struct bin_attribute isku_bin_attributes[] = { |
223 | ISKU_BIN_ATTR_RW(macro), | 223 | ISKU_BIN_ATTR_RW(macro, MACRO), |
224 | ISKU_BIN_ATTR_RW(keys_function), | 224 | ISKU_BIN_ATTR_RW(keys_function, KEYS_FUNCTION), |
225 | ISKU_BIN_ATTR_RW(keys_easyzone), | 225 | ISKU_BIN_ATTR_RW(keys_easyzone, KEYS_EASYZONE), |
226 | ISKU_BIN_ATTR_RW(keys_media), | 226 | ISKU_BIN_ATTR_RW(keys_media, KEYS_MEDIA), |
227 | ISKU_BIN_ATTR_RW(keys_thumbster), | 227 | ISKU_BIN_ATTR_RW(keys_thumbster, KEYS_THUMBSTER), |
228 | ISKU_BIN_ATTR_RW(keys_macro), | 228 | ISKU_BIN_ATTR_RW(keys_macro, KEYS_MACRO), |
229 | ISKU_BIN_ATTR_RW(keys_capslock), | 229 | ISKU_BIN_ATTR_RW(keys_capslock, KEYS_CAPSLOCK), |
230 | ISKU_BIN_ATTR_RW(light), | 230 | ISKU_BIN_ATTR_RW(light, LIGHT), |
231 | ISKU_BIN_ATTR_RW(key_mask), | 231 | ISKU_BIN_ATTR_RW(key_mask, KEY_MASK), |
232 | ISKU_BIN_ATTR_RW(last_set), | 232 | ISKU_BIN_ATTR_RW(last_set, LAST_SET), |
233 | ISKU_BIN_ATTR_W(talk), | 233 | ISKU_BIN_ATTR_W(talk, TALK), |
234 | ISKU_BIN_ATTR_R(info), | 234 | ISKU_BIN_ATTR_R(info, INFO), |
235 | ISKU_BIN_ATTR_W(control), | 235 | ISKU_BIN_ATTR_W(control, CONTROL), |
236 | __ATTR_NULL | 236 | __ATTR_NULL |
237 | }; | 237 | }; |
238 | 238 | ||
diff --git a/drivers/hid/hid-roccat-isku.h b/drivers/hid/hid-roccat-isku.h index 605b3ce21638..0062ab50861e 100644 --- a/drivers/hid/hid-roccat-isku.h +++ b/drivers/hid/hid-roccat-isku.h | |||
@@ -15,76 +15,32 @@ | |||
15 | #include <linux/types.h> | 15 | #include <linux/types.h> |
16 | 16 | ||
17 | enum { | 17 | enum { |
18 | ISKU_SIZE_CONTROL = 0x03, | ||
19 | ISKU_SIZE_INFO = 0x06, | ||
20 | ISKU_SIZE_KEY_MASK = 0x06, | ||
21 | ISKU_SIZE_KEYS_FUNCTION = 0x29, | ||
22 | ISKU_SIZE_KEYS_EASYZONE = 0x41, | ||
23 | ISKU_SIZE_KEYS_MEDIA = 0x1d, | ||
24 | ISKU_SIZE_KEYS_THUMBSTER = 0x17, | ||
25 | ISKU_SIZE_KEYS_MACRO = 0x23, | ||
26 | ISKU_SIZE_KEYS_CAPSLOCK = 0x06, | ||
27 | ISKU_SIZE_LAST_SET = 0x14, | ||
28 | ISKU_SIZE_LIGHT = 0x0a, | ||
29 | ISKU_SIZE_MACRO = 0x823, | ||
30 | ISKU_SIZE_TALK = 0x10, | ||
31 | }; | ||
32 | |||
33 | enum { | ||
18 | ISKU_PROFILE_NUM = 5, | 34 | ISKU_PROFILE_NUM = 5, |
19 | ISKU_USB_INTERFACE_PROTOCOL = 0, | 35 | ISKU_USB_INTERFACE_PROTOCOL = 0, |
20 | }; | 36 | }; |
21 | 37 | ||
22 | struct isku_control { | ||
23 | uint8_t command; /* ISKU_COMMAND_CONTROL */ | ||
24 | uint8_t value; | ||
25 | uint8_t request; | ||
26 | } __packed; | ||
27 | |||
28 | struct isku_actual_profile { | 38 | struct isku_actual_profile { |
29 | uint8_t command; /* ISKU_COMMAND_ACTUAL_PROFILE */ | 39 | uint8_t command; /* ISKU_COMMAND_ACTUAL_PROFILE */ |
30 | uint8_t size; /* always 3 */ | 40 | uint8_t size; /* always 3 */ |
31 | uint8_t actual_profile; | 41 | uint8_t actual_profile; |
32 | } __packed; | 42 | } __packed; |
33 | 43 | ||
34 | struct isku_key_mask { | ||
35 | uint8_t command; /* ISKU_COMMAND_KEY_MASK */ | ||
36 | uint8_t size; /* 6 */ | ||
37 | uint8_t profile_number; /* 0-4 */ | ||
38 | uint8_t mask; | ||
39 | uint16_t checksum; | ||
40 | } __packed; | ||
41 | |||
42 | struct isku_keys_function { | ||
43 | uint8_t data[0x29]; | ||
44 | } __packed; | ||
45 | |||
46 | struct isku_keys_easyzone { | ||
47 | uint8_t data[0x41]; | ||
48 | } __packed; | ||
49 | |||
50 | struct isku_keys_media { | ||
51 | uint8_t data[0x1d]; | ||
52 | } __packed; | ||
53 | |||
54 | struct isku_keys_thumbster { | ||
55 | uint8_t data[0x17]; | ||
56 | } __packed; | ||
57 | |||
58 | struct isku_keys_macro { | ||
59 | uint8_t data[0x23]; | ||
60 | } __packed; | ||
61 | |||
62 | struct isku_keys_capslock { | ||
63 | uint8_t data[0x6]; | ||
64 | } __packed; | ||
65 | |||
66 | struct isku_macro { | ||
67 | uint8_t data[0x823]; | ||
68 | } __packed; | ||
69 | |||
70 | struct isku_light { | ||
71 | uint8_t data[0xa]; | ||
72 | } __packed; | ||
73 | |||
74 | struct isku_info { | ||
75 | uint8_t data[2]; | ||
76 | uint8_t firmware_version; | ||
77 | uint8_t unknown[3]; | ||
78 | } __packed; | ||
79 | |||
80 | struct isku_talk { | ||
81 | uint8_t data[0x10]; | ||
82 | } __packed; | ||
83 | |||
84 | struct isku_last_set { | ||
85 | uint8_t data[0x14]; | ||
86 | } __packed; | ||
87 | |||
88 | enum isku_commands { | 44 | enum isku_commands { |
89 | ISKU_COMMAND_CONTROL = 0x4, | 45 | ISKU_COMMAND_CONTROL = 0x4, |
90 | ISKU_COMMAND_ACTUAL_PROFILE = 0x5, | 46 | ISKU_COMMAND_ACTUAL_PROFILE = 0x5, |