Skip to content

Commit 12c7d0a

Browse files
robherringdtor
authored andcommitted
Input: Use of_property_read_bool() for boolean properties
It is preferred to use typed property access functions (i.e. of_property_read_<type> functions) rather than low-level of_get_property/of_find_property functions for reading properties. Convert reading boolean properties to of_property_read_bool(). Signed-off-by: Rob Herring <robh@kernel.org> Link: https://lore.kernel.org/r/20230310144708.1542751-1-robh@kernel.org Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
1 parent d26a3a6 commit 12c7d0a

4 files changed

Lines changed: 5 additions & 10 deletions

File tree

drivers/input/keyboard/matrix_keypad.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -425,14 +425,12 @@ matrix_keypad_parse_dt(struct device *dev)
425425
return ERR_PTR(-EINVAL);
426426
}
427427

428-
if (of_get_property(np, "linux,no-autorepeat", NULL))
429-
pdata->no_autorepeat = true;
428+
pdata->no_autorepeat = of_property_read_bool(np, "linux,no-autorepeat");
430429

431430
pdata->wakeup = of_property_read_bool(np, "wakeup-source") ||
432431
of_property_read_bool(np, "linux,wakeup"); /* legacy */
433432

434-
if (of_get_property(np, "gpio-activelow", NULL))
435-
pdata->active_low = true;
433+
pdata->active_low = of_property_read_bool(np, "gpio-activelow");
436434

437435
pdata->drive_inactive_cols =
438436
of_property_read_bool(np, "drive-inactive-cols");

drivers/input/keyboard/omap4-keypad.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -274,8 +274,7 @@ static int omap4_keypad_parse_dt(struct device *dev,
274274
if (err)
275275
return err;
276276

277-
if (of_get_property(np, "linux,input-no-autorepeat", NULL))
278-
keypad_data->no_autorepeat = true;
277+
keypad_data->no_autorepeat = of_property_read_bool(np, "linux,input-no-autorepeat");
279278

280279
return 0;
281280
}

drivers/input/keyboard/samsung-keypad.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -291,8 +291,7 @@ samsung_keypad_parse_dt(struct device *dev)
291291
*keymap++ = KEY(row, col, key_code);
292292
}
293293

294-
if (of_get_property(np, "linux,input-no-autorepeat", NULL))
295-
pdata->no_autorepeat = true;
294+
pdata->no_autorepeat = of_property_read_bool(np, "linux,input-no-autorepeat");
296295

297296
pdata->wakeup = of_property_read_bool(np, "wakeup-source") ||
298297
/* legacy name */

drivers/input/keyboard/tegra-kbc.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -504,8 +504,7 @@ static int tegra_kbc_parse_dt(struct tegra_kbc *kbc)
504504
if (!of_property_read_u32(np, "nvidia,repeat-delay-ms", &prop))
505505
kbc->repeat_cnt = prop;
506506

507-
if (of_find_property(np, "nvidia,needs-ghost-filter", NULL))
508-
kbc->use_ghost_filter = true;
507+
kbc->use_ghost_filter = of_property_present(np, "nvidia,needs-ghost-filter");
509508

510509
if (of_property_read_bool(np, "wakeup-source") ||
511510
of_property_read_bool(np, "nvidia,wakeup-source")) /* legacy */

0 commit comments

Comments
 (0)