Thread (11 messages) 11 messages, 3 authors, 2012-03-29

Re: [PATCH V2 1/2] Input: of_keymap: Introduce matrix_keypad_of_build_keymap()

flat view

From: Stephen Warren <hidden>
Date: 2012-03-27 15:45:42
Also in: linux-devicetree

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.
quoted hunk ↗ jump to hunk
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)
...
quoted hunk ↗ jump to hunk
+	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.
quoted hunk ↗ jump to hunk
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.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help