Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 177584
b: refs/heads/master
c: 46b51eb
h: refs/heads/master
v: v3
  • Loading branch information
Anisse Astier authored and Len Brown committed Dec 16, 2009
1 parent 0d7a689 commit c3a5792
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 30 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: addd65aac7bcfed7348048b3ce24774718fc44c3
refs/heads/master: 46b51eb9e14afb3bde4bc2fe3bbc22ce012647d4
64 changes: 35 additions & 29 deletions trunk/drivers/platform/x86/msi-wmi.c
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,8 @@ static int __init msi_wmi_input_setup(void)
int err;

msi_wmi_input_dev = input_allocate_device();
if (!msi_wmi_input_dev)
return -ENOMEM;

msi_wmi_input_dev->name = "MSI WMI hotkeys";
msi_wmi_input_dev->phys = "wmi/input0";
Expand Down Expand Up @@ -314,40 +316,44 @@ static int __init msi_wmi_init(void)
{
int err;

if (wmi_has_guid(MSIWMI_EVENT_GUID)) {
err = wmi_install_notify_handler(MSIWMI_EVENT_GUID,
msi_wmi_notify, NULL);
if (err)
return -EINVAL;

err = msi_wmi_input_setup();
if (err) {
wmi_remove_notify_handler(MSIWMI_EVENT_GUID);
return -EINVAL;
}
if (!wmi_has_guid(MSIWMI_EVENT_GUID)) {
printk(KERN_ERR
"This machine doesn't have MSI-hotkeys through WMI\n");
return -ENODEV;
}
err = wmi_install_notify_handler(MSIWMI_EVENT_GUID,
msi_wmi_notify, NULL);
if (err)
return -EINVAL;

if (!acpi_video_backlight_support()) {
backlight = backlight_device_register(DRV_NAME,
NULL, NULL, &msi_backlight_ops);
if (IS_ERR(backlight)) {
wmi_remove_notify_handler(MSIWMI_EVENT_GUID);
input_unregister_device(msi_wmi_input_dev);
return -EINVAL;
}
err = msi_wmi_input_setup();
if (err)
goto err_uninstall_notifier;

backlight->props.max_brightness = ARRAY_SIZE(backlight_map) - 1;
err = bl_get(NULL);
if (err < 0) {
wmi_remove_notify_handler(MSIWMI_EVENT_GUID);
input_unregister_device(msi_wmi_input_dev);
backlight_device_unregister(backlight);
return -EINVAL;
}
backlight->props.brightness = err;
}
if (!acpi_video_backlight_support()) {
backlight = backlight_device_register(DRV_NAME,
NULL, NULL, &msi_backlight_ops);
if (IS_ERR(backlight))
goto err_free_input;

backlight->props.max_brightness = ARRAY_SIZE(backlight_map) - 1;
err = bl_get(NULL);
if (err < 0)
goto err_free_backlight;

backlight->props.brightness = err;
}
printk(KERN_INFO DRV_PFX "Event handler installed\n");

return 0;

err_free_backlight:
backlight_device_unregister(backlight);
err_free_input:
input_unregister_device(msi_wmi_input_dev);
err_uninstall_notifier:
wmi_remove_notify_handler(MSIWMI_EVENT_GUID);
return err;
}

static void __exit msi_wmi_exit(void)
Expand Down

0 comments on commit c3a5792

Please sign in to comment.