From mboxrd@z Thu Jan 1 00:00:00 1970 From: Miguel Aguilar Subject: Re: [PATCH 1/2] Input: DaVinci Keypad Driver Date: Wed, 23 Sep 2009 12:15:24 -0600 Message-ID: <4ABA65BC.7040404@ridgerun.com> References: <1253654850-11983-1-git-send-email-miguel.aguilar@ridgerun.com> <20090923034643.GB1458@core.coreip.homeip.net> <4ABA3638.5070609@ridgerun.com> <20090923163546.GA13435@core.coreip.homeip.net> <4ABA55BA.7000009@ridgerun.com> <4ABA5A27.8040702@ridgerun.com> <20090923174130.GD13435@core.coreip.homeip.net> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Return-path: Received: from mail.navvo.net ([74.208.67.6]:54077 "EHLO mail.navvo.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751403AbZIWSPd (ORCPT ); Wed, 23 Sep 2009 14:15:33 -0400 In-Reply-To: <20090923174130.GD13435@core.coreip.homeip.net> Sender: linux-input-owner@vger.kernel.org List-Id: linux-input@vger.kernel.org To: Dmitry Torokhov Cc: nsnehaprabha@ti.com, davinci-linux-open-source@linux.davincidsp.com, linux-input@vger.kernel.org, todd.fischer@ridgerun.com, diego.dompe@ridgerun.com, clark.becker@ridgerun.com, santiago.nunez@ridgerun.com, David Brownell Dmitry Torokhov wrote: > On Wed, Sep 23, 2009 at 11:25:59AM -0600, Miguel Aguilar wrote: >>>>>> Please kopy keymap into the davinci_kp stucture and use it so that >>>>>> platform data is never changed and can be declared const. >>>>> Do you mean something like this? >>>>> >>>>> struct davinci_kp { >>>>> ... >>>>> const int *keymap; >>>>> ... >>>>> }; >>>>> >>>> More like: >>>> >>>> struct davinci_kp { >>>> ... >>>> unsgned char keymap[]; >>>> ... >>>> }; >>>> >>> [MA] Ok. >> [MA] Why usigned char with no pointer and not u32 as most of the keypad >> driver as defined? > > Sorry, meant to say "unsigned short keymap[...]", we not going to have > more than 64K keycodes. You need to fill the array dimension, if the > size is not known before hand (and if upper bound is too jigh to always > allocate max) then you'll have to allocate it separately. Hm, well, if > you make it the last element of the davinci_kp structure you can alwqays > allocate the needed amount of memory, like this: > > struct davinci_kp { > ... > ... > unsigned short keymap[]; > }; > > ... > > kp = kzalloc(sizeof(struct davinci_kp) + > sizeof(unsigned short) * pdata->keymap_size, > GFP_KERNEL); > Why do I need to use keymap[]; instead of *keymap? If I use keypad[] how is the proper way to assign the platform keymap to the private keymap of the driver?