Skip to contentSkip to conversation

phy: Use (of|device)_property_present() for non-boolean properties

PATCH Applied Rob Herring (Arm) 4 participants 5 messages Dec 31, 2024 – Feb 10, 2025

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

PATCH 1/1 phy: Use (of|device)_property_present() for non-boolean properties

The use of (of|device)_property_read_bool() for non-boolean properties is deprecated in favor of (of|device)_property_present() when testing for property presence.

---
 drivers/phy/mediatek/phy-mtk-tphy.c           | 4 ++--
 drivers/phy/rockchip/phy-rockchip-inno-usb2.c | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)
drivers/phy/mediatek/phy-mtk-tphy.c +2 -2
index 3f7095ec5978..d36f68dd622e 100644
@@ -1215,7 +1215,7 @@ static int phy_type_syscon_get(struct mtk_phy_instance *instance,
 	int ret;
 
 	/* type switch function is optional */
-	if (!of_property_read_bool(dn, "mediatek,syscon-type"))
+	if (!of_property_present(dn, "mediatek,syscon-type"))
 		return 0;
 
 	ret = of_parse_phandle_with_fixed_args(dn, "mediatek,syscon-type",
@@ -1278,7 +1278,7 @@ static int phy_efuse_get(struct mtk_tphy *tphy, struct mtk_phy_instance *instanc
 	}
 
 	/* software efuse is optional */
-	instance->efuse_sw_en = device_property_read_bool(dev, "nvmem-cells");
+	instance->efuse_sw_en = device_property_present(dev, "nvmem-cells");
 	if (!instance->efuse_sw_en)
 		return 0;
 
drivers/phy/rockchip/phy-rockchip-inno-usb2.c +2 -2
index 96f3d868a526..b5e6a864deeb 100644
@@ -440,7 +440,7 @@ static int rockchip_usb2phy_extcon_register(struct rockchip_usb2phy *rphy)
 	struct extcon_dev *edev;
 	int ret;
 
-	if (of_property_read_bool(node, "extcon")) {
+	if (of_property_present(node, "extcon")) {
 		edev = extcon_get_edev_by_phandle(rphy->dev, 0);
 		if (IS_ERR(edev))
 			return dev_err_probe(rphy->dev, PTR_ERR(edev),
@@ -1323,7 +1323,7 @@ static int rockchip_usb2phy_otg_port_init(struct rockchip_usb2phy *rphy,
 			goto out;
 		}
 
-		if (!of_property_read_bool(rphy->dev->of_node, "extcon")) {
+		if (!of_property_present(rphy->dev->of_node, "extcon")) {
 			/* do initial sync of usb state */
 			id = property_enabled(rphy->grf, &rport->port_cfg->utmi_id);
 			extcon_set_state_sync(rphy->edev, EXTCON_USB_HOST, !id);
Signature · 1 line
2.45.2
maintainer Reviewed-by on v1 1/1
#2 lore raw
In reply to Rob Herring (Arm)
Quoted 70 lines · Rob Herring (Arm)

External email : Please do not click links or open attachments until you have verified the sender or the content.

The use of (of|device)_property_read_bool() for non-boolean properties
is deprecated in favor of (of|device)_property_present() when testing for property presence.

---
 drivers/phy/mediatek/phy-mtk-tphy.c           | 4 ++--
 drivers/phy/rockchip/phy-rockchip-inno-usb2.c | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)
drivers/phy/mediatek/phy-mtk-tphy.c +1 -1
index 3f7095ec5978..d36f68dd622e 100644
@@ -1215,7 +1215,7 @@ static int phy_type_syscon_get(struct
 mtk_phy_instance *instance,
        int ret;
 
        /* type switch function is optional */
-       if (!of_property_read_bool(dn, "mediatek,syscon-type"))
+       if (!of_property_present(dn, "mediatek,syscon-type"))
                return 0;
 

ret = of_parse_phandle_with_fixed_args(dn, "mediatek,syscon-
type",

drivers/phy/mediatek/phy-mtk-tphy.c +0 -0
@@ -1278,7 +1278,7 @@ static int phy_efuse_get(struct mtk_tphy *tphy,

struct mtk_phy_instance *instanc

        }

        /* software efuse is optional */
-       instance->efuse_sw_en = device_property_read_bool(dev,
"nvmem-cells");
+       instance->efuse_sw_en = device_property_present(dev, "nvmem-
cells");
        if (!instance->efuse_sw_en)
                return 0;
drivers/phy/rockchip/phy-rockchip-inno-usb2.c +1 -1
index 96f3d868a526..b5e6a864deeb 100644
@@ -440,7 +440,7 @@ static int
 rockchip_usb2phy_extcon_register(struct rockchip_usb2phy *rphy)
        struct extcon_dev *edev;
        int ret;
 
-       if (of_property_read_bool(node, "extcon")) {
+       if (of_property_present(node, "extcon")) {
                edev = extcon_get_edev_by_phandle(rphy->dev, 0);
                if (IS_ERR(edev))
                        return dev_err_probe(rphy->dev,

PTR_ERR(edev),

drivers/phy/rockchip/phy-rockchip-inno-usb2.c +1 -1
@@ -1323,7 +1323,7 @@ static int
 rockchip_usb2phy_otg_port_init(struct rockchip_usb2phy *rphy,
                        goto out;
                }
 
-               if (!of_property_read_bool(rphy->dev->of_node,
 "extcon")) {
+               if (!of_property_present(rphy->dev->of_node,
 "extcon")) {
                        /* do initial sync of usb state */
                        id = property_enabled(rphy->grf, &rport-
Quoted 6 lines
Quoted 1 line

port_cfg->utmi_id);

                        extcon_set_state_sync(rphy->edev,

EXTCON_USB_HOST, !id);
--
2.45.2

For MediaTek:

Thanks

#3 lore raw
In reply to Rob Herring (Arm)
Quoted 10 lines · Rob Herring (Arm)

The use of (of|device)_property_read_bool() for non-boolean properties is deprecated in favor of (of|device)_property_present() when testing for property presence.

---
 drivers/phy/mediatek/phy-mtk-tphy.c           | 4 ++--
 drivers/phy/rockchip/phy-rockchip-inno-usb2.c | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

Ping. These now cause warnings in v6.14-rc1.

Quoted 48 lines
drivers/phy/mediatek/phy-mtk-tphy.c +2 -2
index 3f7095ec5978..d36f68dd622e 100644
@@ -1215,7 +1215,7 @@ static int phy_type_syscon_get(struct mtk_phy_instance *instance,
        int ret;
 
        /* type switch function is optional */
-       if (!of_property_read_bool(dn, "mediatek,syscon-type"))
+       if (!of_property_present(dn, "mediatek,syscon-type"))
                return 0;
 
        ret = of_parse_phandle_with_fixed_args(dn, "mediatek,syscon-type",
@@ -1278,7 +1278,7 @@ static int phy_efuse_get(struct mtk_tphy *tphy, struct mtk_phy_instance *instanc
        }
 
        /* software efuse is optional */
-       instance->efuse_sw_en = device_property_read_bool(dev, "nvmem-cells");
+       instance->efuse_sw_en = device_property_present(dev, "nvmem-cells");
        if (!instance->efuse_sw_en)
                return 0;
 
drivers/phy/rockchip/phy-rockchip-inno-usb2.c +2 -3
index 96f3d868a526..b5e6a864deeb 100644
@@ -440,7 +440,7 @@ static int rockchip_usb2phy_extcon_register(struct rockchip_usb2phy *rphy)
        struct extcon_dev *edev;
        int ret;
 
-       if (of_property_read_bool(node, "extcon")) {
+       if (of_property_present(node, "extcon")) {
                edev = extcon_get_edev_by_phandle(rphy->dev, 0);
                if (IS_ERR(edev))
                        return dev_err_probe(rphy->dev, PTR_ERR(edev),
@@ -1323,7 +1323,7 @@ static int rockchip_usb2phy_otg_port_init(struct rockchip_usb2phy *rphy,
                        goto out;
                }
 
-               if (!of_property_read_bool(rphy->dev->of_node, "extcon")) {
+               if (!of_property_present(rphy->dev->of_node, "extcon")) {
                        /* do initial sync of usb state */
                        id = property_enabled(rphy->grf, &rport->port_cfg->utmi_id);
                        extcon_set_state_sync(rphy->edev, EXTCON_USB_HOST, !id);
--

2.45.2

maintainer Applied
#4 lore raw
In reply to Rob Herring (Arm)
Quoted 5 lines · Rob Herring (Arm)

The use of (of|device)_property_read_bool() for non-boolean properties is deprecated in favor of (of|device)_property_present() when testing for property presence.

Applied, thanks!

[1/1] phy: Use (of|device)_property_present() for non-boolean properties

      commit: 88c0053baed659acd85b87dd52cbd75f3d8806be

Best regards,

Signature · 1 line
~Vinod