From: Hongling Zeng <zhongling0719@126.com>
To: Vinod Koul <vkoul@kernel.org>,
neil.armstrong@linaro.org, johan@kernel.org, kishon@kernel.org,
rogerq@ti.com, sashiko-bo <sashiko-bot@kernel.org>
Cc: zenghongling <zenghongling@kylinos.cn>,
linux-phy@lists.infradead.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v5 3/4] phy: ti-pipe3: Fix EPROBE_DEFER handling for clock resources
Date: Mon, 18 May 2026 16:52:42 +0800 [thread overview]
Message-ID: <6A0AD35A.2000800@126.com> (raw)
In-Reply-To: <6A0AC942.40201@126.com>
--
Sashiko AI review ·https://sashiko.dev/#/patchset/20260518062938.48114-1-zenghongling@kylinos.cn?part=3
--
Hi,
Resend to fix threading / delivery issues.
Thank you for the review. You raise a valid point about using dev_err_probe()
to avoid dmesg spam during probe deferral.
I've kept dev_err() in this patch to maintain consistency with the existing
code style and focus on the core EPROBE_DEFER fixes. However, I agree that
dev_err_probe() would be better and can submit a follow-up cleanup patch to
address the logging improvement.
Does this approach work for you, or would you prefer I include the dev_err_probe()
change in this series?
Best regards,
Hongling
在 2026年05月18日 16:09, Hongling Zeng 写道:
> --
> Sashiko AI review ·https://sashiko.dev/#/patchset/20260518062938.48114-1-zenghongling@kylinos.cn?part=3
>
> --
> Hi,
>
> Thank you for the review. You raise a valid point about using dev_err_probe()
> to avoid dmesg spam during probe deferral.
>
> I've kept dev_err() in this patch to maintain consistency with the existing
> code style and focus on the core EPROBE_DEFER fixes. However, I agree that
> dev_err_probe() would be better and can submit a follow-up cleanup patch to
> address the logging improvement.
>
> Does this approach work for you, or would you prefer I include the dev_err_probe()
> change in this series?
>
> Best regards,
> Hongling
>
>
> 在 2026年05月18日 14:29, Hongling Zeng 写道:
>> ti_pipe3_get_clk() has two issues with -EPROBE_DEFER error handling:
>>
>> 1. When devm_clk_get() for sysclk fails, the function returns -EINVAL
>> instead of propagating the actual error code. This masks -EPROBE_DEFER
>> to -EINVAL, breaking the probe deferral mechanism and causing permanent
>> driver initialization failure on systems with non-deterministic probe
>> ordering.
>>
>> 2. For SATA PHY refclk, the function ignores all errors to support older
>> DTBs missing the refclk property. However, this incorrectly ignores
>> -EPROBE_DEFER as well, causing the driver to proceed without waiting
>> for the clock provider to become available.
>>
>> Fix both issues:
>> - Return PTR_ERR(phy->sys_clk) instead of -EINVAL to propagate all
>> error codes including -EPROBE_DEFER
>> - Use devm_clk_get_optional() for SATA refclk to handle optional
>> clocks while propagating -EPROBE_DEFER and other errors
>>
>> Fixes: a70143bbef6b ("drivers: phy: usb3/pipe3: Adapt pipe3 driver to Generic PHY Framework")
>> Fixes: 7f33912d2978 ("phy: ti-pipe3: Fix SATA across suspend/resume")
>> Signed-off-by: Hongling Zeng<zenghongling@kylinos.cn>
>>
>> ---
>> Change in v4:
>> - Merge refclk leak fix and EPROBE_DEFER fix into a single patch
>> - Use devm_clk_get_optional() for SATA refclk
>> - Drop manual -ENOENT handling
>> - Ensure error paths are fully symmetric
>> ---
>> Change in v5:
>> -Add Fix ignored clock enable return value in init patch
>> ---
>> drivers/phy/ti/phy-ti-pipe3.c | 20 +++++++++++++-------
>> 1 file changed, 13 insertions(+), 7 deletions(-)
>>
>> diff --git a/drivers/phy/ti/phy-ti-pipe3.c b/drivers/phy/ti/phy-ti-pipe3.c
>> index 2d36fe4c4218..9ec228c2a940 100644
>> --- a/drivers/phy/ti/phy-ti-pipe3.c
>> +++ b/drivers/phy/ti/phy-ti-pipe3.c
>> @@ -608,14 +608,20 @@ static int ti_pipe3_get_clk(struct ti_pipe3 *phy)
>> struct clk *clk;
>> struct device *dev = phy->dev;
>>
>> - phy->refclk = devm_clk_get(dev, "refclk");
>> + /*
>> + * refclk is optional for SATA PHY to support older DTBs, but
>> + * required for other modes. Use devm_clk_get_optional() for SATA
>> + * which returns NULL for -ENOENT, allowing us to propagate all
>> + * other errors including -EPROBE_DEFER.
>> + */
>> + if (phy->mode == PIPE3_MODE_SATA)
>> + phy->refclk = devm_clk_get_optional(dev, "refclk");
>> + else
>> + phy->refclk = devm_clk_get(dev, "refclk");
>> +
>> if (IS_ERR(phy->refclk)) {
>> dev_err(dev, "unable to get refclk\n");
>> - /* older DTBs have missing refclk in SATA PHY
>> - * so don't bail out in case of SATA PHY.
>> - */
>> - if (phy->mode != PIPE3_MODE_SATA)
>> - return PTR_ERR(phy->refclk);
>> + return PTR_ERR(phy->refclk);
>> }
>>
>> if (phy->mode != PIPE3_MODE_SATA) {
>> @@ -632,7 +638,7 @@ static int ti_pipe3_get_clk(struct ti_pipe3 *phy)
>> phy->sys_clk = devm_clk_get(dev, "sysclk");
>> if (IS_ERR(phy->sys_clk)) {
>> dev_err(dev, "unable to get sysclk\n");
>> - return -EINVAL;
>> + return PTR_ERR(phy->sys_clk);
>> }
>> }
>>
>
--
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy
WARNING: multiple messages have this Message-ID (diff)
From: Hongling Zeng <zhongling0719@126.com>
To: Vinod Koul <vkoul@kernel.org>,
neil.armstrong@linaro.org, johan@kernel.org, kishon@kernel.org,
rogerq@ti.com, sashiko-bo <sashiko-bot@kernel.org>
Cc: zenghongling <zenghongling@kylinos.cn>,
linux-phy@lists.infradead.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v5 3/4] phy: ti-pipe3: Fix EPROBE_DEFER handling for clock resources
Date: Mon, 18 May 2026 16:52:42 +0800 [thread overview]
Message-ID: <6A0AD35A.2000800@126.com> (raw)
In-Reply-To: <6A0AC942.40201@126.com>
--
Sashiko AI review ·https://sashiko.dev/#/patchset/20260518062938.48114-1-zenghongling@kylinos.cn?part=3
--
Hi,
Resend to fix threading / delivery issues.
Thank you for the review. You raise a valid point about using dev_err_probe()
to avoid dmesg spam during probe deferral.
I've kept dev_err() in this patch to maintain consistency with the existing
code style and focus on the core EPROBE_DEFER fixes. However, I agree that
dev_err_probe() would be better and can submit a follow-up cleanup patch to
address the logging improvement.
Does this approach work for you, or would you prefer I include the dev_err_probe()
change in this series?
Best regards,
Hongling
在 2026年05月18日 16:09, Hongling Zeng 写道:
> --
> Sashiko AI review ·https://sashiko.dev/#/patchset/20260518062938.48114-1-zenghongling@kylinos.cn?part=3
>
> --
> Hi,
>
> Thank you for the review. You raise a valid point about using dev_err_probe()
> to avoid dmesg spam during probe deferral.
>
> I've kept dev_err() in this patch to maintain consistency with the existing
> code style and focus on the core EPROBE_DEFER fixes. However, I agree that
> dev_err_probe() would be better and can submit a follow-up cleanup patch to
> address the logging improvement.
>
> Does this approach work for you, or would you prefer I include the dev_err_probe()
> change in this series?
>
> Best regards,
> Hongling
>
>
> 在 2026年05月18日 14:29, Hongling Zeng 写道:
>> ti_pipe3_get_clk() has two issues with -EPROBE_DEFER error handling:
>>
>> 1. When devm_clk_get() for sysclk fails, the function returns -EINVAL
>> instead of propagating the actual error code. This masks -EPROBE_DEFER
>> to -EINVAL, breaking the probe deferral mechanism and causing permanent
>> driver initialization failure on systems with non-deterministic probe
>> ordering.
>>
>> 2. For SATA PHY refclk, the function ignores all errors to support older
>> DTBs missing the refclk property. However, this incorrectly ignores
>> -EPROBE_DEFER as well, causing the driver to proceed without waiting
>> for the clock provider to become available.
>>
>> Fix both issues:
>> - Return PTR_ERR(phy->sys_clk) instead of -EINVAL to propagate all
>> error codes including -EPROBE_DEFER
>> - Use devm_clk_get_optional() for SATA refclk to handle optional
>> clocks while propagating -EPROBE_DEFER and other errors
>>
>> Fixes: a70143bbef6b ("drivers: phy: usb3/pipe3: Adapt pipe3 driver to Generic PHY Framework")
>> Fixes: 7f33912d2978 ("phy: ti-pipe3: Fix SATA across suspend/resume")
>> Signed-off-by: Hongling Zeng<zenghongling@kylinos.cn>
>>
>> ---
>> Change in v4:
>> - Merge refclk leak fix and EPROBE_DEFER fix into a single patch
>> - Use devm_clk_get_optional() for SATA refclk
>> - Drop manual -ENOENT handling
>> - Ensure error paths are fully symmetric
>> ---
>> Change in v5:
>> -Add Fix ignored clock enable return value in init patch
>> ---
>> drivers/phy/ti/phy-ti-pipe3.c | 20 +++++++++++++-------
>> 1 file changed, 13 insertions(+), 7 deletions(-)
>>
>> diff --git a/drivers/phy/ti/phy-ti-pipe3.c b/drivers/phy/ti/phy-ti-pipe3.c
>> index 2d36fe4c4218..9ec228c2a940 100644
>> --- a/drivers/phy/ti/phy-ti-pipe3.c
>> +++ b/drivers/phy/ti/phy-ti-pipe3.c
>> @@ -608,14 +608,20 @@ static int ti_pipe3_get_clk(struct ti_pipe3 *phy)
>> struct clk *clk;
>> struct device *dev = phy->dev;
>>
>> - phy->refclk = devm_clk_get(dev, "refclk");
>> + /*
>> + * refclk is optional for SATA PHY to support older DTBs, but
>> + * required for other modes. Use devm_clk_get_optional() for SATA
>> + * which returns NULL for -ENOENT, allowing us to propagate all
>> + * other errors including -EPROBE_DEFER.
>> + */
>> + if (phy->mode == PIPE3_MODE_SATA)
>> + phy->refclk = devm_clk_get_optional(dev, "refclk");
>> + else
>> + phy->refclk = devm_clk_get(dev, "refclk");
>> +
>> if (IS_ERR(phy->refclk)) {
>> dev_err(dev, "unable to get refclk\n");
>> - /* older DTBs have missing refclk in SATA PHY
>> - * so don't bail out in case of SATA PHY.
>> - */
>> - if (phy->mode != PIPE3_MODE_SATA)
>> - return PTR_ERR(phy->refclk);
>> + return PTR_ERR(phy->refclk);
>> }
>>
>> if (phy->mode != PIPE3_MODE_SATA) {
>> @@ -632,7 +638,7 @@ static int ti_pipe3_get_clk(struct ti_pipe3 *phy)
>> phy->sys_clk = devm_clk_get(dev, "sysclk");
>> if (IS_ERR(phy->sys_clk)) {
>> dev_err(dev, "unable to get sysclk\n");
>> - return -EINVAL;
>> + return PTR_ERR(phy->sys_clk);
>> }
>> }
>>
>
next prev parent reply other threads:[~2026-05-18 8:53 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-18 6:29 [PATCH v5 0/4] phy: ti-pipe3: Fix clock resource handling issues Hongling Zeng
2026-05-18 6:29 ` Hongling Zeng
2026-05-18 6:29 ` [PATCH v5 1/4] phy: ti-pipe3: Fix ignored clock enable return value in init Hongling Zeng
2026-05-18 6:29 ` Hongling Zeng
2026-05-18 6:29 ` [PATCH v5 2/4] phy: ti: pipe3: Fix clock resource leak on probe errors Hongling Zeng
2026-05-18 6:29 ` Hongling Zeng
2026-05-18 6:29 ` [PATCH v5 3/4] phy: ti-pipe3: Fix EPROBE_DEFER handling for clock resources Hongling Zeng
2026-05-18 6:29 ` Hongling Zeng
2026-05-18 7:26 ` sashiko-bot
[not found] ` <6A0AC942.40201@126.com>
2026-05-18 8:52 ` Hongling Zeng [this message]
2026-05-18 8:52 ` Hongling Zeng
2026-05-18 6:29 ` [PATCH v5 4/4] phy: ti-pipe3: Fix clock leak in init error path Hongling Zeng
2026-05-18 6:29 ` Hongling Zeng
2026-05-18 7:48 ` sashiko-bot
2026-05-18 8:44 ` Hongling Zeng
2026-05-18 8:44 ` Hongling Zeng
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=6A0AD35A.2000800@126.com \
--to=zhongling0719@126.com \
--cc=johan@kernel.org \
--cc=kishon@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-phy@lists.infradead.org \
--cc=neil.armstrong@linaro.org \
--cc=rogerq@ti.com \
--cc=sashiko-bot@kernel.org \
--cc=vkoul@kernel.org \
--cc=zenghongling@kylinos.cn \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.