From patchwork Fri Nov 7 01:30:51 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ping Cheng X-Patchwork-Id: 5249181 X-Patchwork-Delegate: jikos@jikos.cz Return-Path: X-Original-To: patchwork-linux-input@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 0D1159F2F1 for ; Fri, 7 Nov 2014 01:31:16 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 27C8820125 for ; Fri, 7 Nov 2014 01:31:15 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 2771120122 for ; Fri, 7 Nov 2014 01:31:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751115AbaKGBbN (ORCPT ); Thu, 6 Nov 2014 20:31:13 -0500 Received: from mail-pa0-f52.google.com ([209.85.220.52]:49234 "EHLO mail-pa0-f52.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750926AbaKGBbM (ORCPT ); Thu, 6 Nov 2014 20:31:12 -0500 Received: by mail-pa0-f52.google.com with SMTP id fa1so2438056pad.39 for ; Thu, 06 Nov 2014 17:31:12 -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=PsU5is9QHeEcy903z1edNeHZDQv9UfflCOfcqSNUxHM=; b=c8x92Q9p9xL9kqSlucZs3N1qJtjt7VrfWbGOHpH8dV60Y5h2+o8j0hr/GOWaJGkDXp vXWTMDxjXT6iCXgs/YvfckzIm/JBWSvOWOK33TPsr0o3ixf9UeuI9OQAypk8mJC7uuH9 dO8yWRrUY20tbvnQgi3lxfJEW8DVhh2XJuZ/MwTwWVZK2kNgYU7XMMB/fc2gX6qt6lsv 2sBkN1No9W+fG/5LjemjN6892L5FdQtFQHfPNMkPEhQCkiuiwMMY6WL/PzNxuZLYn21t MPv5NzjpQjU0Yp2JAyzTF7Cuun8dAv5dqRvgJTbGQIFyOR9/d/C5mCJHOqznR8HrGwpk vb7w== X-Received: by 10.68.68.240 with SMTP id z16mr8538123pbt.70.1415323872294; Thu, 06 Nov 2014 17:31:12 -0800 (PST) Received: from wacom-XPS-8500.wacom.com ([67.51.163.2]) by mx.google.com with ESMTPSA id ol3sm7059953pbb.17.2014.11.06.17.31.10 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 06 Nov 2014 17:31:11 -0800 (PST) From: Ping Cheng X-Google-Original-From: Ping Cheng To: jkosina@suse.cz Cc: dmitry.torokhov@gmail.com, linux-input@vger.kernel.org, Ping Cheng Subject: [PATCH] HID: wacom - make sure touch_input is valid before using it Date: Thu, 6 Nov 2014 17:30:51 -0800 Message-Id: <1415323851-16453-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=-7.4 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID, 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 touch_input is stored in wacom_shared for pen data to report touch switch status. It is possible, although we didn't see it happen on Linux yet, that pen data is procesed before touch interface is fully probed. As a by-product of this patch, it fixes the FreeBSD issue reported by Denis Akiyakov http://www.spinics.net/lists/linux-input/msg33971.html Reviewed-by: Hans Petter Selasky Tested-by: Denis Akiyakov Signed-off-by: Ping Cheng --- drivers/hid/wacom_wac.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/hid/wacom_wac.c b/drivers/hid/wacom_wac.c index 8ce7fab..1048295 100644 --- a/drivers/hid/wacom_wac.c +++ b/drivers/hid/wacom_wac.c @@ -1681,7 +1681,9 @@ static int wacom_bpt_pen(struct wacom_wac *wacom) return 0; if (data[0] == WACOM_REPORT_USB) { - if (features->type == INTUOSHT && features->touch_max) { + if (features->type == INTUOSHT && + wacom->shared->touch_input && + features->touch_max) { input_report_switch(wacom->shared->touch_input, SW_MUTE_DEVICE, data[8] & 0x40); input_sync(wacom->shared->touch_input); @@ -1774,7 +1776,8 @@ static int wacom_wireless_irq(struct wacom_wac *wacom, size_t len) int pid, battery, ps_connected; if ((wacom->shared->type == INTUOSHT) && - wacom->shared->touch_max) { + wacom->shared->touch_input && + wacom->shared->touch_max) { input_report_switch(wacom->shared->touch_input, SW_MUTE_DEVICE, data[5] & 0x40); input_sync(wacom->shared->touch_input);