From patchwork Fri May 28 15:10:34 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Henrik Rydberg X-Patchwork-Id: 102912 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.3/8.14.3) with ESMTP id o4SFBLpL026923 for ; Fri, 28 May 2010 15:11:44 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932146Ab0E1PLo (ORCPT ); Fri, 28 May 2010 11:11:44 -0400 Received: from ch-smtp01.sth.basefarm.net ([80.76.149.212]:38864 "EHLO ch-smtp01.sth.basefarm.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751691Ab0E1PLn (ORCPT ); Fri, 28 May 2010 11:11:43 -0400 Received: from c83-248-196-134.bredband.comhem.se ([83.248.196.134]:60304 helo=alnilam) by ch-smtp01.sth.basefarm.net with smtp (Exim 4.68) (envelope-from ) id 1OI1DI-0003bo-6I; Fri, 28 May 2010 17:11:11 +0200 Received: by alnilam (sSMTP sendmail emulation); Fri, 28 May 2010 17:11:08 +0200 From: "Henrik Rydberg" To: Dmitry Torokhov Cc: linux-input@vger.kernel.org, Jiri Kosina , Mika Kuoppala , Benjamin Tissoires , Rafi Rubin , Henrik Rydberg Subject: [PATCH 3/3] input: use driver hint to compute the evdev buffer size Date: Fri, 28 May 2010 17:10:34 +0200 Message-Id: <1275059434-2110-4-git-send-email-rydberg@euromail.se> X-Mailer: git-send-email 1.6.3.3 In-Reply-To: <1275059434-2110-3-git-send-email-rydberg@euromail.se> References: <1275059434-2110-1-git-send-email-rydberg@euromail.se> <1275059434-2110-2-git-send-email-rydberg@euromail.se> <1275059434-2110-3-git-send-email-rydberg@euromail.se> X-Originating-IP: 83.248.196.134 X-Scan-Result: No virus found in message 1OI1DI-0003bo-6I. X-Scan-Signature: ch-smtp01.sth.basefarm.net 1OI1DI-0003bo-6I bf57be0c9e77d8c8dc6e99263d5d2644 Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter.kernel.org [140.211.167.41]); Fri, 28 May 2010 15:11:44 +0000 (UTC) diff --git a/drivers/input/evdev.c b/drivers/input/evdev.c index ea652cc..03ce9c1 100644 --- a/drivers/input/evdev.c +++ b/drivers/input/evdev.c @@ -11,6 +11,7 @@ #define EVDEV_MINOR_BASE 64 #define EVDEV_MINORS 32 #define EVDEV_MIN_BUFFER_SIZE 64 +#define EVDEV_BUF_PACKETS 8 #include #include @@ -792,7 +793,9 @@ static void evdev_cleanup(struct evdev *evdev) static int evdev_compute_buffer_size(struct input_dev *dev) { - return EVDEV_MIN_BUFFER_SIZE; + int nev = dev->hint_events_per_packet * EVDEV_BUF_PACKETS; + nev = max(nev, EVDEV_MIN_BUFFER_SIZE); + return roundup_pow_of_two(nev); } /* diff --git a/include/linux/input.h b/include/linux/input.h index bd00786..35b015d 100644 --- a/include/linux/input.h +++ b/include/linux/input.h @@ -1162,6 +1162,8 @@ struct input_dev { unsigned long ffbit[BITS_TO_LONGS(FF_CNT)]; unsigned long swbit[BITS_TO_LONGS(SW_CNT)]; + unsigned int hint_events_per_packet; + unsigned int keycodemax; unsigned int keycodesize; void *keycode; @@ -1439,6 +1441,11 @@ static inline void input_mt_slot(struct input_dev *dev, int slot) void input_set_capability(struct input_dev *dev, unsigned int type, unsigned int code); +static inline void input_set_events_per_packet(struct input_dev *dev, int nev) +{ + dev->hint_events_per_packet = nev; +} + static inline void input_set_abs_params(struct input_dev *dev, int axis, int min, int max, int fuzz, int flat) { dev->absmin[axis] = min;