Skip to contentSkip to conversation

gpio: Use of_property_present() for non-boolean properties

PATCH Applied Rob Herring (Arm) 4 participants 4 messages Nov 4, 2024 – Nov 6, 2024

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 gpio: Use of_property_present() for non-boolean properties

The use of of_property_read_bool() for non-boolean properties is deprecated in favor of of_property_present() when testing for property presence.

---
 drivers/gpio/gpio-rockchip.c | 2 +-
 drivers/gpio/gpiolib-of.c    | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/gpio/gpio-rockchip.c +1 -1
index 365ab947983c..64924bc01591 100644
@@ -602,7 +602,7 @@ static int rockchip_gpiolib_register(struct rockchip_pin_bank *bank)
 	 * files which don't set the "gpio-ranges" property or systems that
 	 * utilize ACPI the driver has to call gpiochip_add_pin_range().
 	 */
-	if (!of_property_read_bool(bank->of_node, "gpio-ranges")) {
+	if (!of_property_present(bank->of_node, "gpio-ranges")) {
 		struct device_node *pctlnp = of_get_parent(bank->of_node);
 		struct pinctrl_dev *pctldev = NULL;
 
drivers/gpio/gpiolib-of.c +1 -1
index 880f1efcaca5..2e537ee979f3 100644
@@ -337,7 +337,7 @@ static void of_gpio_flags_quirks(const struct device_node *np,
 	 * to determine if the flags should have inverted semantics.
 	 */
 	if (IS_ENABLED(CONFIG_SPI_MASTER) && !strcmp(propname, "cs-gpios") &&
-	    of_property_read_bool(np, "cs-gpios")) {
+	    of_property_present(np, "cs-gpios")) {
 		u32 cs;
 		int ret;
 
Signature · 1 line
2.45.2
Reviewed-by on v1 1/1
#1 lore raw

Hello Rob,

Quoted 5 lines · Rob Herring (Arm)

The use of of_property_read_bool() for non-boolean properties is deprecated in favor of of_property_present() when testing for property presence.

Looking good to me, thanks for the patch!

Quoted 32 lines
---
 drivers/gpio/gpio-rockchip.c | 2 +-
 drivers/gpio/gpiolib-of.c    | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/gpio/gpio-rockchip.c +1 -1
index 365ab947983c..64924bc01591 100644
@@ -602,7 +602,7 @@ static int rockchip_gpiolib_register(struct
 rockchip_pin_bank *bank)
 	 * files which don't set the "gpio-ranges" property or systems that
 	 * utilize ACPI the driver has to call gpiochip_add_pin_range().
 	 */
-	if (!of_property_read_bool(bank->of_node, "gpio-ranges")) {
+	if (!of_property_present(bank->of_node, "gpio-ranges")) {
 		struct device_node *pctlnp = of_get_parent(bank->of_node);
 		struct pinctrl_dev *pctldev = NULL;
drivers/gpio/gpiolib-of.c +1 -1
index 880f1efcaca5..2e537ee979f3 100644
@@ -337,7 +337,7 @@ static void of_gpio_flags_quirks(const struct
 device_node *np,
 	 * to determine if the flags should have inverted semantics.
 	 */
 	if (IS_ENABLED(CONFIG_SPI_MASTER) && !strcmp(propname, "cs-gpios") &&
-	    of_property_read_bool(np, "cs-gpios")) {
+	    of_property_present(np, "cs-gpios")) {
 		u32 cs;
 		int ret;
maintainer Reviewed-by on v1 1/1
#2 lore raw
In reply to Rob Herring (Arm)

Am Montag, 4. November 2024, 20:06:27 CET schrieb Rob Herring (Arm):

Quoted 5 lines

The use of of_property_read_bool() for non-boolean properties is deprecated in favor of of_property_present() when testing for property presence.

With of_property_present essentially just mapping to of_property_read_bool, this change looks correct and should not introduce any functional differences

Quoted 32 lines
---
 drivers/gpio/gpio-rockchip.c | 2 +-
 drivers/gpio/gpiolib-of.c    | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/gpio/gpio-rockchip.c +1 -1
index 365ab947983c..64924bc01591 100644
@@ -602,7 +602,7 @@ static int rockchip_gpiolib_register(struct rockchip_pin_bank *bank)
 	 * files which don't set the "gpio-ranges" property or systems that
 	 * utilize ACPI the driver has to call gpiochip_add_pin_range().
 	 */
-	if (!of_property_read_bool(bank->of_node, "gpio-ranges")) {
+	if (!of_property_present(bank->of_node, "gpio-ranges")) {
 		struct device_node *pctlnp = of_get_parent(bank->of_node);
 		struct pinctrl_dev *pctldev = NULL;
 
drivers/gpio/gpiolib-of.c +1 -1
index 880f1efcaca5..2e537ee979f3 100644
@@ -337,7 +337,7 @@ static void of_gpio_flags_quirks(const struct device_node *np,
 	 * to determine if the flags should have inverted semantics.
 	 */
 	if (IS_ENABLED(CONFIG_SPI_MASTER) && !strcmp(propname, "cs-gpios") &&
-	    of_property_read_bool(np, "cs-gpios")) {
+	    of_property_present(np, "cs-gpios")) {
 		u32 cs;
 		int ret;
 
#3 lore raw
In reply to Rob Herring (Arm)

From: Bartosz Golaszewski <[email protected]>

Quoted 5 lines · Rob Herring (Arm)

The use of of_property_read_bool() for non-boolean properties is deprecated in favor of of_property_present() when testing for property presence.

Applied, thanks!

[1/1] gpio: Use of_property_present() for non-boolean properties

      commit: c6789170ddef58d28cfbc3342933713ce1e2c860

Best regards,

Signature · 1 line
Bartosz Golaszewski <[email protected]>