From: Neil Armstrong <narmstrong@baylibre.com>
To: Heiner Kallweit <hkallweit1@gmail.com>,
Kishon Vijay Abraham I <kishon@ti.com>,
Vinod Koul <vkoul@kernel.org>,
Kevin Hilman <khilman@baylibre.com>,
Jerome Brunet <jbrunet@baylibre.com>,
Martin Blumenstingl <martin.blumenstingl@googlemail.com>
Cc: linux-phy@lists.infradead.org,
"linux-arm-kernel@lists.infradead.org"
<linux-arm-kernel@lists.infradead.org>,
"open list:ARM/Amlogic Meson..."
<linux-amlogic@lists.infradead.org>
Subject: Re: [PATCH] phy: amlogic: use devm_clk_get_enabled() to simplify the code
Date: Wed, 31 Aug 2022 10:58:35 +0200 [thread overview]
Message-ID: <9bd9e5d6-462a-b72d-0bed-980f5743af09@baylibre.com> (raw)
In-Reply-To: <9308a2a3-e828-bd9d-ab83-a68376aab5c3@gmail.com>
On 30/08/2022 19:16, Heiner Kallweit wrote:
> Simplify the code by using devm_clk_get_enabled().
>
> Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
> ---
> .../phy/amlogic/phy-meson-g12a-usb3-pcie.c | 32 ++++---------------
> 1 file changed, 6 insertions(+), 26 deletions(-)
>
> diff --git a/drivers/phy/amlogic/phy-meson-g12a-usb3-pcie.c b/drivers/phy/amlogic/phy-meson-g12a-usb3-pcie.c
> index 54d65a6f0..d2a1da8d9 100644
> --- a/drivers/phy/amlogic/phy-meson-g12a-usb3-pcie.c
> +++ b/drivers/phy/amlogic/phy-meson-g12a-usb3-pcie.c
> @@ -388,7 +388,6 @@ static int phy_g12a_usb3_pcie_probe(struct platform_device *pdev)
> struct phy_g12a_usb3_pcie_priv *priv;
> struct phy_provider *phy_provider;
> void __iomem *base;
> - int ret;
>
> priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
> if (!priv)
> @@ -408,43 +407,24 @@ static int phy_g12a_usb3_pcie_probe(struct platform_device *pdev)
> if (IS_ERR(priv->regmap_cr))
> return PTR_ERR(priv->regmap_cr);
>
> - priv->clk_ref = devm_clk_get(dev, "ref_clk");
> + priv->clk_ref = devm_clk_get_enabled(dev, "ref_clk");
> if (IS_ERR(priv->clk_ref))
> return PTR_ERR(priv->clk_ref);
>
> - ret = clk_prepare_enable(priv->clk_ref);
> - if (ret)
> - return ret;
> -
> priv->reset = devm_reset_control_array_get_exclusive(dev);
> - if (IS_ERR(priv->reset)) {
> - ret = PTR_ERR(priv->reset);
> - goto err_disable_clk_ref;
> - }
> + if (IS_ERR(priv->reset))
> + return PTR_ERR(priv->reset);
>
> priv->phy = devm_phy_create(dev, np, &phy_g12a_usb3_pcie_ops);
> - if (IS_ERR(priv->phy)) {
> - ret = PTR_ERR(priv->phy);
> - dev_err_probe(dev, ret, "failed to create PHY\n");
> - goto err_disable_clk_ref;
> - }
> + if (IS_ERR(priv->phy))
> + return dev_err_probe(dev, PTR_ERR(priv->phy), "failed to create PHY\n");
>
> phy_set_drvdata(priv->phy, priv);
> dev_set_drvdata(dev, priv);
>
> phy_provider = devm_of_phy_provider_register(dev,
> phy_g12a_usb3_pcie_xlate);
> - if (IS_ERR(phy_provider)) {
> - ret = PTR_ERR(phy_provider);
> - goto err_disable_clk_ref;
> - }
> -
> - return 0;
> -
> -err_disable_clk_ref:
> - clk_disable_unprepare(priv->clk_ref);
> -
> - return ret;
> + return PTR_ERR_OR_ZERO(phy_provider);
> }
>
> static const struct of_device_id phy_g12a_usb3_pcie_of_match[] = {
Reviewed-by: Neil Armstrong <narmstrong@baylibre.com>
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2022-08-31 8:59 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-08-30 17:16 [PATCH] phy: amlogic: use devm_clk_get_enabled() to simplify the code Heiner Kallweit
2022-08-31 8:58 ` Neil Armstrong [this message]
2022-09-04 15:20 ` Vinod Koul
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=9bd9e5d6-462a-b72d-0bed-980f5743af09@baylibre.com \
--to=narmstrong@baylibre.com \
--cc=hkallweit1@gmail.com \
--cc=jbrunet@baylibre.com \
--cc=khilman@baylibre.com \
--cc=kishon@ti.com \
--cc=linux-amlogic@lists.infradead.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-phy@lists.infradead.org \
--cc=martin.blumenstingl@googlemail.com \
--cc=vkoul@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox