From patchwork Fri Nov 21 00:31:12 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ping Cheng X-Patchwork-Id: 5351511 X-Patchwork-Delegate: jikos@jikos.cz Return-Path: X-Original-To: patchwork-linux-input@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 6E430C11AC for ; Fri, 21 Nov 2014 00:31:25 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 9B1A4201ED for ; Fri, 21 Nov 2014 00:31:24 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id C09A0201E4 for ; Fri, 21 Nov 2014 00:31:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756976AbaKUAbX (ORCPT ); Thu, 20 Nov 2014 19:31:23 -0500 Received: from mail-pa0-f46.google.com ([209.85.220.46]:56234 "EHLO mail-pa0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756223AbaKUAbW (ORCPT ); Thu, 20 Nov 2014 19:31:22 -0500 Received: by mail-pa0-f46.google.com with SMTP id lj1so3615494pab.19 for ; Thu, 20 Nov 2014 16:31:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=iLwxZGJ9IhBeJIJNcj0AxA5yVTdRH1yp6vR8JZYJVTM=; b=YMI4EcNMw5j3d3KUHIchfQkj043KNaF3m0HC34Ppe8mkTgnzP5Fme8uCoY135PSNzI MU8y/k3MoxMZ9W9pQ1FIlRnoka/EG2vHZF7PyyUnWwl6M91ypWRM/+avWsrF5vwhgznl J9wHhGDQCLdgmj/EclrCYbdob5NQMezc049CqQSB9kBbXzHnjFKSsbCspggqYu0H3UYN dl+oMFzAmrVRovYtwKWbiuWszAIqZRsYpis/uVt0oBJaWp5gv1S8gDzkz3u/q1xtwUly UbgvkotFM5VXuolBob/9hKXb/CuxLdl7T6FfmCP/P/j3nWpRjnNKMs0M+roLAStiHTtJ 7ulw== X-Received: by 10.70.31.2 with SMTP id w2mr1892263pdh.128.1416529882003; Thu, 20 Nov 2014 16:31:22 -0800 (PST) Received: from wacom-XPS-8500.wacom.com ([67.51.163.2]) by mx.google.com with ESMTPSA id v5sm766614pdn.20.2014.11.20.16.31.20 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 20 Nov 2014 16:31:21 -0800 (PST) From: Ping Cheng X-Google-Original-From: Ping Cheng To: jkosina@suse.cz Cc: linux-input@vger.kernel.org, benjamin.tissoires@gmail.com, Ping Cheng Subject: [PATCH] HID: wacom - PAD is independent with pen/touch Date: Thu, 20 Nov 2014 16:31:12 -0800 Message-Id: <1416529872-3128-1-git-send-email-pingc@wacom.com> X-Mailer: git-send-email 1.9.1 Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP PAD can be on pen interface (Intuos Pro and Cintiq series) or touch interface (Bamboo PT and Intuos PT series) or its own interface (Bamboo pen-only and Intuos Pen M/S). We need to mark it independently. Signed-off-by: Ping Cheng Reviewed-by: Benjamin Tissoires --- drivers/hid/wacom_sys.c | 8 +++++--- drivers/hid/wacom_wac.h | 1 + 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/drivers/hid/wacom_sys.c b/drivers/hid/wacom_sys.c index 68b6cd6..eb55316 100644 --- a/drivers/hid/wacom_sys.c +++ b/drivers/hid/wacom_sys.c @@ -1135,7 +1135,7 @@ static void wacom_clean_inputs(struct wacom *wacom) input_free_device(wacom->wacom_wac.input); } if (wacom->wacom_wac.pad_input) { - if (wacom->wacom_wac.input_registered) + if (wacom->wacom_wac.pad_registered) input_unregister_device(wacom->wacom_wac.pad_input); else input_free_device(wacom->wacom_wac.pad_input); @@ -1162,6 +1162,7 @@ static int wacom_register_inputs(struct wacom *wacom) error = input_register_device(input_dev); if (error) return error; + wacom_wac->input_registered = true; } error = wacom_setup_pad_input_capabilities(pad_input_dev, wacom_wac); @@ -1174,22 +1175,23 @@ static int wacom_register_inputs(struct wacom *wacom) error = input_register_device(pad_input_dev); if (error) goto fail_register_pad_input; + wacom_wac->pad_registered = true; error = wacom_initialize_leds(wacom); if (error) goto fail_leds; } - wacom_wac->input_registered = true; - return 0; fail_leds: input_unregister_device(pad_input_dev); pad_input_dev = NULL; + wacom_wac->pad_registered = false; fail_register_pad_input: input_unregister_device(input_dev); wacom_wac->input = NULL; + wacom_wac->input_registered = false; return error; } diff --git a/drivers/hid/wacom_wac.h b/drivers/hid/wacom_wac.h index 0f0b85e..128cbb3 100644 --- a/drivers/hid/wacom_wac.h +++ b/drivers/hid/wacom_wac.h @@ -183,6 +183,7 @@ struct wacom_wac { struct input_dev *input; struct input_dev *pad_input; bool input_registered; + bool pad_registered; int pid; int battery_capacity; int num_contacts_left;