mirror of
https://github.com/torvalds/linux.git
synced 2024-11-04 11:04:38 +00:00
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>
This commit is contained in:
parent
f4d4661bee
commit
31b95bfb79
@ -256,7 +256,7 @@ static struct samsung_keypad_platdata *samsung_keypad_parse_dt(
|
|||||||
struct matrix_keymap_data *keymap_data;
|
struct matrix_keymap_data *keymap_data;
|
||||||
uint32_t *keymap, num_rows = 0, num_cols = 0;
|
uint32_t *keymap, num_rows = 0, num_cols = 0;
|
||||||
struct device_node *np = dev->of_node, *key_np;
|
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);
|
pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL);
|
||||||
if (!pdata) {
|
if (!pdata) {
|
||||||
@ -280,9 +280,7 @@ static struct samsung_keypad_platdata *samsung_keypad_parse_dt(
|
|||||||
}
|
}
|
||||||
pdata->keymap_data = keymap_data;
|
pdata->keymap_data = keymap_data;
|
||||||
|
|
||||||
for_each_child_of_node(np, key_np)
|
key_count = of_get_child_count(np);
|
||||||
key_count++;
|
|
||||||
|
|
||||||
keymap_data->keymap_size = key_count;
|
keymap_data->keymap_size = key_count;
|
||||||
keymap = devm_kzalloc(dev, sizeof(uint32_t) * key_count, GFP_KERNEL);
|
keymap = devm_kzalloc(dev, sizeof(uint32_t) * key_count, GFP_KERNEL);
|
||||||
if (!keymap) {
|
if (!keymap) {
|
||||||
|
Loading…
Reference in New Issue
Block a user