From: Chunfeng Yun <chunfeng.yun@mediatek.com>
To: AngeloGioacchino Del Regno
<angelogioacchino.delregno@collabora.com>,
<chunkuang.hu@kernel.org>
Cc: linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org,
kishon@ti.com, linux-phy@lists.infradead.org, vkoul@kernel.org,
linux-mediatek@lists.infradead.org, matthias.bgg@gmail.com,
linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH 3/3] phy: mediatek: phy-mtk-mipi-dsi: Simplify with dev_err_probe()
Date: Fri, 14 Jan 2022 13:32:02 +0800 [thread overview]
Message-ID: <6e75de8187b276f54c8673ccd708b299614bc5c3.camel@mediatek.com> (raw)
In-Reply-To: <ba6c0163-fc5f-2a5f-560d-240e5fe2c3c4@collabora.com>
On Fri, 2022-01-07 at 10:23 +0100, AngeloGioacchino Del Regno wrote:
> Il 06/01/22 10:13, Chunfeng Yun ha scritto:
> > On Mon, 2022-01-03 at 15:53 +0100, AngeloGioacchino Del Regno
> > wrote:
> > > Use the dev_err_probe() helper to simplify error handling during
> > > probe.
> > >
> > > Signed-off-by: AngeloGioacchino Del Regno <
> > > angelogioacchino.delregno@collabora.com>
> > > ---
> > > drivers/phy/mediatek/phy-mtk-mipi-dsi.c | 29 +++++++++---------
> > > ---
> > > ----
> > > 1 file changed, 10 insertions(+), 19 deletions(-)
> > >
> > > diff --git a/drivers/phy/mediatek/phy-mtk-mipi-dsi.c
> > > b/drivers/phy/mediatek/phy-mtk-mipi-dsi.c
> > > index 6f7425b0bf5b..4b77508f5241 100644
> > > --- a/drivers/phy/mediatek/phy-mtk-mipi-dsi.c
> > > +++ b/drivers/phy/mediatek/phy-mtk-mipi-dsi.c
> > > @@ -148,11 +148,9 @@ static int mtk_mipi_tx_probe(struct
> > > platform_device *pdev)
> > > return PTR_ERR(mipi_tx->regmap);
> > >
> > > ref_clk = devm_clk_get(dev, NULL);
> > > - if (IS_ERR(ref_clk)) {
> > > - ret = PTR_ERR(ref_clk);
> > > - dev_err(dev, "Failed to get reference clock: %d\n",
> > > ret);
> > > - return ret;
> > > - }
> > > + if (IS_ERR(ref_clk))
> > > + return dev_err_probe(dev, PTR_ERR(ref_clk),
> > > + "Failed to get reference
> > > clock\n");
> > >
> > > ret = of_property_read_u32(dev->of_node, "drive-
> > > strength-
> > > microamp",
> > > &mipi_tx->mipitx_drive);
> > > @@ -172,27 +170,20 @@ static int mtk_mipi_tx_probe(struct
> > > platform_device *pdev)
> > >
> > > ret = of_property_read_string(dev->of_node, "clock-
> > > output-
> > > names",
> > > &clk_init.name);
> > > - if (ret < 0) {
> > > - dev_err(dev, "Failed to read clock-output-names: %d\n",
> > > ret);
> > > - return ret;
> > > - }
> > > + if (ret < 0)
> > > + return dev_err_probe(dev, ret, "Failed to read clock-
> > > output-names\n");
> >
> > Seems no need change it here. (no EPROBE_DEFER error)
> >
>
> Hello Chunfeng,
>
> pasting from kernel driver-api infrastructure guidelines:
>
> [...]Note that it is deemed acceptable to use this function for error
> prints during
> probe even if the err is known to never be -EPROBE_DEFER. The benefit
> compared to a
> normal dev_err() is the standardized format of the error code and the
> fact that the
> error code is returned.
>
> https://www.kernel.org/doc/html/latest/driver-api/infrastructure.html
>
Got it, thanks a lot:)
> Regards,
> - Angelo
>
> > Thanks
> > >
> > > clk_init.ops = mipi_tx->driver_data->mipi_tx_clk_ops;
> > >
> > > mipi_tx->pll_hw.init = &clk_init;
> > > mipi_tx->pll = devm_clk_register(dev, &mipi_tx-
> > > >pll_hw);
> > > - if (IS_ERR(mipi_tx->pll)) {
> > > - ret = PTR_ERR(mipi_tx->pll);
> > > - dev_err(dev, "Failed to register PLL: %d\n", ret);
> > > - return ret;
> > > - }
> > > + if (IS_ERR(mipi_tx->pll))
> > > + return dev_err_probe(dev, PTR_ERR(mipi_tx->pll),
> > > "Cannot register PLL\n");
> > >
> > > phy = devm_phy_create(dev, NULL, &mtk_mipi_tx_ops);
> > > - if (IS_ERR(phy)) {
> > > - ret = PTR_ERR(phy);
> > > - dev_err(dev, "Failed to create MIPI D-PHY: %d\n", ret);
> > > - return ret;
> > > - }
> > > + if (IS_ERR(phy))
> > > + return dev_err_probe(dev, PTR_ERR(phy), "Failed to
> > > create MIPI D-PHY\n");
> > > +
> > > phy_set_drvdata(phy, mipi_tx);
> > >
> > > phy_provider = devm_of_phy_provider_register(dev,
> > > of_phy_simple_xlate);
>
>
next prev parent reply other threads:[~2022-01-14 5:32 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-01-03 14:53 [PATCH 1/3] phy: mediatek: phy-mtk-mipi-dsi: Switch to regmap for mmio access AngeloGioacchino Del Regno
2022-01-03 14:53 ` [PATCH 2/3] phy: mediatek: phy-mtk-mipi-dsi: Reorder and stop implicit header inclusion AngeloGioacchino Del Regno
2022-01-06 8:38 ` Chunfeng Yun
2022-01-07 3:57 ` Chen-Yu Tsai
2022-01-03 14:53 ` [PATCH 3/3] phy: mediatek: phy-mtk-mipi-dsi: Simplify with dev_err_probe() AngeloGioacchino Del Regno
2022-01-06 9:13 ` Chunfeng Yun
2022-01-07 9:23 ` AngeloGioacchino Del Regno
2022-01-14 5:32 ` Chunfeng Yun [this message]
2022-01-06 8:24 ` [PATCH 1/3] phy: mediatek: phy-mtk-mipi-dsi: Switch to regmap for mmio access Chunfeng Yun
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=6e75de8187b276f54c8673ccd708b299614bc5c3.camel@mediatek.com \
--to=chunfeng.yun@mediatek.com \
--cc=angelogioacchino.delregno@collabora.com \
--cc=chunkuang.hu@kernel.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=kishon@ti.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mediatek@lists.infradead.org \
--cc=linux-phy@lists.infradead.org \
--cc=matthias.bgg@gmail.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;
as well as URLs for NNTP newsgroup(s).