From: Philipp Zabel <p.zabel@pengutronix.de>
To: Shengyang Chen <shengyang.chen@starfivetech.com>,
devicetree@vger.kernel.org, linux-phy@lists.infradead.org
Cc: vkoul@kernel.org, kishon@kernel.org, robh+dt@kernel.org,
krzysztof.kozlowski+dt@linaro.org, conor+dt@kernel.org,
minda.chen@starfivetech.com, changhuang.liang@starfivetech.com,
rogerq@kernel.org, geert+renesas@glider.be,
keith.zhao@starfivetech.com, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v1 2/2] phy: starfive: Add mipi dphy tx support
Date: Mon, 27 Nov 2023 14:17:15 +0100 [thread overview]
Message-ID: <939b96b8727054729207211f25ff91ccf8328e28.camel@pengutronix.de> (raw)
In-Reply-To: <20231117130421.79261-3-shengyang.chen@starfivetech.com>
On Fr, 2023-11-17 at 21:04 +0800, Shengyang Chen wrote:
> Add mipi dphy tx support for the StarFive JH7110 SoC.
> It is used to transfer DSI data.
>
> Signed-off-by: Shengyang Chen <shengyang.chen@starfivetech.com>
> ---
[...]
> diff --git a/drivers/phy/starfive/phy-jh7110-dphy-tx.c b/drivers/phy/starfive/phy-jh7110-dphy-tx.c
> new file mode 100644
> index 000000000000..69aa172563e4
> --- /dev/null
> +++ b/drivers/phy/starfive/phy-jh7110-dphy-tx.c
> @@ -0,0 +1,542 @@
[...]
> +static int stf_dphy_probe(struct platform_device *pdev)
> +{
[...]
> + dphy->topsys = devm_platform_ioremap_resource(pdev, 0);
> + if (IS_ERR(dphy->topsys)) {
> + ret = PTR_ERR(dphy->topsys);
> + return ret;
This could be shortened to:
return PTR_ERR(dphy->topsys);
> + }
> +
> + pm_runtime_enable(&pdev->dev);
> +
> + dphy->mipitx_0p9 = devm_regulator_get(&pdev->dev, "mipi_0p9");
> + if (IS_ERR(dphy->mipitx_0p9)) {
> + ret = PTR_ERR(dphy->mipitx_0p9);
> + return ret;
Same as above.
> + }
> +
> + dphy->txesc_clk = devm_clk_get(&pdev->dev, "dphy_txesc");
> + if (IS_ERR(dphy->txesc_clk)) {
> + ret = PTR_ERR(dphy->txesc_clk);
> + dev_err(&pdev->dev, "txesc_clk get error\n");
> + return ret;
Consider using dev_err_probe():
return dev_err_probe(&pdev->dev, PTR_ERR(dphy->txesc_clk),
"txesc_clk get error\n");
And the same for the error paths below.
> + }
> +
> + dphy->sys_rst = reset_control_get_exclusive(&pdev->dev, "dphy_sys");
Why not devm_reset_control_get_exclusive()?
> + if (IS_ERR(dphy->sys_rst)) {
> + ret = PTR_ERR(dphy->sys_rst);
> + dev_err(&pdev->dev, "sys_rst get error\n");
> + return ret;
> + }
> +
> + dphy->txbytehs_rst = reset_control_get_exclusive(&pdev->dev, "dsi_txbytehs");
Same as above.
> + if (IS_ERR(dphy->txbytehs_rst)) {
> + dev_err(&pdev->dev, "Failed to get txbytehs_rst\n");
> + return PTR_ERR(dphy->txbytehs_rst);
> + }
> +
> + dphy->phy = devm_phy_create(&pdev->dev, NULL, &stf_dphy_ops);
> + if (IS_ERR(dphy->phy)) {
> + ret = PTR_ERR(dphy->phy);
> + dev_err(&pdev->dev, "Failed to create phy\n");
> + return ret;
> + }
> + phy_set_drvdata(dphy->phy, dphy);
> +
> + phy_provider = devm_of_phy_provider_register(&pdev->dev, of_phy_simple_xlate);
> + if (IS_ERR(phy_provider)) {
> + ret = PTR_ERR(phy_provider);
> + dev_err(&pdev->dev, "Failed to create phy\n");
> + return ret;
> + }
> +
> + return PTR_ERR_OR_ZERO(phy_provider);
This can not be reached in the error case, so just:
return 0;
should suffice.
regards
Philipp
--
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy
next prev parent reply other threads:[~2023-11-27 13:17 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-17 13:04 [PATCH v1 0/2] Add JH7110 MIPI DPHY TX support Shengyang Chen
2023-11-17 13:04 ` [PATCH v1 1/2] dt-bindings: phy: Add starfive,jh7110-dphy-tx Shengyang Chen
2023-11-19 16:09 ` Rob Herring
2023-11-23 6:53 ` Shengyang Chen
2023-11-17 13:04 ` [PATCH v1 2/2] phy: starfive: Add mipi dphy tx support Shengyang Chen
2023-11-27 12:55 ` Vinod Koul
2023-12-04 7:05 ` Shengyang Chen
2023-11-27 13:17 ` Philipp Zabel [this message]
2023-12-04 7:22 ` Shengyang Chen
2023-11-30 17:30 ` kernel test robot
2023-12-04 7:31 ` Shengyang Chen
2023-11-30 18:04 ` kernel test robot
2023-12-04 16:26 ` kernel test robot
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=939b96b8727054729207211f25ff91ccf8328e28.camel@pengutronix.de \
--to=p.zabel@pengutronix.de \
--cc=changhuang.liang@starfivetech.com \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=geert+renesas@glider.be \
--cc=keith.zhao@starfivetech.com \
--cc=kishon@kernel.org \
--cc=krzysztof.kozlowski+dt@linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-phy@lists.infradead.org \
--cc=minda.chen@starfivetech.com \
--cc=robh+dt@kernel.org \
--cc=rogerq@kernel.org \
--cc=shengyang.chen@starfivetech.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