Skip to content

Commit 31b95bf

Browse files
tklauserdtor
authored andcommitted
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>
1 parent f4d4661 commit 31b95bf

1 file changed

Lines changed: 2 additions & 4 deletions

File tree

‎drivers/input/keyboard/samsung-keypad.c‎

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@ static struct samsung_keypad_platdata *samsung_keypad_parse_dt(
256256
struct matrix_keymap_data *keymap_data;
257257
uint32_t *keymap, num_rows = 0, num_cols = 0;
258258
struct device_node *np = dev->of_node, *key_np;
259-
unsigned int key_count = 0;
259+
unsigned int key_count;
260260

261261
pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL);
262262
if (!pdata) {
@@ -280,9 +280,7 @@ static struct samsung_keypad_platdata *samsung_keypad_parse_dt(
280280
}
281281
pdata->keymap_data = keymap_data;
282282

283-
for_each_child_of_node(np, key_np)
284-
key_count++;
285-
283+
key_count = of_get_child_count(np);
286284
keymap_data->keymap_size = key_count;
287285
keymap = devm_kzalloc(dev, sizeof(uint32_t) * key_count, GFP_KERNEL);
288286
if (!keymap) {

0 commit comments

Comments
 (0)