wacom->remote_dir has nothing to do with inputs, so better not magically removing it when cleaning inputs.
Signed-off-by: Benjamin Tissoires <benjamin.tissoi...@redhat.com> Acked-by: Ping Cheng <pi...@wacom.com> Signed-off-by: Jiri Kosina <jkos...@suse.cz> [aaron.sko...@wacom.com: Imported into input-wacom repository (b62f646)] Signed-off-by: Aaron Armstrong Skomra <aaron.sko...@wacom.com> [aaron.sko...@wacom.com: Backported from input-wacom repository (c424d7c)] Signed-off-by: Aaron Armstrong Skomra <aaron.sko...@wacom.com> --- 2.6.38/wacom_sys.c | 14 +++++++------- 3.17/wacom_sys.c | 25 ++++++++++++++----------- 3.7/wacom_sys.c | 14 +++++++------- 3 files changed, 28 insertions(+), 25 deletions(-) diff --git a/2.6.38/wacom_sys.c b/2.6.38/wacom_sys.c index 5051811..10bd0fa 100644 --- a/2.6.38/wacom_sys.c +++ b/2.6.38/wacom_sys.c @@ -1413,7 +1413,6 @@ static void wacom_unregister_inputs(struct wacom *wacom) { if (wacom->wacom_wac.input) input_unregister_device(wacom->wacom_wac.input); - kobject_put(wacom->remote_dir); wacom->wacom_wac.input = NULL; wacom_destroy_leds(wacom); } @@ -1456,14 +1455,8 @@ static int wacom_register_input(struct wacom *wacom) if (error) goto fail3; - error = wacom_initialize_remote(wacom); - if (error) - goto fail_remote; - return 0; -fail_remote: - wacom_destroy_leds(wacom); fail3: input_unregister_device(input_dev); input_dev = NULL; @@ -1730,6 +1723,12 @@ static int wacom_probe(struct usb_interface *intf, const struct usb_device_id *i } } + if (wacom->wacom_wac.features.type == REMOTE) { + error = wacom_initialize_remote(wacom); + if (error) + goto fail4; + } + if ((wacom_wac->features.type == INTUOSHT || wacom_wac->features.type == INTUOSHT2) && wacom_wac->features.touch_max) { @@ -1757,6 +1756,7 @@ static void wacom_disconnect(struct usb_interface *intf) usb_kill_urb(wacom->irq); cancel_work_sync(&wacom->work); + kobject_put(wacom->remote_dir); wacom_unregister_inputs(wacom); wacom_destroy_battery(wacom); usb_free_urb(wacom->irq); diff --git a/3.17/wacom_sys.c b/3.17/wacom_sys.c index 2ad83f5..ca4b362 100644 --- a/3.17/wacom_sys.c +++ b/3.17/wacom_sys.c @@ -1431,7 +1431,6 @@ static void wacom_clean_inputs(struct wacom *wacom) else input_free_device(wacom->wacom_wac.pad_input); } - kobject_put(wacom->remote_dir); wacom->wacom_wac.pen_input = NULL; wacom->wacom_wac.touch_input = NULL; wacom->wacom_wac.pad_input = NULL; @@ -1514,16 +1513,10 @@ static int wacom_register_inputs(struct wacom *wacom) error = wacom_initialize_leds(wacom); if (error) goto fail_leds; - - error = wacom_initialize_remote(wacom); - if (error) - goto fail_remote; } return 0; -fail_remote: - wacom_destroy_leds(wacom); fail_leds: input_unregister_device(pad_input_dev); pad_input_dev = NULL; @@ -1724,6 +1717,12 @@ static int wacom_parse_and_register(struct wacom *wacom, bool wireless) if (error) goto fail_register_inputs; + if (wacom->wacom_wac.features.device_type & WACOM_DEVICETYPE_PAD) { + error = wacom_initialize_remote(wacom); + if (error) + goto fail_remote; + } + if (features->type == HID_GENERIC) #if LINUX_VERSION_CODE < KERNEL_VERSION(3,18,0) hdev->claimed |= 8; /* HID_CLAIMED_DRIVER */ @@ -1747,7 +1746,7 @@ static int wacom_parse_and_register(struct wacom *wacom, bool wireless) if ((features->type == BAMBOO_TOUCH) && (features->device_type & WACOM_DEVICETYPE_PEN)) { error = -ENODEV; - goto fail_hw_start; + goto fail_quirks; } /* pen only Bamboo neither support touch nor pad */ @@ -1755,7 +1754,7 @@ static int wacom_parse_and_register(struct wacom *wacom, bool wireless) ((features->device_type & WACOM_DEVICETYPE_TOUCH) || (features->device_type & WACOM_DEVICETYPE_PAD))) { error = -ENODEV; - goto fail_hw_start; + goto fail_quirks; } if (features->device_type & WACOM_DEVICETYPE_WL_MONITOR) @@ -1770,10 +1769,13 @@ static int wacom_parse_and_register(struct wacom *wacom, bool wireless) return 0; -fail_hw_start: +fail_quirks: hid_hw_stop(hdev); -fail_register_inputs: +fail_hw_start: + kobject_put(wacom->remote_dir); +fail_remote: wacom_clean_inputs(wacom); +fail_register_inputs: wacom_destroy_battery(wacom); fail_battery: wacom_remove_shared_data(wacom); @@ -1952,6 +1954,7 @@ static void wacom_remove(struct hid_device *hdev) hid_hw_stop(hdev); cancel_work_sync(&wacom->work); + kobject_put(wacom->remote_dir); wacom_clean_inputs(wacom); if (hdev->bus == BUS_BLUETOOTH) device_remove_file(&hdev->dev, &dev_attr_speed); diff --git a/3.7/wacom_sys.c b/3.7/wacom_sys.c index 102523d..a36a751 100644 --- a/3.7/wacom_sys.c +++ b/3.7/wacom_sys.c @@ -1407,7 +1407,6 @@ static void wacom_unregister_inputs(struct wacom *wacom) { if (wacom->wacom_wac.input) input_unregister_device(wacom->wacom_wac.input); - kobject_put(wacom->remote_dir); wacom->wacom_wac.input = NULL; wacom_destroy_leds(wacom); } @@ -1451,14 +1450,8 @@ static int wacom_register_input(struct wacom *wacom) if (error) goto fail3; - error = wacom_initialize_remote(wacom); - if (error) - goto fail_remote; - return 0; -fail_remote: - wacom_destroy_leds(wacom); fail3: input_unregister_device(input_dev); input_dev = NULL; @@ -1728,6 +1721,12 @@ static int wacom_probe(struct usb_interface *intf, const struct usb_device_id *i } } + if (wacom->wacom_wac.features.type == REMOTE) { + error = wacom_initialize_remote(wacom); + if (error) + goto fail4; + } + if ((wacom_wac->features.type == INTUOSHT || wacom_wac->features.type == INTUOSHT2) && wacom_wac->features.touch_max) { @@ -1755,6 +1754,7 @@ static void wacom_disconnect(struct usb_interface *intf) usb_kill_urb(wacom->irq); cancel_work_sync(&wacom->work); + kobject_put(wacom->remote_dir); wacom_unregister_inputs(wacom); wacom_destroy_battery(wacom); usb_free_urb(wacom->irq); -- 2.7.4 ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, SlashDot.org! http://sdm.link/slashdot _______________________________________________ Linuxwacom-devel mailing list Linuxwacom-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel