aboutsummaryrefslogtreecommitdiff
path: root/drivers/input/keyboard/samsung-keypad.c
diff options
context:
space:
mode:
authorTobias Klauser <tklauser@distanz.ch>2012-08-21 22:04:46 -0700
committerDmitry Torokhov <dmitry.torokhov@gmail.com>2012-08-21 22:40:01 -0700
commit31b95bfb79e8d7637ba0d399eb152f9b0d548340 (patch)
tree4bde16dd76c51c4c1f2b05b3ea5a3d6990cf7556 /drivers/input/keyboard/samsung-keypad.c
parentf4d4661bee0f54410ac65571b50df5d9fe091d03 (diff)
Input: samsung-keypad - use of_get_child_count() helper
Use of_get_child_count() instead of custom implementation. Signed-off-by: Tobias Klauser <tklauser@distanz.ch> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Diffstat (limited to 'drivers/input/keyboard/samsung-keypad.c')
-rw-r--r--drivers/input/keyboard/samsung-keypad.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/drivers/input/keyboard/samsung-keypad.c b/drivers/input/keyboard/samsung-keypad.c
index e2f31c8489f..277e26dc910 100644
--- a/drivers/input/keyboard/samsung-keypad.c
+++ b/drivers/input/keyboard/samsung-keypad.c
@@ -256,7 +256,7 @@ static struct samsung_keypad_platdata *samsung_keypad_parse_dt(
struct matrix_keymap_data *keymap_data;
uint32_t *keymap, num_rows = 0, num_cols = 0;
struct device_node *np = dev->of_node, *key_np;
- unsigned int key_count = 0;
+ unsigned int key_count;
pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL);
if (!pdata) {
@@ -280,9 +280,7 @@ static struct samsung_keypad_platdata *samsung_keypad_parse_dt(
}
pdata->keymap_data = keymap_data;
- for_each_child_of_node(np, key_np)
- key_count++;
-
+ key_count = of_get_child_count(np);
keymap_data->keymap_size = key_count;
keymap = devm_kzalloc(dev, sizeof(uint32_t) * key_count, GFP_KERNEL);
if (!keymap) {