Input: Use of_property_read_bool() for boolean properties
authorRob Herring <robh@kernel.org>
Sat, 11 Mar 2023 04:27:10 +0000 (20:27 -0800)
committerDmitry Torokhov <dmitry.torokhov@gmail.com>
Fri, 17 Mar 2023 11:17:29 +0000 (04:17 -0700)
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>
drivers/input/keyboard/matrix_keypad.c
drivers/input/keyboard/omap4-keypad.c
drivers/input/keyboard/samsung-keypad.c
drivers/input/keyboard/tegra-kbc.c

index 203310727d88e08a0f44c44310653be832d51038..a1b037891af25f0b173e5bb35aed03ee1c3d907a 100644 (file)
@@ -425,14 +425,12 @@ matrix_keypad_parse_dt(struct device *dev)
                return ERR_PTR(-EINVAL);
        }
 
-       if (of_get_property(np, "linux,no-autorepeat", NULL))
-               pdata->no_autorepeat = true;
+       pdata->no_autorepeat = of_property_read_bool(np, "linux,no-autorepeat");
 
        pdata->wakeup = of_property_read_bool(np, "wakeup-source") ||
                        of_property_read_bool(np, "linux,wakeup"); /* legacy */
 
-       if (of_get_property(np, "gpio-activelow", NULL))
-               pdata->active_low = true;
+       pdata->active_low = of_property_read_bool(np, "gpio-activelow");
 
        pdata->drive_inactive_cols =
                of_property_read_bool(np, "drive-inactive-cols");
index 4426120398b029e927a18a7dbf5284d3d9d5b1df..9f085d5679dbbccb5dcf6b38e955e887add6ecea 100644 (file)
@@ -274,8 +274,7 @@ static int omap4_keypad_parse_dt(struct device *dev,
        if (err)
                return err;
 
-       if (of_get_property(np, "linux,input-no-autorepeat", NULL))
-               keypad_data->no_autorepeat = true;
+       keypad_data->no_autorepeat = of_property_read_bool(np, "linux,input-no-autorepeat");
 
        return 0;
 }
index 09e883ea13520db35e8f298faa8b70ec97a0b266..d85dd2489293463cfeabf00b1414834806b563ca 100644 (file)
@@ -291,8 +291,7 @@ samsung_keypad_parse_dt(struct device *dev)
                *keymap++ = KEY(row, col, key_code);
        }
 
-       if (of_get_property(np, "linux,input-no-autorepeat", NULL))
-               pdata->no_autorepeat = true;
+       pdata->no_autorepeat = of_property_read_bool(np, "linux,input-no-autorepeat");
 
        pdata->wakeup = of_property_read_bool(np, "wakeup-source") ||
                        /* legacy name */
index da4019cf0c8372f35e2f01b8ea9361458785fcfd..d5a6c7d8eb25d0f57f40096dabc707fb01105c50 100644 (file)
@@ -504,8 +504,7 @@ static int tegra_kbc_parse_dt(struct tegra_kbc *kbc)
        if (!of_property_read_u32(np, "nvidia,repeat-delay-ms", &prop))
                kbc->repeat_cnt = prop;
 
-       if (of_find_property(np, "nvidia,needs-ghost-filter", NULL))
-               kbc->use_ghost_filter = true;
+       kbc->use_ghost_filter = of_property_present(np, "nvidia,needs-ghost-filter");
 
        if (of_property_read_bool(np, "wakeup-source") ||
            of_property_read_bool(np, "nvidia,wakeup-source")) /* legacy */