From: Stephen Warren <swarren@wwwdotorg.org>
To: Viresh Kumar <viresh.kumar@st.com>
Cc: dmitry.torokhov@gmail.com, devicetree-discuss@lists.ozlabs.org,
spear-devel@list.st.com, viresh.linux@gmail.com,
linux-input@vger.kernel.org, sr@denx.de
Subject: Re: [PATCH V2 1/2] Input: of_keymap: Introduce matrix_keypad_of_build_keymap()
Date: Tue, 27 Mar 2012 09:45:42 -0600 [thread overview]
Message-ID: <4F71E0A6.4080703@wwwdotorg.org> (raw)
In-Reply-To: <4aba6f2cd9f050f419660555bdb661915c1be9b1.1332826100.git.viresh.kumar@st.com>
On 03/26/2012 11:38 PM, Viresh Kumar wrote:
> We don't need to allocate memory for keymap in matrix_keyboard_of_fill_keymap(),
> as this would only be used by matrix_keyboard_of_free_keymap(). Instead create
> another routine matrix_keypad_of_build_keymap() which reads directly the
> property from struct device_node and builds keymap.
>
> With this eariler routines matrix_keyboard_of_fill_keymap() and
> matrix_keyboard_of_free_keymap() go away.
>
> This patch also fixes tegra driver according to these changes.
> diff --git a/drivers/input/keyboard/tegra-kbc.c b/drivers/input/keyboard/tegra-kbc.c
...
> static int __devinit tegra_kbc_probe(struct platform_device *pdev)
...
> + if (pdev->dev.of_node) {
> + /* FIXME: Add handling of linux,fn-keymap here */
> + err = matrix_keypad_of_build_keymap(&pdev->dev, KBC_ROW_SHIFT,
> + input_dev->keycode, input_dev->keybit,
> + "linux,keymap");
Where do input_dev->keycode/keybit get allocated? As far as I can tell,
matrix_keypad_of_build_keymap() just writes to those and assumes they're
already allocated.
> diff --git a/drivers/input/of_keymap.c b/drivers/input/of_keymap.c
...
> +int matrix_keypad_of_build_keymap(struct device *dev, unsigned int row_shift,
...
> + keymap[MATRIX_SCAN_CODE(row, col, row_shift)] = code;
> + __set_bit(code, keybit);
How bit are keymap and keybit? I think we need range-checking here to
make sure that row/col/row_shift/code are valid and in-range.
next prev parent reply other threads:[~2012-03-27 15:45 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-03-27 5:38 [PATCH V2 1/2] Input: of_keymap: Introduce matrix_keypad_of_build_keymap() Viresh Kumar
2012-03-27 5:38 ` [PATCH V2 2/2] Input: spear-keyboard: add device tree bindings Viresh Kumar
2012-03-27 7:13 ` Dmitry Torokhov
2012-03-27 7:37 ` Viresh Kumar
2012-03-27 7:51 ` Dmitry Torokhov
2012-03-27 8:05 ` Viresh Kumar
2012-03-27 15:46 ` Stephen Warren
2012-03-27 15:45 ` Stephen Warren [this message]
2012-03-28 4:55 ` [PATCH V2 1/2] Input: of_keymap: Introduce matrix_keypad_of_build_keymap() Viresh Kumar
2012-03-28 21:28 ` Stephen Warren
2012-03-29 8:23 ` Viresh Kumar
[not found] ` <4aba6f2cd9f050f419660555bdb661915c1be9b1.1332826100.git.viresh.kumar-qxv4g6HH51o@public.gmane.org>
2012-03-28 9:54 ` [PATCH V3 2/2] Input: spear-keyboard: add device tree bindings Viresh Kumar
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=4F71E0A6.4080703@wwwdotorg.org \
--to=swarren@wwwdotorg.org \
--cc=devicetree-discuss@lists.ozlabs.org \
--cc=dmitry.torokhov@gmail.com \
--cc=linux-input@vger.kernel.org \
--cc=spear-devel@list.st.com \
--cc=sr@denx.de \
--cc=viresh.kumar@st.com \
--cc=viresh.linux@gmail.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.