Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[PATCH] Input: convert drivers/macintosh to dynamic input_dev allocation

Input: convert drivers/macntosh to dynamic input_dev allocation

This is required for input_dev sysfs integration

Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

authored by

Dmitry Torokhov and committed by
Greg Kroah-Hartman
c7f7a569 b7df3910

+136 -122
+114 -104
drivers/macintosh/adbhid.c
··· 206 206 }; 207 207 208 208 struct adbhid { 209 - struct input_dev input; 209 + struct input_dev *input; 210 210 int id; 211 211 int default_id; 212 212 int original_handler_id; ··· 291 291 292 292 switch (keycode) { 293 293 case ADB_KEY_CAPSLOCK: /* Generate down/up events for CapsLock everytime. */ 294 - input_regs(&ahid->input, regs); 295 - input_report_key(&ahid->input, KEY_CAPSLOCK, 1); 296 - input_report_key(&ahid->input, KEY_CAPSLOCK, 0); 297 - input_sync(&ahid->input); 294 + input_regs(ahid->input, regs); 295 + input_report_key(ahid->input, KEY_CAPSLOCK, 1); 296 + input_report_key(ahid->input, KEY_CAPSLOCK, 0); 297 + input_sync(ahid->input); 298 298 return; 299 299 #ifdef CONFIG_PPC_PMAC 300 300 case ADB_KEY_POWER_OLD: /* Power key on PBook 3400 needs remapping */ ··· 347 347 } 348 348 349 349 if (adbhid[id]->keycode[keycode]) { 350 - input_regs(&adbhid[id]->input, regs); 351 - input_report_key(&adbhid[id]->input, 350 + input_regs(adbhid[id]->input, regs); 351 + input_report_key(adbhid[id]->input, 352 352 adbhid[id]->keycode[keycode], !up_flag); 353 - input_sync(&adbhid[id]->input); 353 + input_sync(adbhid[id]->input); 354 354 } else 355 355 printk(KERN_INFO "Unhandled ADB key (scancode %#02x) %s.\n", keycode, 356 356 up_flag ? "released" : "pressed"); ··· 441 441 break; 442 442 } 443 443 444 - input_regs(&adbhid[id]->input, regs); 444 + input_regs(adbhid[id]->input, regs); 445 445 446 - input_report_key(&adbhid[id]->input, BTN_LEFT, !((data[1] >> 7) & 1)); 447 - input_report_key(&adbhid[id]->input, BTN_MIDDLE, !((data[2] >> 7) & 1)); 446 + input_report_key(adbhid[id]->input, BTN_LEFT, !((data[1] >> 7) & 1)); 447 + input_report_key(adbhid[id]->input, BTN_MIDDLE, !((data[2] >> 7) & 1)); 448 448 449 449 if (nb >= 4 && adbhid[id]->mouse_kind != ADBMOUSE_TRACKPAD) 450 - input_report_key(&adbhid[id]->input, BTN_RIGHT, !((data[3] >> 7) & 1)); 450 + input_report_key(adbhid[id]->input, BTN_RIGHT, !((data[3] >> 7) & 1)); 451 451 452 - input_report_rel(&adbhid[id]->input, REL_X, 452 + input_report_rel(adbhid[id]->input, REL_X, 453 453 ((data[2]&0x7f) < 64 ? (data[2]&0x7f) : (data[2]&0x7f)-128 )); 454 - input_report_rel(&adbhid[id]->input, REL_Y, 454 + input_report_rel(adbhid[id]->input, REL_Y, 455 455 ((data[1]&0x7f) < 64 ? (data[1]&0x7f) : (data[1]&0x7f)-128 )); 456 456 457 - input_sync(&adbhid[id]->input); 457 + input_sync(adbhid[id]->input); 458 458 } 459 459 460 460 static void ··· 467 467 return; 468 468 } 469 469 470 - input_regs(&adbhid[id]->input, regs); 470 + input_regs(adbhid[id]->input, regs); 471 471 472 472 switch (adbhid[id]->original_handler_id) { 473 473 default: ··· 477 477 478 478 switch (data[1] & 0x0f) { 479 479 case 0x0: /* microphone */ 480 - input_report_key(&adbhid[id]->input, KEY_SOUND, down); 480 + input_report_key(adbhid[id]->input, KEY_SOUND, down); 481 481 break; 482 482 483 483 case 0x1: /* mute */ 484 - input_report_key(&adbhid[id]->input, KEY_MUTE, down); 484 + input_report_key(adbhid[id]->input, KEY_MUTE, down); 485 485 break; 486 486 487 487 case 0x2: /* volume decrease */ 488 - input_report_key(&adbhid[id]->input, KEY_VOLUMEDOWN, down); 488 + input_report_key(adbhid[id]->input, KEY_VOLUMEDOWN, down); 489 489 break; 490 490 491 491 case 0x3: /* volume increase */ 492 - input_report_key(&adbhid[id]->input, KEY_VOLUMEUP, down); 492 + input_report_key(adbhid[id]->input, KEY_VOLUMEUP, down); 493 493 break; 494 494 495 495 default: ··· 513 513 514 514 switch (data[1] & 0x0f) { 515 515 case 0x8: /* mute */ 516 - input_report_key(&adbhid[id]->input, KEY_MUTE, down); 516 + input_report_key(adbhid[id]->input, KEY_MUTE, down); 517 517 break; 518 518 519 519 case 0x7: /* volume decrease */ 520 - input_report_key(&adbhid[id]->input, KEY_VOLUMEDOWN, down); 520 + input_report_key(adbhid[id]->input, KEY_VOLUMEDOWN, down); 521 521 break; 522 522 523 523 case 0x6: /* volume increase */ 524 - input_report_key(&adbhid[id]->input, KEY_VOLUMEUP, down); 524 + input_report_key(adbhid[id]->input, KEY_VOLUMEUP, down); 525 525 break; 526 526 527 527 case 0xb: /* eject */ 528 - input_report_key(&adbhid[id]->input, KEY_EJECTCD, down); 528 + input_report_key(adbhid[id]->input, KEY_EJECTCD, down); 529 529 break; 530 530 531 531 case 0xa: /* brightness decrease */ ··· 539 539 } 540 540 } 541 541 #endif /* CONFIG_PMAC_BACKLIGHT */ 542 - input_report_key(&adbhid[id]->input, KEY_BRIGHTNESSDOWN, down); 542 + input_report_key(adbhid[id]->input, KEY_BRIGHTNESSDOWN, down); 543 543 break; 544 544 545 545 case 0x9: /* brightness increase */ ··· 553 553 } 554 554 } 555 555 #endif /* CONFIG_PMAC_BACKLIGHT */ 556 - input_report_key(&adbhid[id]->input, KEY_BRIGHTNESSUP, down); 556 + input_report_key(adbhid[id]->input, KEY_BRIGHTNESSUP, down); 557 557 break; 558 558 559 559 case 0xc: /* videomode switch */ 560 - input_report_key(&adbhid[id]->input, KEY_SWITCHVIDEOMODE, down); 560 + input_report_key(adbhid[id]->input, KEY_SWITCHVIDEOMODE, down); 561 561 break; 562 562 563 563 case 0xd: /* keyboard illumination toggle */ 564 - input_report_key(&adbhid[id]->input, KEY_KBDILLUMTOGGLE, down); 564 + input_report_key(adbhid[id]->input, KEY_KBDILLUMTOGGLE, down); 565 565 break; 566 566 567 567 case 0xe: /* keyboard illumination decrease */ 568 - input_report_key(&adbhid[id]->input, KEY_KBDILLUMDOWN, down); 568 + input_report_key(adbhid[id]->input, KEY_KBDILLUMDOWN, down); 569 569 break; 570 570 571 571 case 0xf: ··· 573 573 case 0x8f: 574 574 case 0x0f: 575 575 /* keyboard illumination increase */ 576 - input_report_key(&adbhid[id]->input, KEY_KBDILLUMUP, down); 576 + input_report_key(adbhid[id]->input, KEY_KBDILLUMUP, down); 577 577 break; 578 578 579 579 case 0x7f: ··· 596 596 break; 597 597 } 598 598 599 - input_sync(&adbhid[id]->input); 599 + input_sync(adbhid[id]->input); 600 600 } 601 601 602 602 static struct adb_request led_request; ··· 683 683 int i; 684 684 for (i = 1; i < 16; i++) { 685 685 if (adbhid[i]) 686 - del_timer_sync(&adbhid[i]->input.timer); 686 + del_timer_sync(&adbhid[i]->input->timer); 687 687 } 688 688 } 689 689 ··· 699 699 return NOTIFY_DONE; 700 700 } 701 701 702 - static void 702 + static int 703 703 adbhid_input_register(int id, int default_id, int original_handler_id, 704 704 int current_handler_id, int mouse_kind) 705 705 { 706 + struct adbhid *hid; 707 + struct input_dev *input_dev; 708 + int err; 706 709 int i; 707 710 708 711 if (adbhid[id]) { 709 712 printk(KERN_ERR "Trying to reregister ADB HID on ID %d\n", id); 710 - return; 713 + return -EEXIST; 711 714 } 712 715 713 - if (!(adbhid[id] = kmalloc(sizeof(struct adbhid), GFP_KERNEL))) 714 - return; 716 + adbhid[id] = hid = kzalloc(sizeof(struct adbhid), GFP_KERNEL); 717 + input_dev = input_allocate_device(); 718 + if (!hid || !input_dev) { 719 + err = -ENOMEM; 720 + goto fail; 715 721 716 - memset(adbhid[id], 0, sizeof(struct adbhid)); 717 - sprintf(adbhid[id]->phys, "adb%d:%d.%02x/input", id, default_id, original_handler_id); 722 + } 718 723 719 - init_input_dev(&adbhid[id]->input); 724 + sprintf(hid->phys, "adb%d:%d.%02x/input", id, default_id, original_handler_id); 720 725 721 - adbhid[id]->id = default_id; 722 - adbhid[id]->original_handler_id = original_handler_id; 723 - adbhid[id]->current_handler_id = current_handler_id; 724 - adbhid[id]->mouse_kind = mouse_kind; 725 - adbhid[id]->flags = 0; 726 - adbhid[id]->input.private = adbhid[id]; 727 - adbhid[id]->input.name = adbhid[id]->name; 728 - adbhid[id]->input.phys = adbhid[id]->phys; 729 - adbhid[id]->input.id.bustype = BUS_ADB; 730 - adbhid[id]->input.id.vendor = 0x0001; 731 - adbhid[id]->input.id.product = (id << 12) | (default_id << 8) | original_handler_id; 732 - adbhid[id]->input.id.version = 0x0100; 726 + hid->id = default_id; 727 + hid->original_handler_id = original_handler_id; 728 + hid->current_handler_id = current_handler_id; 729 + hid->mouse_kind = mouse_kind; 730 + hid->flags = 0; 731 + input_dev->private = hid; 732 + input_dev->name = hid->name; 733 + input_dev->phys = hid->phys; 734 + input_dev->id.bustype = BUS_ADB; 735 + input_dev->id.vendor = 0x0001; 736 + input_dev->id.product = (id << 12) | (default_id << 8) | original_handler_id; 737 + input_dev->id.version = 0x0100; 733 738 734 739 switch (default_id) { 735 740 case ADB_KEYBOARD: 736 - if (!(adbhid[id]->keycode = kmalloc(sizeof(adb_to_linux_keycodes), GFP_KERNEL))) { 737 - kfree(adbhid[id]); 738 - return; 741 + hid->keycode = kmalloc(sizeof(adb_to_linux_keycodes), GFP_KERNEL); 742 + if (!hid->keycode) { 743 + err = -ENOMEM; 744 + goto fail; 739 745 } 740 746 741 - sprintf(adbhid[id]->name, "ADB keyboard"); 747 + sprintf(hid->name, "ADB keyboard"); 742 748 743 - memcpy(adbhid[id]->keycode, adb_to_linux_keycodes, sizeof(adb_to_linux_keycodes)); 749 + memcpy(hid->keycode, adb_to_linux_keycodes, sizeof(adb_to_linux_keycodes)); 744 750 745 751 printk(KERN_INFO "Detected ADB keyboard, type "); 746 752 switch (original_handler_id) { 747 753 default: 748 754 printk("<unknown>.\n"); 749 - adbhid[id]->input.id.version = ADB_KEYBOARD_UNKNOWN; 755 + input_dev->id.version = ADB_KEYBOARD_UNKNOWN; 750 756 break; 751 757 752 758 case 0x01: case 0x02: case 0x03: case 0x06: case 0x08: 753 759 case 0x0C: case 0x10: case 0x18: case 0x1B: case 0x1C: 754 760 case 0xC0: case 0xC3: case 0xC6: 755 761 printk("ANSI.\n"); 756 - adbhid[id]->input.id.version = ADB_KEYBOARD_ANSI; 762 + input_dev->id.version = ADB_KEYBOARD_ANSI; 757 763 break; 758 764 759 765 case 0x04: case 0x05: case 0x07: case 0x09: case 0x0D: 760 766 case 0x11: case 0x14: case 0x19: case 0x1D: case 0xC1: 761 767 case 0xC4: case 0xC7: 762 768 printk("ISO, swapping keys.\n"); 763 - adbhid[id]->input.id.version = ADB_KEYBOARD_ISO; 764 - i = adbhid[id]->keycode[10]; 765 - adbhid[id]->keycode[10] = adbhid[id]->keycode[50]; 766 - adbhid[id]->keycode[50] = i; 769 + input_dev->id.version = ADB_KEYBOARD_ISO; 770 + i = hid->keycode[10]; 771 + hid->keycode[10] = hid->keycode[50]; 772 + hid->keycode[50] = i; 767 773 break; 768 774 769 775 case 0x12: case 0x15: case 0x16: case 0x17: case 0x1A: 770 776 case 0x1E: case 0xC2: case 0xC5: case 0xC8: case 0xC9: 771 777 printk("JIS.\n"); 772 - adbhid[id]->input.id.version = ADB_KEYBOARD_JIS; 778 + input_dev->id.version = ADB_KEYBOARD_JIS; 773 779 break; 774 780 } 775 781 776 782 for (i = 0; i < 128; i++) 777 - if (adbhid[id]->keycode[i]) 778 - set_bit(adbhid[id]->keycode[i], adbhid[id]->input.keybit); 783 + if (hid->keycode[i]) 784 + set_bit(hid->keycode[i], input_dev->keybit); 779 785 780 - adbhid[id]->input.evbit[0] = BIT(EV_KEY) | BIT(EV_LED) | BIT(EV_REP); 781 - adbhid[id]->input.ledbit[0] = BIT(LED_SCROLLL) | BIT(LED_CAPSL) | BIT(LED_NUML); 782 - adbhid[id]->input.event = adbhid_kbd_event; 783 - adbhid[id]->input.keycodemax = 127; 784 - adbhid[id]->input.keycodesize = 1; 786 + input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_LED) | BIT(EV_REP); 787 + input_dev->ledbit[0] = BIT(LED_SCROLLL) | BIT(LED_CAPSL) | BIT(LED_NUML); 788 + input_dev->event = adbhid_kbd_event; 789 + input_dev->keycodemax = 127; 790 + input_dev->keycodesize = 1; 785 791 break; 786 792 787 793 case ADB_MOUSE: 788 - sprintf(adbhid[id]->name, "ADB mouse"); 794 + sprintf(hid->name, "ADB mouse"); 789 795 790 - adbhid[id]->input.evbit[0] = BIT(EV_KEY) | BIT(EV_REL); 791 - adbhid[id]->input.keybit[LONG(BTN_MOUSE)] = BIT(BTN_LEFT) | BIT(BTN_MIDDLE) | BIT(BTN_RIGHT); 792 - adbhid[id]->input.relbit[0] = BIT(REL_X) | BIT(REL_Y); 796 + input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_REL); 797 + input_dev->keybit[LONG(BTN_MOUSE)] = BIT(BTN_LEFT) | BIT(BTN_MIDDLE) | BIT(BTN_RIGHT); 798 + input_dev->relbit[0] = BIT(REL_X) | BIT(REL_Y); 793 799 break; 794 800 795 801 case ADB_MISC: 796 802 switch (original_handler_id) { 797 803 case 0x02: /* Adjustable keyboard button device */ 798 - sprintf(adbhid[id]->name, "ADB adjustable keyboard buttons"); 799 - adbhid[id]->input.evbit[0] = BIT(EV_KEY) | BIT(EV_REP); 800 - set_bit(KEY_SOUND, adbhid[id]->input.keybit); 801 - set_bit(KEY_MUTE, adbhid[id]->input.keybit); 802 - set_bit(KEY_VOLUMEUP, adbhid[id]->input.keybit); 803 - set_bit(KEY_VOLUMEDOWN, adbhid[id]->input.keybit); 804 + sprintf(hid->name, "ADB adjustable keyboard buttons"); 805 + input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_REP); 806 + set_bit(KEY_SOUND, input_dev->keybit); 807 + set_bit(KEY_MUTE, input_dev->keybit); 808 + set_bit(KEY_VOLUMEUP, input_dev->keybit); 809 + set_bit(KEY_VOLUMEDOWN, input_dev->keybit); 804 810 break; 805 811 case 0x1f: /* Powerbook button device */ 806 - sprintf(adbhid[id]->name, "ADB Powerbook buttons"); 807 - adbhid[id]->input.evbit[0] = BIT(EV_KEY) | BIT(EV_REP); 808 - set_bit(KEY_MUTE, adbhid[id]->input.keybit); 809 - set_bit(KEY_VOLUMEUP, adbhid[id]->input.keybit); 810 - set_bit(KEY_VOLUMEDOWN, adbhid[id]->input.keybit); 811 - set_bit(KEY_BRIGHTNESSUP, adbhid[id]->input.keybit); 812 - set_bit(KEY_BRIGHTNESSDOWN, adbhid[id]->input.keybit); 813 - set_bit(KEY_EJECTCD, adbhid[id]->input.keybit); 814 - set_bit(KEY_SWITCHVIDEOMODE, adbhid[id]->input.keybit); 815 - set_bit(KEY_KBDILLUMTOGGLE, adbhid[id]->input.keybit); 816 - set_bit(KEY_KBDILLUMDOWN, adbhid[id]->input.keybit); 817 - set_bit(KEY_KBDILLUMUP, adbhid[id]->input.keybit); 812 + sprintf(hid->name, "ADB Powerbook buttons"); 813 + input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_REP); 814 + set_bit(KEY_MUTE, input_dev->keybit); 815 + set_bit(KEY_VOLUMEUP, input_dev->keybit); 816 + set_bit(KEY_VOLUMEDOWN, input_dev->keybit); 817 + set_bit(KEY_BRIGHTNESSUP, input_dev->keybit); 818 + set_bit(KEY_BRIGHTNESSDOWN, input_dev->keybit); 819 + set_bit(KEY_EJECTCD, input_dev->keybit); 820 + set_bit(KEY_SWITCHVIDEOMODE, input_dev->keybit); 821 + set_bit(KEY_KBDILLUMTOGGLE, input_dev->keybit); 822 + set_bit(KEY_KBDILLUMDOWN, input_dev->keybit); 823 + set_bit(KEY_KBDILLUMUP, input_dev->keybit); 818 824 break; 819 825 } 820 - if (adbhid[id]->name[0]) 826 + if (hid->name[0]) 821 827 break; 822 828 /* else fall through */ 823 829 824 830 default: 825 831 printk(KERN_INFO "Trying to register unknown ADB device to input layer.\n"); 826 - kfree(adbhid[id]); 827 - return; 832 + err = -ENODEV; 833 + goto fail; 828 834 } 829 835 830 - adbhid[id]->input.keycode = adbhid[id]->keycode; 836 + input_dev->keycode = hid->keycode; 831 837 832 - input_register_device(&adbhid[id]->input); 833 - 834 - printk(KERN_INFO "input: %s on %s\n", 835 - adbhid[id]->name, adbhid[id]->phys); 838 + input_register_device(input_dev); 836 839 837 840 if (default_id == ADB_KEYBOARD) { 838 841 /* HACK WARNING!! This should go away as soon there is an utility 839 842 * to control that for event devices. 840 843 */ 841 - adbhid[id]->input.rep[REP_DELAY] = 500; /* input layer default: 250 */ 842 - adbhid[id]->input.rep[REP_PERIOD] = 66; /* input layer default: 33 */ 844 + input_dev->rep[REP_DELAY] = 500; /* input layer default: 250 */ 845 + input_dev->rep[REP_PERIOD] = 66; /* input layer default: 33 */ 843 846 } 847 + 848 + return 0; 849 + 850 + fail: input_free_device(input_dev); 851 + kfree(hid); 852 + adbhid[id] = NULL; 853 + return err; 844 854 } 845 855 846 856 static void adbhid_input_unregister(int id) 847 857 { 848 - input_unregister_device(&adbhid[id]->input); 858 + input_unregister_device(adbhid[id]->input); 849 859 if (adbhid[id]->keycode) 850 860 kfree(adbhid[id]->keycode); 851 861 kfree(adbhid[id]); ··· 868 858 int cur_handler_id, int mk) 869 859 { 870 860 if (adbhid[id]) { 871 - if (adbhid[id]->input.id.product != 861 + if (adbhid[id]->input->id.product != 872 862 ((id << 12)|(default_id << 8)|org_handler_id)) { 873 863 adbhid_input_unregister(id); 874 864 adbhid_input_register(id, default_id, org_handler_id,
+22 -18
drivers/macintosh/mac_hid.c
··· 16 16 #include <linux/module.h> 17 17 18 18 19 - static struct input_dev emumousebtn; 20 - static void emumousebtn_input_register(void); 19 + static struct input_dev *emumousebtn; 20 + static int emumousebtn_input_register(void); 21 21 static int mouse_emulate_buttons = 0; 22 22 static int mouse_button2_keycode = KEY_RIGHTCTRL; /* right control key */ 23 23 static int mouse_button3_keycode = KEY_RIGHTALT; /* right option key */ ··· 90 90 && (keycode == mouse_button2_keycode 91 91 || keycode == mouse_button3_keycode)) { 92 92 if (mouse_emulate_buttons == 1) { 93 - input_report_key(&emumousebtn, 93 + input_report_key(emumousebtn, 94 94 keycode == mouse_button2_keycode ? BTN_MIDDLE : BTN_RIGHT, 95 95 down); 96 - input_sync(&emumousebtn); 96 + input_sync(emumousebtn); 97 97 return 1; 98 98 } 99 99 mouse_last_keycode = down ? keycode : 0; ··· 105 105 106 106 EXPORT_SYMBOL(mac_hid_mouse_emulate_buttons); 107 107 108 - static void emumousebtn_input_register(void) 108 + static int emumousebtn_input_register(void) 109 109 { 110 - emumousebtn.name = "Macintosh mouse button emulation"; 110 + emumousebtn = input_allocate_device(); 111 + if (!emumousebtn) 112 + return -ENOMEM; 111 113 112 - init_input_dev(&emumousebtn); 114 + emumousebtn->name = "Macintosh mouse button emulation"; 115 + emumousebtn->id.bustype = BUS_ADB; 116 + emumousebtn->id.vendor = 0x0001; 117 + emumousebtn->id.product = 0x0001; 118 + emumousebtn->id.version = 0x0100; 113 119 114 - emumousebtn.evbit[0] = BIT(EV_KEY) | BIT(EV_REL); 115 - emumousebtn.keybit[LONG(BTN_MOUSE)] = BIT(BTN_LEFT) | BIT(BTN_MIDDLE) | BIT(BTN_RIGHT); 116 - emumousebtn.relbit[0] = BIT(REL_X) | BIT(REL_Y); 120 + emumousebtn->evbit[0] = BIT(EV_KEY) | BIT(EV_REL); 121 + emumousebtn->keybit[LONG(BTN_MOUSE)] = BIT(BTN_LEFT) | BIT(BTN_MIDDLE) | BIT(BTN_RIGHT); 122 + emumousebtn->relbit[0] = BIT(REL_X) | BIT(REL_Y); 117 123 118 - emumousebtn.id.bustype = BUS_ADB; 119 - emumousebtn.id.vendor = 0x0001; 120 - emumousebtn.id.product = 0x0001; 121 - emumousebtn.id.version = 0x0100; 124 + input_register_device(emumousebtn); 122 125 123 - input_register_device(&emumousebtn); 124 - 125 - printk(KERN_INFO "input: Macintosh mouse button emulation\n"); 126 + return 0; 126 127 } 127 128 128 129 int __init mac_hid_init(void) 129 130 { 131 + int err; 130 132 131 - emumousebtn_input_register(); 133 + err = emumousebtn_input_register(); 134 + if (err) 135 + return err; 132 136 133 137 #if defined(CONFIG_SYSCTL) 134 138 mac_hid_sysctl_header = register_sysctl_table(mac_hid_root_dir, 1);