]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
phy: phy-rockchip-inno-usb2: Perform trivial code cleanups
authorDragan Simic <dsimic@manjaro.org>
Thu, 5 Sep 2024 08:28:22 +0000 (10:28 +0200)
committerVinod Koul <vkoul@kernel.org>
Mon, 7 Oct 2024 06:23:16 +0000 (11:53 +0530)
Perform a few trivial code cleanups, e.g. to obey the reverse Christmas tree
rule, to avoid use of "{ ... }" code blocks where they aren't really needed,
or to avoid line wrapping by using the 100-column width better.

No intended functional changes are introduced by these code cleanups.

Reviewed-by: Heiko Stuebner <heiko@sntech.de>
Signed-off-by: Dragan Simic <dsimic@manjaro.org>
Link: https://lore.kernel.org/r/adce7309f6fd9e1191c53bab552a8531d1a71216.1725524802.git.dsimic@manjaro.org
Signed-off-by: Vinod Koul <vkoul@kernel.org>
drivers/phy/rockchip/phy-rockchip-inno-usb2.c

index 4f71373ae6e1a3782ffdaf4c32cd2c21befa5908..03b772200fed12ca07a43ae890c331f92e9ffc56 100644 (file)
@@ -418,9 +418,9 @@ err_ret:
 
 static int rockchip_usb2phy_extcon_register(struct rockchip_usb2phy *rphy)
 {
-       int ret;
        struct device_node *node = rphy->dev->of_node;
        struct extcon_dev *edev;
+       int ret;
 
        if (of_property_read_bool(node, "extcon")) {
                edev = extcon_get_edev_by_phandle(rphy->dev, 0);
@@ -1327,7 +1327,7 @@ static int rockchip_usb2phy_probe(struct platform_device *pdev)
        struct rockchip_usb2phy *rphy;
        const struct rockchip_usb2phy_cfg *phy_cfgs;
        unsigned int reg;
-       int index, ret;
+       int index = 0, ret;
 
        rphy = devm_kzalloc(dev, sizeof(*rphy), GFP_KERNEL);
        if (!rphy)
@@ -1339,9 +1339,7 @@ static int rockchip_usb2phy_probe(struct platform_device *pdev)
                        dev_err(dev, "failed to locate usbgrf\n");
                        return PTR_ERR(rphy->grf);
                }
-       }
-
-       else {
+       } else {
                rphy->grf = syscon_node_to_regmap(dev->parent->of_node);
                if (IS_ERR(rphy->grf))
                        return PTR_ERR(rphy->grf);
@@ -1358,16 +1356,14 @@ static int rockchip_usb2phy_probe(struct platform_device *pdev)
        }
 
        if (of_property_read_u32_index(np, "reg", 0, &reg)) {
-               dev_err(dev, "the reg property is not assigned in %pOFn node\n",
-                       np);
+               dev_err(dev, "the reg property is not assigned in %pOFn node\n", np);
                return -EINVAL;
        }
 
        /* support address_cells=2 */
        if (of_property_count_u32_elems(np, "reg") > 2 && reg == 0) {
                if (of_property_read_u32_index(np, "reg", 1, &reg)) {
-                       dev_err(dev, "the reg property is not assigned in %pOFn node\n",
-                               np);
+                       dev_err(dev, "the reg property is not assigned in %pOFn node\n", np);
                        return -EINVAL;
                }
        }
@@ -1386,8 +1382,7 @@ static int rockchip_usb2phy_probe(struct platform_device *pdev)
        if (ret)
                return ret;
 
-       /* find out a proper config which can be matched with dt. */
-       index = 0;
+       /* find a proper config that can be matched with the DT */
        do {
                if (phy_cfgs[index].reg == reg) {
                        rphy->phy_cfg = &phy_cfgs[index];
@@ -1407,10 +1402,9 @@ static int rockchip_usb2phy_probe(struct platform_device *pdev)
                return PTR_ERR(rphy->phy_reset);
 
        rphy->clk = devm_clk_get_optional_enabled(dev, "phyclk");
-       if (IS_ERR(rphy->clk)) {
+       if (IS_ERR(rphy->clk))
                return dev_err_probe(&pdev->dev, PTR_ERR(rphy->clk),
                                     "failed to get phyclk\n");
-       }
 
        ret = rockchip_usb2phy_clk480m_register(rphy);
        if (ret) {
@@ -1446,13 +1440,11 @@ static int rockchip_usb2phy_probe(struct platform_device *pdev)
 
                /* initialize otg/host port separately */
                if (of_node_name_eq(child_np, "host-port")) {
-                       ret = rockchip_usb2phy_host_port_init(rphy, rport,
-                                                             child_np);
+                       ret = rockchip_usb2phy_host_port_init(rphy, rport, child_np);
                        if (ret)
                                goto put_child;
                } else {
-                       ret = rockchip_usb2phy_otg_port_init(rphy, rport,
-                                                            child_np);
+                       ret = rockchip_usb2phy_otg_port_init(rphy, rport, child_np);
                        if (ret)
                                goto put_child;
                }