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>
This commit is contained in:
parent
0b335cad73
commit
c757cbafd6
2 changed files with 7 additions and 0 deletions
|
@ -118,6 +118,7 @@ struct wacom {
|
||||||
u8 hlv; /* status led brightness button pressed (1..127) */
|
u8 hlv; /* status led brightness button pressed (1..127) */
|
||||||
u8 img_lum; /* OLED matrix display brightness */
|
u8 img_lum; /* OLED matrix display brightness */
|
||||||
} led;
|
} led;
|
||||||
|
bool led_initialized;
|
||||||
struct power_supply battery;
|
struct power_supply battery;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -729,12 +729,18 @@ static int wacom_initialize_leds(struct wacom *wacom)
|
||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
wacom_led_control(wacom);
|
wacom_led_control(wacom);
|
||||||
|
wacom->led_initialized = true;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void wacom_destroy_leds(struct wacom *wacom)
|
static void wacom_destroy_leds(struct wacom *wacom)
|
||||||
{
|
{
|
||||||
|
if (!wacom->led_initialized)
|
||||||
|
return;
|
||||||
|
|
||||||
|
wacom->led_initialized = false;
|
||||||
|
|
||||||
switch (wacom->wacom_wac.features.type) {
|
switch (wacom->wacom_wac.features.type) {
|
||||||
case INTUOS4S:
|
case INTUOS4S:
|
||||||
case INTUOS4:
|
case INTUOS4:
|
||||||
|
|
Loading…
Add table
Reference in a new issue