From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from m16.mail.126.com (m16.mail.126.com [117.135.210.6]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 281583E00B2 for ; Mon, 18 May 2026 08:55:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=117.135.210.6 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779094526; cv=none; b=bttq2/ut4b736sJuYMewXuASMyBNxUz1ajzn0G+fzcK9fsQI8lO/IybLjRdeDiw/fo0iWX+SM3F/oX9kJEy4I+KJAQZ7k24ToCuspBiWM2lp82aN4KHJiPOlLXaxMqQrzVMPBG/gtCasXTRDBN+8UbtpEwaBZqoyyg8BputPIsY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779094526; c=relaxed/simple; bh=lzvsEE979nodd74xn60tIkvM0NEtcZFBqaRdxIJnMlA=; h=Message-ID:Date:From:MIME-Version:To:CC:Subject:References: In-Reply-To:Content-Type; b=oXxCSZcpECpqihN2CVb5ASzNkONGAJDparAAI7BqsQ12opl4n3Z36FSSf3pv7QVRh4epLCKe49m/HpS/c4iPB8Fm9gxEhGmvtpMco98gR1ZtsbDLQ7ykUX//pOArvh0OJHoACK3ebzPlDDMQAjmT0oBNBkkBGAW6fXViE2cxRZQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=126.com; spf=pass smtp.mailfrom=126.com; dkim=pass (1024-bit key) header.d=126.com header.i=@126.com header.b=h0Zzw4oY; arc=none smtp.client-ip=117.135.210.6 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=126.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=126.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=126.com header.i=@126.com header.b="h0Zzw4oY" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=126.com; s=s110527; h=Message-ID:Date:From:MIME-Version:To:Subject: Content-Type; bh=mTxKGHWsaIt1llzqHdUN6v5bUzQJIrrj0LXN9qPguwY=; b=h0Zzw4oYBB39BQ+m3RGzgYjWgiYLvv11qOq1qEsHEOm0YwudrZiOrZUr5Ddqcj CU+mQLyFEiXqBYELTewwvw9M2sjDH1liDC4jFckPYX4k/LumZwX23xQrLMVyTnPr Tla4bQjkoR5/7ddbNngC6BW6CyBaq/BCAbVQBk+56+GhY= Received: from localhost.localdomain (unknown []) by gzga-smtp-mtada-g0-3 (Coremail) with SMTP id _____wD3zwtR0wpqbmouBw--.14701S2; Mon, 18 May 2026 16:52:33 +0800 (CST) Message-ID: <6A0AD35A.2000800@126.com> Date: Mon, 18 May 2026 16:52:42 +0800 From: Hongling Zeng User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.2.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 To: Vinod Koul , neil.armstrong@linaro.org, johan@kernel.org, kishon@kernel.org, rogerq@ti.com, sashiko-bo CC: zenghongling , 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 References: <20260518062938.48114-1-zenghongling@kylinos.cn> <20260518062938.48114-4-zenghongling@kylinos.cn> <6A0AC942.40201@126.com> In-Reply-To: <6A0AC942.40201@126.com> Content-Type: text/plain; charset=gbk; format=flowed Content-Transfer-Encoding: 8bit X-CM-TRANSID:_____wD3zwtR0wpqbmouBw--.14701S2 X-Coremail-Antispam: 1Uf129KBjvJXoWxCr48Xw1ftw1DZw1xZF15XFb_yoWruryxpF 4DJ3WYyFWvyrWkAw43Xw1Igw1Fvw1xKF4UGrW5Ww1rZ3W3tr1UGF4xKr4jgryUCFW09w4r ta4UXa4YkFyDZ3DanT9S1TB71UUUUU7qnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDUYxBIdaVFxhVjvjDU0xZFpf9x07j40PfUUUUU= X-CM-SenderInfo: x2kr0wpolqwiqxrzqiyswou0bp/xtbBrhEm9moK01HBBwAA3L -- 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 >> >> --- >> 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); >> } >> } >> >