diff options
author | Benjamin Tissoires <benjamin.tissoires@redhat.com> | 2014-07-24 16:16:17 -0400 |
---|---|---|
committer | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2014-07-25 21:55:52 -0400 |
commit | c757cbafd6afe8e47d12320aa05edcd1b1d97186 (patch) | |
tree | ee5f29d13f2d0d4c9a2c787c3af446e1dbc2902d | |
parent | 0b335cad73c800717856f8f5a5509d367c38b61d (diff) |
Input: wacom - put a flag when the led are initialized
This solves a bug with the wireless receiver:
- at plug, the wireless receiver does not know which Wacom device it is
connected to, so it does not actually creates all the LEDs
- when the tablet connects, wacom->wacom_wac.features.type is set to the
proper device so that wacom_wac can understand the packets
- when the receiver is unplugged, it detects that a LED should have been
created (based on wacom->wacom_wac.features.type) and tries to remove
it: crash when removing the sysfs group.
Side effect, we can now safely call several times wacom_destroy_leds().
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Acked-by: Ping Cheng <pingc@wacom.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
-rw-r--r-- | drivers/hid/wacom.h | 1 | ||||
-rw-r--r-- | drivers/hid/wacom_sys.c | 6 |
2 files changed, 7 insertions, 0 deletions
diff --git a/drivers/hid/wacom.h b/drivers/hid/wacom.h index dd67b7da8a97..a678f827e39e 100644 --- a/drivers/hid/wacom.h +++ b/drivers/hid/wacom.h | |||
@@ -118,6 +118,7 @@ struct wacom { | |||
118 | u8 hlv; /* status led brightness button pressed (1..127) */ | 118 | u8 hlv; /* status led brightness button pressed (1..127) */ |
119 | u8 img_lum; /* OLED matrix display brightness */ | 119 | u8 img_lum; /* OLED matrix display brightness */ |
120 | } led; | 120 | } led; |
121 | bool led_initialized; | ||
121 | struct power_supply battery; | 122 | struct power_supply battery; |
122 | }; | 123 | }; |
123 | 124 | ||
diff --git a/drivers/hid/wacom_sys.c b/drivers/hid/wacom_sys.c index 06e304b3bbfd..f1c6d3dae248 100644 --- a/drivers/hid/wacom_sys.c +++ b/drivers/hid/wacom_sys.c | |||
@@ -729,12 +729,18 @@ static int wacom_initialize_leds(struct wacom *wacom) | |||
729 | return error; | 729 | return error; |
730 | } | 730 | } |
731 | wacom_led_control(wacom); | 731 | wacom_led_control(wacom); |
732 | wacom->led_initialized = true; | ||
732 | 733 | ||
733 | return 0; | 734 | return 0; |
734 | } | 735 | } |
735 | 736 | ||
736 | static void wacom_destroy_leds(struct wacom *wacom) | 737 | static void wacom_destroy_leds(struct wacom *wacom) |
737 | { | 738 | { |
739 | if (!wacom->led_initialized) | ||
740 | return; | ||
741 | |||
742 | wacom->led_initialized = false; | ||
743 | |||
738 | switch (wacom->wacom_wac.features.type) { | 744 | switch (wacom->wacom_wac.features.type) { |
739 | case INTUOS4S: | 745 | case INTUOS4S: |
740 | case INTUOS4: | 746 | case INTUOS4: |