diff options
author | Stefan Achatz <erazor_de@users.sourceforge.net> | 2010-11-26 14:57:38 -0500 |
---|---|---|
committer | Jiri Kosina <jkosina@suse.cz> | 2011-01-07 19:11:33 -0500 |
commit | 14a057f80f0c4d45a9e68009f8bcb6b246e87ca0 (patch) | |
tree | 1adbc9becbf3362b69891c5b096d494749e73852 /drivers/hid | |
parent | bd3a2b96631dd86b06dca96aef00790084a11e15 (diff) |
HID: roccat: reduce number of functions in kone and pyra drivers
The profile number is now passed via bin_attribute->private instead
of function parameter to reduce number of functions.
Signed-off-by: Stefan Achatz <erazor_de@users.sourceforge.net>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Diffstat (limited to 'drivers/hid')
-rw-r--r-- | drivers/hid/hid-roccat-kone.c | 106 | ||||
-rw-r--r-- | drivers/hid/hid-roccat-pyra.c | 120 |
2 files changed, 53 insertions, 173 deletions
diff --git a/drivers/hid/hid-roccat-kone.c b/drivers/hid/hid-roccat-kone.c index 648d28e5f3f0..cbd8cc42e75a 100644 --- a/drivers/hid/hid-roccat-kone.c +++ b/drivers/hid/hid-roccat-kone.c | |||
@@ -35,6 +35,8 @@ | |||
35 | #include "hid-roccat.h" | 35 | #include "hid-roccat.h" |
36 | #include "hid-roccat-kone.h" | 36 | #include "hid-roccat-kone.h" |
37 | 37 | ||
38 | static uint profile_numbers[5] = {0, 1, 2, 3, 4}; | ||
39 | |||
38 | /* kone_class is used for creating sysfs attributes via roccat char device */ | 40 | /* kone_class is used for creating sysfs attributes via roccat char device */ |
39 | static struct class *kone_class; | 41 | static struct class *kone_class; |
40 | 42 | ||
@@ -323,9 +325,9 @@ static ssize_t kone_sysfs_write_settings(struct file *fp, struct kobject *kobj, | |||
323 | return sizeof(struct kone_settings); | 325 | return sizeof(struct kone_settings); |
324 | } | 326 | } |
325 | 327 | ||
326 | static ssize_t kone_sysfs_read_profilex(struct kobject *kobj, | 328 | static ssize_t kone_sysfs_read_profilex(struct file *fp, |
327 | struct bin_attribute *attr, char *buf, | 329 | struct kobject *kobj, struct bin_attribute *attr, |
328 | loff_t off, size_t count, int number) { | 330 | char *buf, loff_t off, size_t count) { |
329 | struct device *dev = | 331 | struct device *dev = |
330 | container_of(kobj, struct device, kobj)->parent->parent; | 332 | container_of(kobj, struct device, kobj)->parent->parent; |
331 | struct kone_device *kone = hid_get_drvdata(dev_get_drvdata(dev)); | 333 | struct kone_device *kone = hid_get_drvdata(dev_get_drvdata(dev)); |
@@ -337,46 +339,16 @@ static ssize_t kone_sysfs_read_profilex(struct kobject *kobj, | |||
337 | count = sizeof(struct kone_profile) - off; | 339 | count = sizeof(struct kone_profile) - off; |
338 | 340 | ||
339 | mutex_lock(&kone->kone_lock); | 341 | mutex_lock(&kone->kone_lock); |
340 | memcpy(buf, ((char const *)&kone->profiles[number - 1]) + off, count); | 342 | memcpy(buf, ((char const *)&kone->profiles[*(uint *)(attr->private)]) + off, count); |
341 | mutex_unlock(&kone->kone_lock); | 343 | mutex_unlock(&kone->kone_lock); |
342 | 344 | ||
343 | return count; | 345 | return count; |
344 | } | 346 | } |
345 | 347 | ||
346 | static ssize_t kone_sysfs_read_profile1(struct file *fp, struct kobject *kobj, | ||
347 | struct bin_attribute *attr, char *buf, | ||
348 | loff_t off, size_t count) { | ||
349 | return kone_sysfs_read_profilex(kobj, attr, buf, off, count, 1); | ||
350 | } | ||
351 | |||
352 | static ssize_t kone_sysfs_read_profile2(struct file *fp, struct kobject *kobj, | ||
353 | struct bin_attribute *attr, char *buf, | ||
354 | loff_t off, size_t count) { | ||
355 | return kone_sysfs_read_profilex(kobj, attr, buf, off, count, 2); | ||
356 | } | ||
357 | |||
358 | static ssize_t kone_sysfs_read_profile3(struct file *fp, struct kobject *kobj, | ||
359 | struct bin_attribute *attr, char *buf, | ||
360 | loff_t off, size_t count) { | ||
361 | return kone_sysfs_read_profilex(kobj, attr, buf, off, count, 3); | ||
362 | } | ||
363 | |||
364 | static ssize_t kone_sysfs_read_profile4(struct file *fp, struct kobject *kobj, | ||
365 | struct bin_attribute *attr, char *buf, | ||
366 | loff_t off, size_t count) { | ||
367 | return kone_sysfs_read_profilex(kobj, attr, buf, off, count, 4); | ||
368 | } | ||
369 | |||
370 | static ssize_t kone_sysfs_read_profile5(struct file *fp, struct kobject *kobj, | ||
371 | struct bin_attribute *attr, char *buf, | ||
372 | loff_t off, size_t count) { | ||
373 | return kone_sysfs_read_profilex(kobj, attr, buf, off, count, 5); | ||
374 | } | ||
375 | |||
376 | /* Writes data only if different to stored data */ | 348 | /* Writes data only if different to stored data */ |
377 | static ssize_t kone_sysfs_write_profilex(struct kobject *kobj, | 349 | static ssize_t kone_sysfs_write_profilex(struct file *fp, |
378 | struct bin_attribute *attr, char *buf, | 350 | struct kobject *kobj, struct bin_attribute *attr, |
379 | loff_t off, size_t count, int number) { | 351 | char *buf, loff_t off, size_t count) { |
380 | struct device *dev = | 352 | struct device *dev = |
381 | container_of(kobj, struct device, kobj)->parent->parent; | 353 | container_of(kobj, struct device, kobj)->parent->parent; |
382 | struct kone_device *kone = hid_get_drvdata(dev_get_drvdata(dev)); | 354 | struct kone_device *kone = hid_get_drvdata(dev_get_drvdata(dev)); |
@@ -388,13 +360,14 @@ static ssize_t kone_sysfs_write_profilex(struct kobject *kobj, | |||
388 | if (off != 0 || count != sizeof(struct kone_profile)) | 360 | if (off != 0 || count != sizeof(struct kone_profile)) |
389 | return -EINVAL; | 361 | return -EINVAL; |
390 | 362 | ||
391 | profile = &kone->profiles[number - 1]; | 363 | profile = &kone->profiles[*(uint *)(attr->private)]; |
392 | 364 | ||
393 | mutex_lock(&kone->kone_lock); | 365 | mutex_lock(&kone->kone_lock); |
394 | difference = memcmp(buf, profile, sizeof(struct kone_profile)); | 366 | difference = memcmp(buf, profile, sizeof(struct kone_profile)); |
395 | if (difference) { | 367 | if (difference) { |
396 | retval = kone_set_profile(usb_dev, | 368 | retval = kone_set_profile(usb_dev, |
397 | (struct kone_profile const *)buf, number); | 369 | (struct kone_profile const *)buf, |
370 | *(uint *)(attr->private) + 1); | ||
398 | if (!retval) | 371 | if (!retval) |
399 | memcpy(profile, buf, sizeof(struct kone_profile)); | 372 | memcpy(profile, buf, sizeof(struct kone_profile)); |
400 | } | 373 | } |
@@ -406,36 +379,6 @@ static ssize_t kone_sysfs_write_profilex(struct kobject *kobj, | |||
406 | return sizeof(struct kone_profile); | 379 | return sizeof(struct kone_profile); |
407 | } | 380 | } |
408 | 381 | ||
409 | static ssize_t kone_sysfs_write_profile1(struct file *fp, struct kobject *kobj, | ||
410 | struct bin_attribute *attr, char *buf, | ||
411 | loff_t off, size_t count) { | ||
412 | return kone_sysfs_write_profilex(kobj, attr, buf, off, count, 1); | ||
413 | } | ||
414 | |||
415 | static ssize_t kone_sysfs_write_profile2(struct file *fp, struct kobject *kobj, | ||
416 | struct bin_attribute *attr, char *buf, | ||
417 | loff_t off, size_t count) { | ||
418 | return kone_sysfs_write_profilex(kobj, attr, buf, off, count, 2); | ||
419 | } | ||
420 | |||
421 | static ssize_t kone_sysfs_write_profile3(struct file *fp, struct kobject *kobj, | ||
422 | struct bin_attribute *attr, char *buf, | ||
423 | loff_t off, size_t count) { | ||
424 | return kone_sysfs_write_profilex(kobj, attr, buf, off, count, 3); | ||
425 | } | ||
426 | |||
427 | static ssize_t kone_sysfs_write_profile4(struct file *fp, struct kobject *kobj, | ||
428 | struct bin_attribute *attr, char *buf, | ||
429 | loff_t off, size_t count) { | ||
430 | return kone_sysfs_write_profilex(kobj, attr, buf, off, count, 4); | ||
431 | } | ||
432 | |||
433 | static ssize_t kone_sysfs_write_profile5(struct file *fp, struct kobject *kobj, | ||
434 | struct bin_attribute *attr, char *buf, | ||
435 | loff_t off, size_t count) { | ||
436 | return kone_sysfs_write_profilex(kobj, attr, buf, off, count, 5); | ||
437 | } | ||
438 | |||
439 | static ssize_t kone_sysfs_show_actual_profile(struct device *dev, | 382 | static ssize_t kone_sysfs_show_actual_profile(struct device *dev, |
440 | struct device_attribute *attr, char *buf) | 383 | struct device_attribute *attr, char *buf) |
441 | { | 384 | { |
@@ -691,32 +634,37 @@ static struct bin_attribute kone_bin_attributes[] = { | |||
691 | { | 634 | { |
692 | .attr = { .name = "profile1", .mode = 0660 }, | 635 | .attr = { .name = "profile1", .mode = 0660 }, |
693 | .size = sizeof(struct kone_profile), | 636 | .size = sizeof(struct kone_profile), |
694 | .read = kone_sysfs_read_profile1, | 637 | .read = kone_sysfs_read_profilex, |
695 | .write = kone_sysfs_write_profile1 | 638 | .write = kone_sysfs_write_profilex, |
639 | .private = &profile_numbers[0] | ||
696 | }, | 640 | }, |
697 | { | 641 | { |
698 | .attr = { .name = "profile2", .mode = 0660 }, | 642 | .attr = { .name = "profile2", .mode = 0660 }, |
699 | .size = sizeof(struct kone_profile), | 643 | .size = sizeof(struct kone_profile), |
700 | .read = kone_sysfs_read_profile2, | 644 | .read = kone_sysfs_read_profilex, |
701 | .write = kone_sysfs_write_profile2 | 645 | .write = kone_sysfs_write_profilex, |
646 | .private = &profile_numbers[1] | ||
702 | }, | 647 | }, |
703 | { | 648 | { |
704 | .attr = { .name = "profile3", .mode = 0660 }, | 649 | .attr = { .name = "profile3", .mode = 0660 }, |
705 | .size = sizeof(struct kone_profile), | 650 | .size = sizeof(struct kone_profile), |
706 | .read = kone_sysfs_read_profile3, | 651 | .read = kone_sysfs_read_profilex, |
707 | .write = kone_sysfs_write_profile3 | 652 | .write = kone_sysfs_write_profilex, |
653 | .private = &profile_numbers[2] | ||
708 | }, | 654 | }, |
709 | { | 655 | { |
710 | .attr = { .name = "profile4", .mode = 0660 }, | 656 | .attr = { .name = "profile4", .mode = 0660 }, |
711 | .size = sizeof(struct kone_profile), | 657 | .size = sizeof(struct kone_profile), |
712 | .read = kone_sysfs_read_profile4, | 658 | .read = kone_sysfs_read_profilex, |
713 | .write = kone_sysfs_write_profile4 | 659 | .write = kone_sysfs_write_profilex, |
660 | .private = &profile_numbers[3] | ||
714 | }, | 661 | }, |
715 | { | 662 | { |
716 | .attr = { .name = "profile5", .mode = 0660 }, | 663 | .attr = { .name = "profile5", .mode = 0660 }, |
717 | .size = sizeof(struct kone_profile), | 664 | .size = sizeof(struct kone_profile), |
718 | .read = kone_sysfs_read_profile5, | 665 | .read = kone_sysfs_read_profilex, |
719 | .write = kone_sysfs_write_profile5 | 666 | .write = kone_sysfs_write_profilex, |
667 | .private = &profile_numbers[4] | ||
720 | }, | 668 | }, |
721 | __ATTR_NULL | 669 | __ATTR_NULL |
722 | }; | 670 | }; |
diff --git a/drivers/hid/hid-roccat-pyra.c b/drivers/hid/hid-roccat-pyra.c index 7273e1e9093d..02c58e015bee 100644 --- a/drivers/hid/hid-roccat-pyra.c +++ b/drivers/hid/hid-roccat-pyra.c | |||
@@ -27,6 +27,8 @@ | |||
27 | #include "hid-roccat.h" | 27 | #include "hid-roccat.h" |
28 | #include "hid-roccat-pyra.h" | 28 | #include "hid-roccat-pyra.h" |
29 | 29 | ||
30 | static uint profile_numbers[5] = {0, 1, 2, 3, 4}; | ||
31 | |||
30 | /* pyra_class is used for creating sysfs attributes via roccat char device */ | 32 | /* pyra_class is used for creating sysfs attributes via roccat char device */ |
31 | static struct class *pyra_class; | 33 | static struct class *pyra_class; |
32 | 34 | ||
@@ -223,7 +225,7 @@ static int pyra_set_settings(struct usb_device *usb_dev, | |||
223 | 225 | ||
224 | static ssize_t pyra_sysfs_read_profilex_settings(struct file *fp, | 226 | static ssize_t pyra_sysfs_read_profilex_settings(struct file *fp, |
225 | struct kobject *kobj, struct bin_attribute *attr, char *buf, | 227 | struct kobject *kobj, struct bin_attribute *attr, char *buf, |
226 | loff_t off, size_t count, int number) | 228 | loff_t off, size_t count) |
227 | { | 229 | { |
228 | struct device *dev = | 230 | struct device *dev = |
229 | container_of(kobj, struct device, kobj)->parent->parent; | 231 | container_of(kobj, struct device, kobj)->parent->parent; |
@@ -236,56 +238,16 @@ static ssize_t pyra_sysfs_read_profilex_settings(struct file *fp, | |||
236 | count = sizeof(struct pyra_profile_settings) - off; | 238 | count = sizeof(struct pyra_profile_settings) - off; |
237 | 239 | ||
238 | mutex_lock(&pyra->pyra_lock); | 240 | mutex_lock(&pyra->pyra_lock); |
239 | memcpy(buf, ((char const *)&pyra->profile_settings[number]) + off, | 241 | memcpy(buf, ((char const *)&pyra->profile_settings[*(uint *)(attr->private)]) + off, |
240 | count); | 242 | count); |
241 | mutex_unlock(&pyra->pyra_lock); | 243 | mutex_unlock(&pyra->pyra_lock); |
242 | 244 | ||
243 | return count; | 245 | return count; |
244 | } | 246 | } |
245 | 247 | ||
246 | static ssize_t pyra_sysfs_read_profile1_settings(struct file *fp, | ||
247 | struct kobject *kobj, struct bin_attribute *attr, char *buf, | ||
248 | loff_t off, size_t count) | ||
249 | { | ||
250 | return pyra_sysfs_read_profilex_settings(fp, kobj, | ||
251 | attr, buf, off, count, 0); | ||
252 | } | ||
253 | |||
254 | static ssize_t pyra_sysfs_read_profile2_settings(struct file *fp, | ||
255 | struct kobject *kobj, struct bin_attribute *attr, char *buf, | ||
256 | loff_t off, size_t count) | ||
257 | { | ||
258 | return pyra_sysfs_read_profilex_settings(fp, kobj, | ||
259 | attr, buf, off, count, 1); | ||
260 | } | ||
261 | |||
262 | static ssize_t pyra_sysfs_read_profile3_settings(struct file *fp, | ||
263 | struct kobject *kobj, struct bin_attribute *attr, char *buf, | ||
264 | loff_t off, size_t count) | ||
265 | { | ||
266 | return pyra_sysfs_read_profilex_settings(fp, kobj, | ||
267 | attr, buf, off, count, 2); | ||
268 | } | ||
269 | |||
270 | static ssize_t pyra_sysfs_read_profile4_settings(struct file *fp, | ||
271 | struct kobject *kobj, struct bin_attribute *attr, char *buf, | ||
272 | loff_t off, size_t count) | ||
273 | { | ||
274 | return pyra_sysfs_read_profilex_settings(fp, kobj, | ||
275 | attr, buf, off, count, 3); | ||
276 | } | ||
277 | |||
278 | static ssize_t pyra_sysfs_read_profile5_settings(struct file *fp, | ||
279 | struct kobject *kobj, struct bin_attribute *attr, char *buf, | ||
280 | loff_t off, size_t count) | ||
281 | { | ||
282 | return pyra_sysfs_read_profilex_settings(fp, kobj, | ||
283 | attr, buf, off, count, 4); | ||
284 | } | ||
285 | |||
286 | static ssize_t pyra_sysfs_read_profilex_buttons(struct file *fp, | 248 | static ssize_t pyra_sysfs_read_profilex_buttons(struct file *fp, |
287 | struct kobject *kobj, struct bin_attribute *attr, char *buf, | 249 | struct kobject *kobj, struct bin_attribute *attr, char *buf, |
288 | loff_t off, size_t count, int number) | 250 | loff_t off, size_t count) |
289 | { | 251 | { |
290 | struct device *dev = | 252 | struct device *dev = |
291 | container_of(kobj, struct device, kobj)->parent->parent; | 253 | container_of(kobj, struct device, kobj)->parent->parent; |
@@ -298,53 +260,13 @@ static ssize_t pyra_sysfs_read_profilex_buttons(struct file *fp, | |||
298 | count = sizeof(struct pyra_profile_buttons) - off; | 260 | count = sizeof(struct pyra_profile_buttons) - off; |
299 | 261 | ||
300 | mutex_lock(&pyra->pyra_lock); | 262 | mutex_lock(&pyra->pyra_lock); |
301 | memcpy(buf, ((char const *)&pyra->profile_buttons[number]) + off, | 263 | memcpy(buf, ((char const *)&pyra->profile_buttons[*(uint *)(attr->private)]) + off, |
302 | count); | 264 | count); |
303 | mutex_unlock(&pyra->pyra_lock); | 265 | mutex_unlock(&pyra->pyra_lock); |
304 | 266 | ||
305 | return count; | 267 | return count; |
306 | } | 268 | } |
307 | 269 | ||
308 | static ssize_t pyra_sysfs_read_profile1_buttons(struct file *fp, | ||
309 | struct kobject *kobj, struct bin_attribute *attr, char *buf, | ||
310 | loff_t off, size_t count) | ||
311 | { | ||
312 | return pyra_sysfs_read_profilex_buttons(fp, kobj, | ||
313 | attr, buf, off, count, 0); | ||
314 | } | ||
315 | |||
316 | static ssize_t pyra_sysfs_read_profile2_buttons(struct file *fp, | ||
317 | struct kobject *kobj, struct bin_attribute *attr, char *buf, | ||
318 | loff_t off, size_t count) | ||
319 | { | ||
320 | return pyra_sysfs_read_profilex_buttons(fp, kobj, | ||
321 | attr, buf, off, count, 1); | ||
322 | } | ||
323 | |||
324 | static ssize_t pyra_sysfs_read_profile3_buttons(struct file *fp, | ||
325 | struct kobject *kobj, struct bin_attribute *attr, char *buf, | ||
326 | loff_t off, size_t count) | ||
327 | { | ||
328 | return pyra_sysfs_read_profilex_buttons(fp, kobj, | ||
329 | attr, buf, off, count, 2); | ||
330 | } | ||
331 | |||
332 | static ssize_t pyra_sysfs_read_profile4_buttons(struct file *fp, | ||
333 | struct kobject *kobj, struct bin_attribute *attr, char *buf, | ||
334 | loff_t off, size_t count) | ||
335 | { | ||
336 | return pyra_sysfs_read_profilex_buttons(fp, kobj, | ||
337 | attr, buf, off, count, 3); | ||
338 | } | ||
339 | |||
340 | static ssize_t pyra_sysfs_read_profile5_buttons(struct file *fp, | ||
341 | struct kobject *kobj, struct bin_attribute *attr, char *buf, | ||
342 | loff_t off, size_t count) | ||
343 | { | ||
344 | return pyra_sysfs_read_profilex_buttons(fp, kobj, | ||
345 | attr, buf, off, count, 4); | ||
346 | } | ||
347 | |||
348 | static ssize_t pyra_sysfs_write_profile_settings(struct file *fp, | 270 | static ssize_t pyra_sysfs_write_profile_settings(struct file *fp, |
349 | struct kobject *kobj, struct bin_attribute *attr, char *buf, | 271 | struct kobject *kobj, struct bin_attribute *attr, char *buf, |
350 | loff_t off, size_t count) | 272 | loff_t off, size_t count) |
@@ -525,27 +447,32 @@ static struct bin_attribute pyra_bin_attributes[] = { | |||
525 | { | 447 | { |
526 | .attr = { .name = "profile1_settings", .mode = 0440 }, | 448 | .attr = { .name = "profile1_settings", .mode = 0440 }, |
527 | .size = sizeof(struct pyra_profile_settings), | 449 | .size = sizeof(struct pyra_profile_settings), |
528 | .read = pyra_sysfs_read_profile1_settings | 450 | .read = pyra_sysfs_read_profilex_settings, |
451 | .private = &profile_numbers[0] | ||
529 | }, | 452 | }, |
530 | { | 453 | { |
531 | .attr = { .name = "profile2_settings", .mode = 0440 }, | 454 | .attr = { .name = "profile2_settings", .mode = 0440 }, |
532 | .size = sizeof(struct pyra_profile_settings), | 455 | .size = sizeof(struct pyra_profile_settings), |
533 | .read = pyra_sysfs_read_profile2_settings | 456 | .read = pyra_sysfs_read_profilex_settings, |
457 | .private = &profile_numbers[1] | ||
534 | }, | 458 | }, |
535 | { | 459 | { |
536 | .attr = { .name = "profile3_settings", .mode = 0440 }, | 460 | .attr = { .name = "profile3_settings", .mode = 0440 }, |
537 | .size = sizeof(struct pyra_profile_settings), | 461 | .size = sizeof(struct pyra_profile_settings), |
538 | .read = pyra_sysfs_read_profile3_settings | 462 | .read = pyra_sysfs_read_profilex_settings, |
463 | .private = &profile_numbers[2] | ||
539 | }, | 464 | }, |
540 | { | 465 | { |
541 | .attr = { .name = "profile4_settings", .mode = 0440 }, | 466 | .attr = { .name = "profile4_settings", .mode = 0440 }, |
542 | .size = sizeof(struct pyra_profile_settings), | 467 | .size = sizeof(struct pyra_profile_settings), |
543 | .read = pyra_sysfs_read_profile4_settings | 468 | .read = pyra_sysfs_read_profilex_settings, |
469 | .private = &profile_numbers[3] | ||
544 | }, | 470 | }, |
545 | { | 471 | { |
546 | .attr = { .name = "profile5_settings", .mode = 0440 }, | 472 | .attr = { .name = "profile5_settings", .mode = 0440 }, |
547 | .size = sizeof(struct pyra_profile_settings), | 473 | .size = sizeof(struct pyra_profile_settings), |
548 | .read = pyra_sysfs_read_profile5_settings | 474 | .read = pyra_sysfs_read_profilex_settings, |
475 | .private = &profile_numbers[4] | ||
549 | }, | 476 | }, |
550 | { | 477 | { |
551 | .attr = { .name = "profile_buttons", .mode = 0220 }, | 478 | .attr = { .name = "profile_buttons", .mode = 0220 }, |
@@ -555,27 +482,32 @@ static struct bin_attribute pyra_bin_attributes[] = { | |||
555 | { | 482 | { |
556 | .attr = { .name = "profile1_buttons", .mode = 0440 }, | 483 | .attr = { .name = "profile1_buttons", .mode = 0440 }, |
557 | .size = sizeof(struct pyra_profile_buttons), | 484 | .size = sizeof(struct pyra_profile_buttons), |
558 | .read = pyra_sysfs_read_profile1_buttons | 485 | .read = pyra_sysfs_read_profilex_buttons, |
486 | .private = &profile_numbers[0] | ||
559 | }, | 487 | }, |
560 | { | 488 | { |
561 | .attr = { .name = "profile2_buttons", .mode = 0440 }, | 489 | .attr = { .name = "profile2_buttons", .mode = 0440 }, |
562 | .size = sizeof(struct pyra_profile_buttons), | 490 | .size = sizeof(struct pyra_profile_buttons), |
563 | .read = pyra_sysfs_read_profile2_buttons | 491 | .read = pyra_sysfs_read_profilex_buttons, |
492 | .private = &profile_numbers[1] | ||
564 | }, | 493 | }, |
565 | { | 494 | { |
566 | .attr = { .name = "profile3_buttons", .mode = 0440 }, | 495 | .attr = { .name = "profile3_buttons", .mode = 0440 }, |
567 | .size = sizeof(struct pyra_profile_buttons), | 496 | .size = sizeof(struct pyra_profile_buttons), |
568 | .read = pyra_sysfs_read_profile3_buttons | 497 | .read = pyra_sysfs_read_profilex_buttons, |
498 | .private = &profile_numbers[2] | ||
569 | }, | 499 | }, |
570 | { | 500 | { |
571 | .attr = { .name = "profile4_buttons", .mode = 0440 }, | 501 | .attr = { .name = "profile4_buttons", .mode = 0440 }, |
572 | .size = sizeof(struct pyra_profile_buttons), | 502 | .size = sizeof(struct pyra_profile_buttons), |
573 | .read = pyra_sysfs_read_profile4_buttons | 503 | .read = pyra_sysfs_read_profilex_buttons, |
504 | .private = &profile_numbers[3] | ||
574 | }, | 505 | }, |
575 | { | 506 | { |
576 | .attr = { .name = "profile5_buttons", .mode = 0440 }, | 507 | .attr = { .name = "profile5_buttons", .mode = 0440 }, |
577 | .size = sizeof(struct pyra_profile_buttons), | 508 | .size = sizeof(struct pyra_profile_buttons), |
578 | .read = pyra_sysfs_read_profile5_buttons | 509 | .read = pyra_sysfs_read_profilex_buttons, |
510 | .private = &profile_numbers[4] | ||
579 | }, | 511 | }, |
580 | { | 512 | { |
581 | .attr = { .name = "settings", .mode = 0660 }, | 513 | .attr = { .name = "settings", .mode = 0660 }, |