From patchwork Sun Aug 12 21:42:35 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Henrik Rydberg X-Patchwork-Id: 1310351 X-Patchwork-Delegate: jikos@jikos.cz Return-Path: X-Original-To: patchwork-linux-input@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id 6325EDF280 for ; Sun, 12 Aug 2012 21:43:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752576Ab2HLVkm (ORCPT ); Sun, 12 Aug 2012 17:40:42 -0400 Received: from smtprelay-b21.telenor.se ([195.54.99.212]:57866 "EHLO smtprelay-b21.telenor.se" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752685Ab2HLVkM (ORCPT ); Sun, 12 Aug 2012 17:40:12 -0400 Received: from ipb4.telenor.se (ipb4.telenor.se [195.54.127.167]) by smtprelay-b21.telenor.se (Postfix) with ESMTP id 5E7F9EBF0A; Sun, 12 Aug 2012 23:40:11 +0200 (CEST) X-SENDER-IP: [85.230.170.20] X-LISTENER: [smtp.bredband.net] X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AjdTALghKFBV5qoUPGdsb2JhbABEhRgiAYUArz8ZAQEBATc0giEBBScvEwEPEAhJOQoUBgESiBG2OhSLB4YoA5s2jQaBVA X-IronPort-AV: E=Sophos;i="4.77,756,1336341600"; d="scan'208";a="95328138" Received: from c-14aae655.710-13-64736c12.cust.bredbandsbolaget.se (HELO polaris) ([85.230.170.20]) by ipb4.telenor.se with SMTP; 12 Aug 2012 23:40:09 +0200 Received: by polaris (sSMTP sendmail emulation); Sun, 12 Aug 2012 23:43:53 +0200 From: "Henrik Rydberg" To: Dmitry Torokhov , Jiri Kosina Cc: linux-input@vger.kernel.org, linux-kernel@vger.kernel.org, Henrik Rydberg Subject: [PATCH 17/19] HID: Only dump input if someone is listening Date: Sun, 12 Aug 2012 23:42:35 +0200 Message-Id: <1344807757-2217-18-git-send-email-rydberg@euromail.se> X-Mailer: git-send-email 1.7.11.4 In-Reply-To: <1344807757-2217-1-git-send-email-rydberg@euromail.se> References: <1344807757-2217-1-git-send-email-rydberg@euromail.se> Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org Going through the motions of printing the debug message information takes a long time; using the keyboard can lead to a 160 us irqsoff latency. This patch skips hid_dump_input() when there are no open handles, which brings latency down to 100 us. Signed-off-by: Henrik Rydberg --- drivers/hid/hid-core.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c index 60ea284..5b74e78 100644 --- a/drivers/hid/hid-core.c +++ b/drivers/hid/hid-core.c @@ -996,7 +996,8 @@ static void hid_process_event(struct hid_device *hid, struct hid_field *field, struct hid_driver *hdrv = hid->driver; int ret; - hid_dump_input(hid, usage, value); + if (!list_empty(&hid->debug_list)) + hid_dump_input(hid, usage, value); if (hdrv && hdrv->event && hid_match_usage(hid, usage)) { ret = hdrv->event(hid, field, usage, value);