[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <a28baf4e07e464c43aff9e52263b5a902f5da9a0.1674584626.git.geert+renesas@glider.be>
Date: Tue, 24 Jan 2023 19:37:27 +0100
From: Geert Uytterhoeven <geert+renesas@...der.be>
To: Vinod Koul <vkoul@...nel.org>, Jonathan Corbet <corbet@....net>,
Madalin Bucur <madalin.bucur@....com>,
"David S . Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>,
Jakub Kicinski <kuba@...nel.org>,
Paolo Abeni <pabeni@...hat.com>,
Horatiu Vultur <horatiu.vultur@...rochip.com>,
UNGLinuxDriver@...rochip.com,
Thierry Reding <thierry.reding@...il.com>,
Lorenzo Pieralisi <lpieralisi@...nel.org>,
Rob Herring <robh@...nel.org>,
Krzysztof WilczyĆski <kw@...ux.com>,
Bjorn Helgaas <bhelgaas@...gle.com>,
Jonathan Hunter <jonathanh@...dia.com>,
Kishon Vijay Abraham I <kishon@...nel.org>,
Alan Stern <stern@...land.harvard.edu>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Krzysztof Kozlowski <krzysztof.kozlowski@...aro.org>,
Alim Akhtar <alim.akhtar@...sung.com>,
Siddharth Vadapalli <s-vadapalli@...com>,
Russell King <linux@...linux.org.uk>
Cc: linux-phy@...ts.infradead.org, linux-doc@...r.kernel.org,
netdev@...r.kernel.org, linux-tegra@...r.kernel.org,
linux-pci@...r.kernel.org, linux-usb@...r.kernel.org,
linux-arm-kernel@...ts.infradead.org,
linux-samsung-soc@...r.kernel.org,
Geert Uytterhoeven <geert+renesas@...der.be>
Subject: [PATCH v2 8/9] usb: host: ehci-exynos: Convert to devm_of_phy_optional_get()
Use the new devm_of_phy_optional_get() helper instead of open-coding the
same operation.
As devm_of_phy_optional_get() returns NULL if either the PHY cannot be
found, or if support for the PHY framework is not enabled, it is no
longer needed to check for -ENODEV or -ENOSYS.
This lets us drop several checks for IS_ERR(), as phy_power_{on,off}()
handle NULL parameters fine.
Signed-off-by: Geert Uytterhoeven <geert+renesas@...der.be>
Reviewed-by: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
---
v2:
- Add Reviewed-by,
- Clarify removed checks for -ENODEV and -ENOSYS,
- Remove error printing in case of real failures.
---
drivers/usb/host/ehci-exynos.c | 23 ++++++-----------------
1 file changed, 6 insertions(+), 17 deletions(-)
diff --git a/drivers/usb/host/ehci-exynos.c b/drivers/usb/host/ehci-exynos.c
index a333231616f437b8..47c9f06c3d843db3 100644
--- a/drivers/usb/host/ehci-exynos.c
+++ b/drivers/usb/host/ehci-exynos.c
@@ -80,19 +80,11 @@ static int exynos_ehci_get_phy(struct device *dev,
return -EINVAL;
}
- phy = devm_of_phy_get(dev, child, NULL);
+ phy = devm_of_phy_optional_get(dev, child, NULL);
exynos_ehci->phy[phy_number] = phy;
if (IS_ERR(phy)) {
- ret = PTR_ERR(phy);
- if (ret == -EPROBE_DEFER) {
- of_node_put(child);
- return ret;
- } else if (ret != -ENOSYS && ret != -ENODEV) {
- dev_err(dev,
- "Error retrieving usb2 phy: %d\n", ret);
- of_node_put(child);
- return ret;
- }
+ of_node_put(child);
+ return PTR_ERR(phy);
}
}
@@ -108,12 +100,10 @@ static int exynos_ehci_phy_enable(struct device *dev)
int ret = 0;
for (i = 0; ret == 0 && i < PHY_NUMBER; i++)
- if (!IS_ERR(exynos_ehci->phy[i]))
- ret = phy_power_on(exynos_ehci->phy[i]);
+ ret = phy_power_on(exynos_ehci->phy[i]);
if (ret)
for (i--; i >= 0; i--)
- if (!IS_ERR(exynos_ehci->phy[i]))
- phy_power_off(exynos_ehci->phy[i]);
+ phy_power_off(exynos_ehci->phy[i]);
return ret;
}
@@ -125,8 +115,7 @@ static void exynos_ehci_phy_disable(struct device *dev)
int i;
for (i = 0; i < PHY_NUMBER; i++)
- if (!IS_ERR(exynos_ehci->phy[i]))
- phy_power_off(exynos_ehci->phy[i]);
+ phy_power_off(exynos_ehci->phy[i]);
}
static void exynos_setup_vbus_gpio(struct device *dev)
--
2.34.1
Powered by blists - more mailing lists