All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
To: Miguel Aguilar <miguel.aguilar@ridgerun.com>
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 <david-b@pacbell.net>
Subject: Re: [PATCH 1/2] Input: DaVinci Keypad Driver
Date: Wed, 23 Sep 2009 10:41:30 -0700	[thread overview]
Message-ID: <20090923174130.GD13435@core.coreip.homeip.net> (raw)
In-Reply-To: <4ABA5A27.8040702@ridgerun.com>

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);

-- 
Dmitry

  reply	other threads:[~2009-09-23 17:41 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-09-22 21:27 [PATCH 1/2] Input: DaVinci Keypad Driver miguel.aguilar
2009-09-23  3:46 ` Dmitry Torokhov
2009-09-23 14:52   ` Miguel Aguilar
2009-09-23 16:35     ` Dmitry Torokhov
2009-09-23 17:07       ` Miguel Aguilar
2009-09-23 17:25         ` Miguel Aguilar
2009-09-23 17:41           ` Dmitry Torokhov [this message]
2009-09-23 18:15             ` Miguel Aguilar
2009-09-23 18:19               ` Dmitry Torokhov
2009-09-23 17:51       ` David Brownell
2009-09-23 18:07         ` Dmitry Torokhov
2009-09-23 19:29           ` David Brownell
2009-09-23 19:51             ` Dmitry Torokhov
2009-09-23 23:05               ` David Brownell
2009-09-24  5:40                 ` Dmitry Torokhov
2009-09-24 14:59   ` Miguel Aguilar
2009-09-24 16:21     ` Dmitry Torokhov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20090923174130.GD13435@core.coreip.homeip.net \
    --to=dmitry.torokhov@gmail.com \
    --cc=clark.becker@ridgerun.com \
    --cc=david-b@pacbell.net \
    --cc=davinci-linux-open-source@linux.davincidsp.com \
    --cc=diego.dompe@ridgerun.com \
    --cc=linux-input@vger.kernel.org \
    --cc=miguel.aguilar@ridgerun.com \
    --cc=nsnehaprabha@ti.com \
    --cc=santiago.nunez@ridgerun.com \
    --cc=todd.fischer@ridgerun.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.