diff options
Diffstat (limited to 'drivers/platform/x86/msi-wmi.c')
-rw-r--r-- | drivers/platform/x86/msi-wmi.c | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/drivers/platform/x86/msi-wmi.c b/drivers/platform/x86/msi-wmi.c index f5f70d4c6913..d1736009636f 100644 --- a/drivers/platform/x86/msi-wmi.c +++ b/drivers/platform/x86/msi-wmi.c | |||
@@ -26,6 +26,7 @@ | |||
26 | #include <linux/input/sparse-keymap.h> | 26 | #include <linux/input/sparse-keymap.h> |
27 | #include <linux/acpi.h> | 27 | #include <linux/acpi.h> |
28 | #include <linux/backlight.h> | 28 | #include <linux/backlight.h> |
29 | #include <linux/slab.h> | ||
29 | 30 | ||
30 | MODULE_AUTHOR("Thomas Renninger <trenn@suse.de>"); | 31 | MODULE_AUTHOR("Thomas Renninger <trenn@suse.de>"); |
31 | MODULE_DESCRIPTION("MSI laptop WMI hotkeys driver"); | 32 | MODULE_DESCRIPTION("MSI laptop WMI hotkeys driver"); |
@@ -138,7 +139,7 @@ static int bl_set_status(struct backlight_device *bd) | |||
138 | return msi_wmi_set_block(0, backlight_map[bright]); | 139 | return msi_wmi_set_block(0, backlight_map[bright]); |
139 | } | 140 | } |
140 | 141 | ||
141 | static struct backlight_ops msi_backlight_ops = { | 142 | static const struct backlight_ops msi_backlight_ops = { |
142 | .get_brightness = bl_get, | 143 | .get_brightness = bl_get, |
143 | .update_status = bl_set_status, | 144 | .update_status = bl_set_status, |
144 | }; | 145 | }; |
@@ -249,12 +250,17 @@ static int __init msi_wmi_init(void) | |||
249 | goto err_uninstall_notifier; | 250 | goto err_uninstall_notifier; |
250 | 251 | ||
251 | if (!acpi_video_backlight_support()) { | 252 | if (!acpi_video_backlight_support()) { |
252 | backlight = backlight_device_register(DRV_NAME, | 253 | struct backlight_properties props; |
253 | NULL, NULL, &msi_backlight_ops); | 254 | memset(&props, 0, sizeof(struct backlight_properties)); |
254 | if (IS_ERR(backlight)) | 255 | props.max_brightness = ARRAY_SIZE(backlight_map) - 1; |
256 | backlight = backlight_device_register(DRV_NAME, NULL, NULL, | ||
257 | &msi_backlight_ops, | ||
258 | &props); | ||
259 | if (IS_ERR(backlight)) { | ||
260 | err = PTR_ERR(backlight); | ||
255 | goto err_free_input; | 261 | goto err_free_input; |
262 | } | ||
256 | 263 | ||
257 | backlight->props.max_brightness = ARRAY_SIZE(backlight_map) - 1; | ||
258 | err = bl_get(NULL); | 264 | err = bl_get(NULL); |
259 | if (err < 0) | 265 | if (err < 0) |
260 | goto err_free_backlight; | 266 | goto err_free_backlight; |