From patchwork Wed Jul 13 16:05:50 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Tissoires X-Patchwork-Id: 9227827 X-Patchwork-Delegate: jikos@jikos.cz Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id D77E360868 for ; Wed, 13 Jul 2016 16:06:59 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C94ED27F9E for ; Wed, 13 Jul 2016 16:06:59 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BD3EB27FA6; Wed, 13 Jul 2016 16:06:59 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5CD7427F9E for ; Wed, 13 Jul 2016 16:06:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751399AbcGMQGd (ORCPT ); Wed, 13 Jul 2016 12:06:33 -0400 Received: from mx1.redhat.com ([209.132.183.28]:51687 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750923AbcGMQGc (ORCPT ); Wed, 13 Jul 2016 12:06:32 -0400 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 15F2B33A885; Wed, 13 Jul 2016 16:06:27 +0000 (UTC) Received: from plouf.banquise.eu.com (ovpn-116-194.phx2.redhat.com [10.3.116.194]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u6DG6Jw8004508; Wed, 13 Jul 2016 12:06:25 -0400 From: Benjamin Tissoires To: Jiri Kosina , Ping Cheng , Jason Gerecke , Aaron Skomra , Peter Hutterer Cc: linux-kernel@vger.kernel.org, linux-input@vger.kernel.org Subject: [PATCH v2 03/30] HID: wacom: remove cleanup of wacom->remote_dir from wacom_clean_inputs() Date: Wed, 13 Jul 2016 18:05:50 +0200 Message-Id: <1468425977-4819-4-git-send-email-benjamin.tissoires@redhat.com> In-Reply-To: <1468425977-4819-1-git-send-email-benjamin.tissoires@redhat.com> References: <1468425977-4819-1-git-send-email-benjamin.tissoires@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.24 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Wed, 13 Jul 2016 16:06:27 +0000 (UTC) Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP wacom->remote_dir has nothing to do with inputs, so better not magically removing it when cleaning inputs. Signed-off-by: Benjamin Tissoires --- No changes in v2 --- drivers/hid/wacom_sys.c | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/drivers/hid/wacom_sys.c b/drivers/hid/wacom_sys.c index 9e283aa..5dd2640 100644 --- a/drivers/hid/wacom_sys.c +++ b/drivers/hid/wacom_sys.c @@ -1397,7 +1397,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; @@ -1480,16 +1479,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; @@ -1686,6 +1679,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) connect_mask |= HID_CONNECT_DRIVER; @@ -1705,7 +1704,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 */ @@ -1713,7 +1712,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) @@ -1728,10 +1727,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); @@ -1910,6 +1912,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);