Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751752AbXJ1Fa3 (ORCPT ); Sun, 28 Oct 2007 01:30:29 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1750795AbXJ1FaU (ORCPT ); Sun, 28 Oct 2007 01:30:20 -0400 Received: from mxsf07.insightbb.com ([74.128.0.77]:33994 "EHLO mxsf07.insightbb.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750841AbXJ1FaS (ORCPT ); Sun, 28 Oct 2007 01:30:18 -0400 X-IronPort-AV: E=Sophos;i="4.21,338,1188792000"; d="scan'208";a="112274919" X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Aq4HAEW7I0dKjlCP/2dsb2JhbACBWg X-IronPort-AV: E=Sophos;i="4.21,338,1188792000"; d="scan'208";a="150554039" From: Dmitry Torokhov To: Stephen Hemminger Subject: Re: [PATCH] Fujitsu application panel driver Date: Sun, 28 Oct 2007 01:30:15 -0400 User-Agent: KMail/1.9.3 Cc: Pavel Machek , Len Brown , Andrew Morton , linux-input@atrey.karlin.mff.cuni.cz, linux-kernel@vger.kernel.org References: <20070702111724.43ee5b43@freepuppy.localdomain.hemminger.net> <200709161623.00286.dtor@insightbb.com> <20071023125555.38d63567@shemminger-laptop> In-Reply-To: <20071023125555.38d63567@shemminger-laptop> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200710280130.16002.dtor@insightbb.com> Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 968 Lines: 35 Hi Stephen, On Tuesday 23 October 2007 15:55, Stephen Hemminger wrote: > + > +static int apanel_setkeycode(struct input_dev *idev, int scancode, int keycode) > +{ > + struct apanel *ap = idev->private; > + > + if (keycode < 0 || keycode > KEY_MAX) > + return -EINVAL; > + > + if (scancode < 0 || scancode >= MAX_PANEL_KEYS) > + return -EINVAL; scancode >= idev->keycodemax is prbably better here - we don't want to allow setting keycode for unsupported buttons. > + > + clear_bit(ap->keymap[scancode], idev->keybit); This will not work if one has same code assigned to 2 buttons. Pretty degenerate case, I know... > + ap->keymap[scancode] = keycode; > + set_bit(keycode, idev->keybit); > + return 0; > +} -- Dmitry - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/