Re: [PATCH, RFC] HP WMI hotkey driver
From: "Dmitry Torokhov" <dmitry.torokhov@gmail.com>
Date: 2008-01-03 16:58:05
Also in:
linux-acpi
Hi Matthew, On Dec 26, 2007 5:48 PM, Matthew Garrett [off-list ref] wrote:
quoted hunk ↗ jump to hunk
+ } else + printk (KERN_INFO "HP WMI: Unknown response received\n"); + + return;
No need for empty returns.
quoted hunk ↗ jump to hunk
+} + +static int __init hp_wmi_init(void) +{ + int err; + const struct key_entry *key; + + if (!wmi_has_guid(HPWMI_GUID)) { + printk ("Unable to locate guid\n"); + return -ENODEV; + } + + err = wmi_install_notify_handler (hp_wmi_notify, NULL); + if (err) + return err; + + hp_wmi_input_dev = input_allocate_device(); + + hp_wmi_input_dev->name = "HP WMI hotkeys"; + hp_wmi_input_dev->phys = "wmi/input0"; + hp_wmi_input_dev->id.bustype = BUS_HOST; + hp_wmi_input_dev->getkeycode = hp_wmi_getkeycode; + hp_wmi_input_dev->setkeycode = hp_wmi_setkeycode; +
There is no sysfs device to attach the input device to, by any chance?
quoted hunk ↗ jump to hunk
+ for (key = hp_wmi_keymap; key->type != KE_END; key++) { + set_bit(EV_KEY, hp_wmi_input_dev->evbit); + set_bit(key->keycode, hp_wmi_input_dev->keybit); + } + + err = input_register_device (hp_wmi_input_dev); + + if (err) { + input_free_device (hp_wmi_input_dev); + return err; + } + + return 0; +} + +static void __exit hp_wmi_exit(void) +{ + wmi_remove_notify_handler(); + input_unregister_device (hp_wmi_input_dev); + input_free_device (hp_wmi_input_dev);
Do not call input_free_device after input_unregister_device, it may cause freeing already freed memory. -- Dmitry