2019-05-27 14:55:05 +08:00
|
|
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
2009-12-10 21:18:13 +08:00
|
|
|
/*
|
|
|
|
* MSI WMI hotkeys
|
|
|
|
*
|
|
|
|
* Copyright (C) 2009 Novell <trenn@suse.de>
|
|
|
|
*
|
|
|
|
* Most stuff taken over from hp-wmi
|
|
|
|
*/
|
|
|
|
|
2011-03-30 06:21:47 +08:00
|
|
|
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
|
2009-12-10 21:18:13 +08:00
|
|
|
|
|
|
|
#include <linux/kernel.h>
|
|
|
|
#include <linux/input.h>
|
2009-12-10 21:18:19 +08:00
|
|
|
#include <linux/input/sparse-keymap.h>
|
2009-12-10 21:18:13 +08:00
|
|
|
#include <linux/acpi.h>
|
|
|
|
#include <linux/backlight.h>
|
include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h
percpu.h is included by sched.h and module.h and thus ends up being
included when building most .c files. percpu.h includes slab.h which
in turn includes gfp.h making everything defined by the two files
universally available and complicating inclusion dependencies.
percpu.h -> slab.h dependency is about to be removed. Prepare for
this change by updating users of gfp and slab facilities include those
headers directly instead of assuming availability. As this conversion
needs to touch large number of source files, the following script is
used as the basis of conversion.
http://userweb.kernel.org/~tj/misc/slabh-sweep.py
The script does the followings.
* Scan files for gfp and slab usages and update includes such that
only the necessary includes are there. ie. if only gfp is used,
gfp.h, if slab is used, slab.h.
* When the script inserts a new include, it looks at the include
blocks and try to put the new include such that its order conforms
to its surrounding. It's put in the include block which contains
core kernel includes, in the same order that the rest are ordered -
alphabetical, Christmas tree, rev-Xmas-tree or at the end if there
doesn't seem to be any matching order.
* If the script can't find a place to put a new include (mostly
because the file doesn't have fitting include block), it prints out
an error message indicating which .h file needs to be added to the
file.
The conversion was done in the following steps.
1. The initial automatic conversion of all .c files updated slightly
over 4000 files, deleting around 700 includes and adding ~480 gfp.h
and ~3000 slab.h inclusions. The script emitted errors for ~400
files.
2. Each error was manually checked. Some didn't need the inclusion,
some needed manual addition while adding it to implementation .h or
embedding .c file was more appropriate for others. This step added
inclusions to around 150 files.
3. The script was run again and the output was compared to the edits
from #2 to make sure no file was left behind.
4. Several build tests were done and a couple of problems were fixed.
e.g. lib/decompress_*.c used malloc/free() wrappers around slab
APIs requiring slab.h to be added manually.
5. The script was run on all .h files but without automatically
editing them as sprinkling gfp.h and slab.h inclusions around .h
files could easily lead to inclusion dependency hell. Most gfp.h
inclusion directives were ignored as stuff from gfp.h was usually
wildly available and often used in preprocessor macros. Each
slab.h inclusion directive was examined and added manually as
necessary.
6. percpu.h was updated not to include slab.h.
7. Build test were done on the following configurations and failures
were fixed. CONFIG_GCOV_KERNEL was turned off for all tests (as my
distributed build env didn't work with gcov compiles) and a few
more options had to be turned off depending on archs to make things
build (like ipr on powerpc/64 which failed due to missing writeq).
* x86 and x86_64 UP and SMP allmodconfig and a custom test config.
* powerpc and powerpc64 SMP allmodconfig
* sparc and sparc64 SMP allmodconfig
* ia64 SMP allmodconfig
* s390 SMP allmodconfig
* alpha SMP allmodconfig
* um on x86_64 SMP allmodconfig
8. percpu.h modifications were reverted so that it could be applied as
a separate patch and serve as bisection point.
Given the fact that I had only a couple of failures from tests on step
6, I'm fairly confident about the coverage of this conversion patch.
If there is a breakage, it's likely to be something in one of the arch
headers which should be easily discoverable easily on most builds of
the specific arch.
Signed-off-by: Tejun Heo <tj@kernel.org>
Guess-its-ok-by: Christoph Lameter <cl@linux-foundation.org>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Lee Schermerhorn <Lee.Schermerhorn@hp.com>
2010-03-24 16:04:11 +08:00
|
|
|
#include <linux/slab.h>
|
2011-05-28 00:33:10 +08:00
|
|
|
#include <linux/module.h>
|
2015-06-16 22:28:07 +08:00
|
|
|
#include <acpi/video.h>
|
2009-12-10 21:18:13 +08:00
|
|
|
|
|
|
|
MODULE_AUTHOR("Thomas Renninger <trenn@suse.de>");
|
|
|
|
MODULE_DESCRIPTION("MSI laptop WMI hotkeys driver");
|
|
|
|
MODULE_LICENSE("GPL");
|
|
|
|
|
|
|
|
#define DRV_NAME "msi-wmi"
|
|
|
|
|
|
|
|
#define MSIWMI_BIOS_GUID "551A1F84-FBDD-4125-91DB-3EA8F44F1D45"
|
2012-12-16 01:31:36 +08:00
|
|
|
#define MSIWMI_MSI_EVENT_GUID "B6F3EEF2-3D2F-49DC-9DE3-85BCE18C62F2"
|
|
|
|
#define MSIWMI_WIND_EVENT_GUID "5B3CC38A-40D9-7245-8AE6-1145B751BE3F"
|
2009-12-10 21:18:13 +08:00
|
|
|
|
2012-12-16 01:31:32 +08:00
|
|
|
MODULE_ALIAS("wmi:" MSIWMI_BIOS_GUID);
|
2012-12-16 01:31:36 +08:00
|
|
|
MODULE_ALIAS("wmi:" MSIWMI_MSI_EVENT_GUID);
|
|
|
|
MODULE_ALIAS("wmi:" MSIWMI_WIND_EVENT_GUID);
|
2012-12-16 01:31:32 +08:00
|
|
|
|
2012-12-16 01:31:33 +08:00
|
|
|
enum msi_scancodes {
|
2012-12-16 01:31:36 +08:00
|
|
|
/* Generic MSI keys (not present on MSI Wind) */
|
2012-12-16 01:31:35 +08:00
|
|
|
MSI_KEY_BRIGHTNESSUP = 0xD0,
|
2012-12-16 01:31:33 +08:00
|
|
|
MSI_KEY_BRIGHTNESSDOWN,
|
|
|
|
MSI_KEY_VOLUMEUP,
|
|
|
|
MSI_KEY_VOLUMEDOWN,
|
|
|
|
MSI_KEY_MUTE,
|
2012-12-16 01:31:36 +08:00
|
|
|
/* MSI Wind keys */
|
|
|
|
WIND_KEY_TOUCHPAD = 0x08, /* Fn+F3 touchpad toggle */
|
|
|
|
WIND_KEY_BLUETOOTH = 0x56, /* Fn+F11 Bluetooth toggle */
|
|
|
|
WIND_KEY_CAMERA, /* Fn+F6 webcam toggle */
|
|
|
|
WIND_KEY_WLAN = 0x5f, /* Fn+F11 Wi-Fi toggle */
|
|
|
|
WIND_KEY_TURBO, /* Fn+F10 turbo mode toggle */
|
|
|
|
WIND_KEY_ECO = 0x69, /* Fn+F10 ECO mode toggle */
|
2012-12-16 01:31:33 +08:00
|
|
|
};
|
2009-12-10 21:18:13 +08:00
|
|
|
static struct key_entry msi_wmi_keymap[] = {
|
2012-12-16 01:31:33 +08:00
|
|
|
{ KE_KEY, MSI_KEY_BRIGHTNESSUP, {KEY_BRIGHTNESSUP} },
|
|
|
|
{ KE_KEY, MSI_KEY_BRIGHTNESSDOWN, {KEY_BRIGHTNESSDOWN} },
|
|
|
|
{ KE_KEY, MSI_KEY_VOLUMEUP, {KEY_VOLUMEUP} },
|
|
|
|
{ KE_KEY, MSI_KEY_VOLUMEDOWN, {KEY_VOLUMEDOWN} },
|
|
|
|
{ KE_KEY, MSI_KEY_MUTE, {KEY_MUTE} },
|
2012-12-16 01:31:36 +08:00
|
|
|
|
|
|
|
/* These keys work without WMI. Ignore them to avoid double keycodes */
|
|
|
|
{ KE_IGNORE, WIND_KEY_TOUCHPAD, {KEY_TOUCHPAD_TOGGLE} },
|
|
|
|
{ KE_IGNORE, WIND_KEY_BLUETOOTH, {KEY_BLUETOOTH} },
|
|
|
|
{ KE_IGNORE, WIND_KEY_CAMERA, {KEY_CAMERA} },
|
|
|
|
{ KE_IGNORE, WIND_KEY_WLAN, {KEY_WLAN} },
|
|
|
|
|
|
|
|
/* These are unknown WMI events found on MSI Wind */
|
|
|
|
{ KE_IGNORE, 0x00 },
|
|
|
|
{ KE_IGNORE, 0x62 },
|
|
|
|
{ KE_IGNORE, 0x63 },
|
|
|
|
|
|
|
|
/* These are MSI Wind keys that should be handled via WMI */
|
|
|
|
{ KE_KEY, WIND_KEY_TURBO, {KEY_PROG1} },
|
|
|
|
{ KE_KEY, WIND_KEY_ECO, {KEY_PROG2} },
|
|
|
|
|
2012-12-16 01:31:33 +08:00
|
|
|
{ KE_END, 0 }
|
2009-12-10 21:18:13 +08:00
|
|
|
};
|
2012-12-16 01:31:35 +08:00
|
|
|
|
|
|
|
static ktime_t last_pressed;
|
2009-12-10 21:18:13 +08:00
|
|
|
|
2012-12-16 01:31:36 +08:00
|
|
|
static const struct {
|
|
|
|
const char *guid;
|
|
|
|
bool quirk_last_pressed;
|
|
|
|
} *event_wmi, event_wmis[] = {
|
|
|
|
{ MSIWMI_MSI_EVENT_GUID, true },
|
|
|
|
{ MSIWMI_WIND_EVENT_GUID, false },
|
|
|
|
};
|
2012-12-16 01:31:34 +08:00
|
|
|
|
2010-07-08 09:50:30 +08:00
|
|
|
static struct backlight_device *backlight;
|
2009-12-10 21:18:13 +08:00
|
|
|
|
|
|
|
static int backlight_map[] = { 0x00, 0x33, 0x66, 0x99, 0xCC, 0xFF };
|
|
|
|
|
|
|
|
static struct input_dev *msi_wmi_input_dev;
|
|
|
|
|
|
|
|
static int msi_wmi_query_block(int instance, int *ret)
|
|
|
|
{
|
|
|
|
acpi_status status;
|
|
|
|
union acpi_object *obj;
|
|
|
|
|
|
|
|
struct acpi_buffer output = { ACPI_ALLOCATE_BUFFER, NULL };
|
|
|
|
|
|
|
|
status = wmi_query_block(MSIWMI_BIOS_GUID, instance, &output);
|
|
|
|
|
|
|
|
obj = output.pointer;
|
|
|
|
|
|
|
|
if (!obj || obj->type != ACPI_TYPE_INTEGER) {
|
|
|
|
if (obj) {
|
2011-03-30 06:21:47 +08:00
|
|
|
pr_err("query block returned object "
|
2009-12-10 21:18:13 +08:00
|
|
|
"type: %d - buffer length:%d\n", obj->type,
|
|
|
|
obj->type == ACPI_TYPE_BUFFER ?
|
|
|
|
obj->buffer.length : 0);
|
|
|
|
}
|
|
|
|
kfree(obj);
|
|
|
|
return -EINVAL;
|
|
|
|
}
|
|
|
|
*ret = obj->integer.value;
|
|
|
|
kfree(obj);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int msi_wmi_set_block(int instance, int value)
|
|
|
|
{
|
|
|
|
acpi_status status;
|
|
|
|
|
|
|
|
struct acpi_buffer input = { sizeof(int), &value };
|
|
|
|
|
2011-03-30 06:21:47 +08:00
|
|
|
pr_debug("Going to set block of instance: %d - value: %d\n",
|
|
|
|
instance, value);
|
2009-12-10 21:18:13 +08:00
|
|
|
|
|
|
|
status = wmi_set_block(MSIWMI_BIOS_GUID, instance, &input);
|
|
|
|
|
|
|
|
return ACPI_SUCCESS(status) ? 0 : 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int bl_get(struct backlight_device *bd)
|
|
|
|
{
|
2009-12-14 17:21:39 +08:00
|
|
|
int level, err, ret;
|
2009-12-10 21:18:13 +08:00
|
|
|
|
|
|
|
/* Instance 1 is "get backlight", cmp with DSDT */
|
|
|
|
err = msi_wmi_query_block(1, &ret);
|
2009-12-14 17:21:39 +08:00
|
|
|
if (err) {
|
2011-03-30 06:21:47 +08:00
|
|
|
pr_err("Could not query backlight: %d\n", err);
|
2009-12-14 17:21:39 +08:00
|
|
|
return -EINVAL;
|
|
|
|
}
|
2011-03-30 06:21:47 +08:00
|
|
|
pr_debug("Get: Query block returned: %d\n", ret);
|
2009-12-10 21:18:13 +08:00
|
|
|
for (level = 0; level < ARRAY_SIZE(backlight_map); level++) {
|
|
|
|
if (backlight_map[level] == ret) {
|
2011-03-30 06:21:47 +08:00
|
|
|
pr_debug("Current backlight level: 0x%X - index: %d\n",
|
|
|
|
backlight_map[level], level);
|
2009-12-10 21:18:13 +08:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (level == ARRAY_SIZE(backlight_map)) {
|
2011-03-30 06:21:47 +08:00
|
|
|
pr_err("get: Invalid brightness value: 0x%X\n", ret);
|
2009-12-10 21:18:13 +08:00
|
|
|
return -EINVAL;
|
|
|
|
}
|
|
|
|
return level;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int bl_set_status(struct backlight_device *bd)
|
|
|
|
{
|
|
|
|
int bright = bd->props.brightness;
|
|
|
|
if (bright >= ARRAY_SIZE(backlight_map) || bright < 0)
|
|
|
|
return -EINVAL;
|
|
|
|
|
|
|
|
/* Instance 0 is "set backlight" */
|
|
|
|
return msi_wmi_set_block(0, backlight_map[bright]);
|
|
|
|
}
|
|
|
|
|
2010-02-26 20:17:16 +08:00
|
|
|
static const struct backlight_ops msi_backlight_ops = {
|
2009-12-10 21:18:13 +08:00
|
|
|
.get_brightness = bl_get,
|
|
|
|
.update_status = bl_set_status,
|
|
|
|
};
|
|
|
|
|
|
|
|
static void msi_wmi_notify(u32 value, void *context)
|
|
|
|
{
|
|
|
|
struct acpi_buffer response = { ACPI_ALLOCATE_BUFFER, NULL };
|
2017-07-19 05:49:37 +08:00
|
|
|
struct key_entry *key;
|
2009-12-10 21:18:13 +08:00
|
|
|
union acpi_object *obj;
|
2009-12-27 12:02:24 +08:00
|
|
|
acpi_status status;
|
2009-12-10 21:18:13 +08:00
|
|
|
|
2009-12-27 12:02:24 +08:00
|
|
|
status = wmi_get_event_data(value, &response);
|
|
|
|
if (status != AE_OK) {
|
2011-03-30 06:21:47 +08:00
|
|
|
pr_info("bad event status 0x%x\n", status);
|
2009-12-27 12:02:24 +08:00
|
|
|
return;
|
|
|
|
}
|
2009-12-10 21:18:13 +08:00
|
|
|
|
|
|
|
obj = (union acpi_object *)response.pointer;
|
|
|
|
|
|
|
|
if (obj && obj->type == ACPI_TYPE_INTEGER) {
|
|
|
|
int eventcode = obj->integer.value;
|
2011-03-30 06:21:47 +08:00
|
|
|
pr_debug("Eventcode: 0x%x\n", eventcode);
|
2009-12-10 21:18:19 +08:00
|
|
|
key = sparse_keymap_entry_from_scancode(msi_wmi_input_dev,
|
|
|
|
eventcode);
|
2012-12-16 01:31:35 +08:00
|
|
|
if (!key) {
|
|
|
|
pr_info("Unknown key pressed - %x\n", eventcode);
|
|
|
|
goto msi_wmi_notify_exit;
|
|
|
|
}
|
|
|
|
|
2012-12-16 01:31:36 +08:00
|
|
|
if (event_wmi->quirk_last_pressed) {
|
2012-12-16 01:31:35 +08:00
|
|
|
ktime_t cur = ktime_get_real();
|
|
|
|
ktime_t diff = ktime_sub(cur, last_pressed);
|
|
|
|
/* Ignore event if any event happened in a 50 ms
|
2009-12-10 21:18:13 +08:00
|
|
|
timeframe -> Key press may result in 10-20 GPEs */
|
2009-12-10 21:18:19 +08:00
|
|
|
if (ktime_to_us(diff) < 1000 * 50) {
|
2011-03-30 06:21:47 +08:00
|
|
|
pr_debug("Suppressed key event 0x%X - "
|
|
|
|
"Last press was %lld us ago\n",
|
2009-12-10 21:18:19 +08:00
|
|
|
key->code, ktime_to_us(diff));
|
2012-12-16 01:31:31 +08:00
|
|
|
goto msi_wmi_notify_exit;
|
2009-12-10 21:18:13 +08:00
|
|
|
}
|
2012-12-16 01:31:35 +08:00
|
|
|
last_pressed = cur;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (key->type == KE_KEY &&
|
|
|
|
/* Brightness is served via acpi video driver */
|
|
|
|
(backlight ||
|
|
|
|
(key->code != MSI_KEY_BRIGHTNESSUP &&
|
|
|
|
key->code != MSI_KEY_BRIGHTNESSDOWN))) {
|
|
|
|
pr_debug("Send key: 0x%X - Input layer keycode: %d\n",
|
|
|
|
key->code, key->keycode);
|
|
|
|
sparse_keymap_report_entry(msi_wmi_input_dev, key, 1,
|
|
|
|
true);
|
|
|
|
}
|
2009-12-10 21:18:13 +08:00
|
|
|
} else
|
2011-03-30 06:21:47 +08:00
|
|
|
pr_info("Unknown event received\n");
|
2012-12-16 01:31:31 +08:00
|
|
|
|
|
|
|
msi_wmi_notify_exit:
|
2009-12-10 21:18:13 +08:00
|
|
|
kfree(response.pointer);
|
|
|
|
}
|
|
|
|
|
2012-12-16 01:31:34 +08:00
|
|
|
static int __init msi_wmi_backlight_setup(void)
|
|
|
|
{
|
|
|
|
int err;
|
|
|
|
struct backlight_properties props;
|
|
|
|
|
|
|
|
memset(&props, 0, sizeof(struct backlight_properties));
|
|
|
|
props.type = BACKLIGHT_PLATFORM;
|
|
|
|
props.max_brightness = ARRAY_SIZE(backlight_map) - 1;
|
|
|
|
backlight = backlight_device_register(DRV_NAME, NULL, NULL,
|
|
|
|
&msi_backlight_ops,
|
|
|
|
&props);
|
|
|
|
if (IS_ERR(backlight))
|
|
|
|
return PTR_ERR(backlight);
|
|
|
|
|
|
|
|
err = bl_get(NULL);
|
|
|
|
if (err < 0) {
|
|
|
|
backlight_device_unregister(backlight);
|
|
|
|
return err;
|
|
|
|
}
|
|
|
|
|
|
|
|
backlight->props.brightness = err;
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2009-12-10 21:18:13 +08:00
|
|
|
static int __init msi_wmi_input_setup(void)
|
|
|
|
{
|
|
|
|
int err;
|
|
|
|
|
|
|
|
msi_wmi_input_dev = input_allocate_device();
|
2009-12-10 21:18:15 +08:00
|
|
|
if (!msi_wmi_input_dev)
|
|
|
|
return -ENOMEM;
|
2009-12-10 21:18:13 +08:00
|
|
|
|
|
|
|
msi_wmi_input_dev->name = "MSI WMI hotkeys";
|
|
|
|
msi_wmi_input_dev->phys = "wmi/input0";
|
|
|
|
msi_wmi_input_dev->id.bustype = BUS_HOST;
|
2009-12-10 21:18:19 +08:00
|
|
|
|
|
|
|
err = sparse_keymap_setup(msi_wmi_input_dev, msi_wmi_keymap, NULL);
|
|
|
|
if (err)
|
|
|
|
goto err_free_dev;
|
2009-12-10 21:18:13 +08:00
|
|
|
|
|
|
|
err = input_register_device(msi_wmi_input_dev);
|
|
|
|
|
2009-12-10 21:18:19 +08:00
|
|
|
if (err)
|
2017-03-09 20:11:46 +08:00
|
|
|
goto err_free_dev;
|
2009-12-10 21:18:19 +08:00
|
|
|
|
2016-12-25 19:30:41 +08:00
|
|
|
last_pressed = 0;
|
2009-12-10 21:18:13 +08:00
|
|
|
|
|
|
|
return 0;
|
2009-12-10 21:18:19 +08:00
|
|
|
|
|
|
|
err_free_dev:
|
|
|
|
input_free_device(msi_wmi_input_dev);
|
|
|
|
return err;
|
2009-12-10 21:18:13 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static int __init msi_wmi_init(void)
|
|
|
|
{
|
|
|
|
int err;
|
2012-12-16 01:31:36 +08:00
|
|
|
int i;
|
|
|
|
|
|
|
|
for (i = 0; i < ARRAY_SIZE(event_wmis); i++) {
|
|
|
|
if (!wmi_has_guid(event_wmis[i].guid))
|
|
|
|
continue;
|
2009-12-10 21:18:13 +08:00
|
|
|
|
2012-12-16 01:31:34 +08:00
|
|
|
err = msi_wmi_input_setup();
|
|
|
|
if (err) {
|
|
|
|
pr_err("Unable to setup input device\n");
|
|
|
|
return err;
|
|
|
|
}
|
2009-12-10 21:18:13 +08:00
|
|
|
|
2012-12-16 01:31:36 +08:00
|
|
|
err = wmi_install_notify_handler(event_wmis[i].guid,
|
2012-12-16 01:31:34 +08:00
|
|
|
msi_wmi_notify, NULL);
|
|
|
|
if (ACPI_FAILURE(err)) {
|
|
|
|
pr_err("Unable to setup WMI notify handler\n");
|
2009-12-10 21:18:15 +08:00
|
|
|
goto err_free_input;
|
2010-02-26 20:17:16 +08:00
|
|
|
}
|
2009-12-10 21:18:15 +08:00
|
|
|
|
2012-12-16 01:31:34 +08:00
|
|
|
pr_debug("Event handler installed\n");
|
2012-12-16 01:31:36 +08:00
|
|
|
event_wmi = &event_wmis[i];
|
|
|
|
break;
|
2012-12-16 01:31:34 +08:00
|
|
|
}
|
|
|
|
|
2015-06-16 22:28:07 +08:00
|
|
|
if (wmi_has_guid(MSIWMI_BIOS_GUID) &&
|
|
|
|
acpi_video_get_backlight_type() == acpi_backlight_vendor) {
|
2012-12-16 01:31:34 +08:00
|
|
|
err = msi_wmi_backlight_setup();
|
|
|
|
if (err) {
|
|
|
|
pr_err("Unable to setup backlight device\n");
|
|
|
|
goto err_uninstall_handler;
|
|
|
|
}
|
|
|
|
pr_debug("Backlight device created\n");
|
|
|
|
}
|
2009-12-10 21:18:15 +08:00
|
|
|
|
2012-12-16 01:31:36 +08:00
|
|
|
if (!event_wmi && !backlight) {
|
2012-12-16 01:31:34 +08:00
|
|
|
pr_err("This machine doesn't have neither MSI-hotkeys nor backlight through WMI\n");
|
|
|
|
return -ENODEV;
|
2009-12-10 21:18:13 +08:00
|
|
|
}
|
2009-12-10 21:18:15 +08:00
|
|
|
|
2009-12-10 21:18:13 +08:00
|
|
|
return 0;
|
2009-12-10 21:18:15 +08:00
|
|
|
|
2012-12-16 01:31:34 +08:00
|
|
|
err_uninstall_handler:
|
2012-12-16 01:31:36 +08:00
|
|
|
if (event_wmi)
|
|
|
|
wmi_remove_notify_handler(event_wmi->guid);
|
2009-12-10 21:18:15 +08:00
|
|
|
err_free_input:
|
2017-03-09 20:11:46 +08:00
|
|
|
if (event_wmi)
|
2012-12-16 01:31:34 +08:00
|
|
|
input_unregister_device(msi_wmi_input_dev);
|
2009-12-10 21:18:15 +08:00
|
|
|
return err;
|
2009-12-10 21:18:13 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void __exit msi_wmi_exit(void)
|
|
|
|
{
|
2012-12-16 01:31:36 +08:00
|
|
|
if (event_wmi) {
|
|
|
|
wmi_remove_notify_handler(event_wmi->guid);
|
2009-12-10 21:18:13 +08:00
|
|
|
input_unregister_device(msi_wmi_input_dev);
|
|
|
|
}
|
2014-11-25 03:30:29 +08:00
|
|
|
backlight_device_unregister(backlight);
|
2009-12-10 21:18:13 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
module_init(msi_wmi_init);
|
|
|
|
module_exit(msi_wmi_exit);
|