From patchwork Thu May 21 17:44:31 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Gerecke, Jason" X-Patchwork-Id: 6457881 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.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 24968C0020 for ; Thu, 21 May 2015 17:45:04 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 3712B20523 for ; Thu, 21 May 2015 17:45:03 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 3201220522 for ; Thu, 21 May 2015 17:45:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755772AbbEURpB (ORCPT ); Thu, 21 May 2015 13:45:01 -0400 Received: from mail-pa0-f52.google.com ([209.85.220.52]:35169 "EHLO mail-pa0-f52.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755835AbbEURpA (ORCPT ); Thu, 21 May 2015 13:45:00 -0400 Received: by pacwv17 with SMTP id wv17so112473571pac.2 for ; Thu, 21 May 2015 10:45:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=R0//dLthVSq3SX8pv3qRf/KxjPsoLrrJVbXzx5ZEXOQ=; b=X9us2Ac4qW1SjykYneoSBWo/NrgTvhyFT1cfbUVSh7UDuPDstkaH9rVGARTnND1MKF z7SshF9OprhcC8Ybn417/sB7k0tjxT90hEKWEFhzX40puhSqHjQXNOyyzU1LGea1mHwk dcBo8AuyKK0sG7PQlTZ4SRc+Cf574bp7HKXTvWrBrCS5Uczh6VRzmw9R24+B7jg0rlZu +0pdloi4dOU2N2vSlh1jC1GvuHJBTPPDxboOsOykfQrHOz6RSZ3Y4NcvwBFKku5uj+RA 54Gn32d0OWnAMM19ibZllDLjd5saBpylRSpktbwwntB+VyYrS2V/PaVtr6xfA3RIlwI6 WIpQ== X-Received: by 10.68.218.9 with SMTP id pc9mr7757163pbc.2.1432230300013; Thu, 21 May 2015 10:45:00 -0700 (PDT) Received: from wacom-arch2.localdomain ([67.51.163.2]) by mx.google.com with ESMTPSA id da3sm19881738pdb.8.2015.05.21.10.44.57 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 21 May 2015 10:44:58 -0700 (PDT) From: Jason Gerecke To: Jiri Kosina , Benjamin Tissoires , Ping Cheng , Aaron Skomra Cc: linux-input@vger.kernel.org, Jason Gerecke , Jason Gerecke Subject: [PATCH v2 1/2] HID: wacom: Have wacom_{get, set}_report retry on -EAGAIN, not -EPIPE Date: Thu, 21 May 2015 10:44:31 -0700 Message-Id: <1432230272-3614-1-git-send-email-killertofu@gmail.com> X-Mailer: git-send-email 2.4.1 In-Reply-To: <1431120302-13691-1-git-send-email-killertofu@gmail.com> References: <1431120302-13691-1-git-send-email-killertofu@gmail.com> 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 Retrying on -EPIPE makes very little sense since this typically indicates a problem that will not just disappear on its own. For instance, the USB documentation states that it will be sent if the endpoint is stalled or the device has disconnected. Instead, we should retry if -EAGAIN is received since this indicates a temporary error condition such as a busy bus. In addition to adjusting the conditions we retry under, we also log an error on failure so that we can be aware of what's going on. Signed-off-by: Jason Gerecke Reviewed-by: Benjamin Tissoires --- Changed in v2: - Renamed from "HID: wacom: Allow wacom_{get,set}_report to retry on -EAGAIN" - Changed retry conditions so that we no longer retry on -EPIPE - Use 'hid_err' instead of 'dev_err' drivers/hid/wacom_sys.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/drivers/hid/wacom_sys.c b/drivers/hid/wacom_sys.c index 7abf52c..109312f 100644 --- a/drivers/hid/wacom_sys.c +++ b/drivers/hid/wacom_sys.c @@ -35,7 +35,11 @@ static int wacom_get_report(struct hid_device *hdev, u8 type, u8 *buf, do { retval = hid_hw_raw_request(hdev, buf[0], buf, size, type, HID_REQ_GET_REPORT); - } while ((retval == -ETIMEDOUT || retval == -EPIPE) && --retries); + } while ((retval == -ETIMEDOUT || retval == -EAGAIN) && --retries); + + if (retval < 0) + hid_err(hdev, "wacom_get_report: ran out of retries " + "(last error = %d)\n", retval); return retval; } @@ -48,7 +52,11 @@ static int wacom_set_report(struct hid_device *hdev, u8 type, u8 *buf, do { retval = hid_hw_raw_request(hdev, buf[0], buf, size, type, HID_REQ_SET_REPORT); - } while ((retval == -ETIMEDOUT || retval == -EPIPE) && --retries); + } while ((retval == -ETIMEDOUT || retval == -EAGAIN) && --retries); + + if (retval < 0) + hid_err(hdev, "wacom_set_report: ran out of retries " + "(last error = %d)\n", retval); return retval; }