*** pcc_acpi.c 2006-11-21 07:38:41.000000000 +0000 --- pcc_acpi.c 2008-10-08 15:32:12.000000000 +0100 *************** *** 168,174 **** #define METHOD_HKEY_SQTY "SQTY" #define METHOD_HKEY_SINF "SINF" #define METHOD_HKEY_SSET "SSET" - #define HKEY_HID "MAT0012,MAT0013,MAT0018,MAT0019" #define HKEY_NOTIFY 0x80 /* for brightness control */ --- 168,173 ---- *************** *** 212,224 **** static int acpi_pcc_hotkey_add(struct acpi_device *device); static int acpi_pcc_hotkey_remove(struct acpi_device *device, int type); ! static int acpi_pcc_hotkey_resume(struct acpi_device *device, int state); static struct acpi_driver acpi_pcc_driver = { .name = ACPI_PCC_DRIVER_NAME, .class = ACPI_PCC_CLASS, ! .ids = HKEY_HID, .ops = { .add = acpi_pcc_hotkey_add, .remove = acpi_pcc_hotkey_remove, --- 211,231 ---- static int acpi_pcc_hotkey_add(struct acpi_device *device); static int acpi_pcc_hotkey_remove(struct acpi_device *device, int type); ! static int acpi_pcc_hotkey_resume(struct acpi_device *device); + static const struct acpi_device_id pcc_device_ids[] = { + {"MAT0012", 0}, + {"MAT0013", 0}, + {"MAT0018", 0}, + {"MAT0019", 0}, + {"", 0}, + }; + MODULE_DEVICE_TABLE(acpi, pcc_device_ids); static struct acpi_driver acpi_pcc_driver = { .name = ACPI_PCC_DRIVER_NAME, .class = ACPI_PCC_CLASS, ! .ids = pcc_device_ids, .ops = { .add = acpi_pcc_hotkey_add, .remove = acpi_pcc_hotkey_remove, *************** *** 388,394 **** { struct acpi_hotkey *hotkey = (struct acpi_hotkey *) seq->private; struct input_dev *hotk_input_dev = hotkey->input_dev; ! struct pcc_keyinput *keyinput = hotk_input_dev->private; ACPI_FUNCTION_TRACE("acpi_pcc_keyinput_show"); --- 395,401 ---- { struct acpi_hotkey *hotkey = (struct acpi_hotkey *) seq->private; struct input_dev *hotk_input_dev = hotkey->input_dev; ! struct pcc_keyinput *keyinput = input_get_drvdata(hotk_input_dev); ACPI_FUNCTION_TRACE("acpi_pcc_keyinput_show"); *************** *** 541,547 **** write_string[count] = '\0'; if (sscanf(write_string, "%i", &key_mode) == 1 && (key_mode == 0 || key_mode == 1)) { ! keyinput = (struct pcc_keyinput *) hotkey->input_dev->private; keyinput->key_mode = key_mode; } --- 548,554 ---- write_string[count] = '\0'; if (sscanf(write_string, "%i", &key_mode) == 1 && (key_mode == 0 || key_mode == 1)) { ! keyinput = (struct pcc_keyinput *) input_get_drvdata(hotkey->input_dev); keyinput->key_mode = key_mode; } *************** *** 554,560 **** static void acpi_pcc_generete_keyinput(struct acpi_hotkey *hotkey) { struct input_dev *hotk_input_dev = hotkey->input_dev; ! struct pcc_keyinput *keyinput = hotk_input_dev->private; int hinf = hotkey->status; int key_code, hkey_num; const int key_map[] = { --- 561,567 ---- static void acpi_pcc_generete_keyinput(struct acpi_hotkey *hotkey) { struct input_dev *hotk_input_dev = hotkey->input_dev; ! struct pcc_keyinput *keyinput = input_get_drvdata(hotk_input_dev); int hinf = hotkey->status; int key_code, hkey_num; const int key_map[] = { *************** *** 622,628 **** case HKEY_NOTIFY: if (acpi_pcc_hotkey_get_key(hotkey)) { /* generate event like '"pcc HKEY 00000080 00000084"' when Fn+F4 pressed */ ! acpi_bus_generate_event(hotkey->device, event, hotkey->status); } acpi_pcc_generete_keyinput(hotkey); break; --- 629,635 ---- case HKEY_NOTIFY: if (acpi_pcc_hotkey_get_key(hotkey)) { /* generate event like '"pcc HKEY 00000080 00000084"' when Fn+F4 pressed */ ! acpi_bus_generate_proc_event(hotkey->device, event, hotkey->status); } acpi_pcc_generete_keyinput(hotkey); break; *************** *** 820,826 **** pcc_keyinput->key_mode = 1; /* default on */ pcc_keyinput->hotkey = hotkey; ! hotk_input_dev->private = pcc_keyinput; hotkey->input_dev = hotk_input_dev; --- 827,833 ---- pcc_keyinput->key_mode = 1; /* default on */ pcc_keyinput->hotkey = hotkey; ! input_set_drvdata(hotk_input_dev,pcc_keyinput); hotkey->input_dev = hotk_input_dev; *************** *** 834,840 **** module init -------------------------------------------------------------------------- */ ! static int acpi_pcc_hotkey_resume(struct acpi_device *device, int state) { struct acpi_hotkey *hotkey = acpi_driver_data(device); acpi_status status = AE_OK; --- 841,847 ---- module init -------------------------------------------------------------------------- */ ! static int acpi_pcc_hotkey_resume(struct acpi_device *device) { struct acpi_hotkey *hotkey = acpi_driver_data(device); acpi_status status = AE_OK; *************** *** 949,954 **** --- 956,963 ---- if (ACPI_FAILURE(status)) ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Error removing notify handler\n")); + input_unregister_device(hotkey->input_dev); + kfree(hotkey); return_VALUE(status == AE_OK); }