From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from m16.mail.126.com (m16.mail.126.com [220.197.31.9]) (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 C329E23EAB2 for ; Mon, 18 May 2026 02:22:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=220.197.31.9 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779070976; cv=none; b=lfKzU8x97TEe6Njxt4zEpqrIfK1+RzfY1TzbilZzP9pmNLyf/iGq40qnoRh46c2xjaMNX2Vau4akUrcv6FlRLjLk57XFOhW0ROF6KjrQnjuuNlD1F2o8vZ1n4xhsI/+pW6ptV8KEsJdaR/dLgIRIuKhMJcA0wO4BSi78kkGawWY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779070976; c=relaxed/simple; bh=TdbD8SmFLCbbNzUOhwdM81YOLZNqTJKvogViL7B/4Sc=; h=Message-ID:Date:From:MIME-Version:To:CC:Subject:References: In-Reply-To:Content-Type; b=qtiSVKoWHH0hADa1HvvSvsOmCiGRLp3z0U5iW7yz+Bv6f9Yf1/LTyWmY7fEc3dJ25+Kzz3pSdeJ1907FUiOQx/848V8IBAjk73SpZ3ZLuPGfw/jEqY4Cti6JeX5o4J80+WSGSdF6uvngRGGrIQcJHMaKXXw22E0bqrCDwUeVyHM= 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=JSfQK7Tc; arc=none smtp.client-ip=220.197.31.9 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="JSfQK7Tc" 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=ecJGh9sj51l/ErdqcCHxr1whiXJwOHx7Ic7JRlDj/ig=; b=JSfQK7Tc6UCEGaHQGUIAE0Bf6eG1o5jd20PXFmFaAM2SM9WF0OHzGep8UH0C1F K9+LX3g/LguVQFj/SB+Gn5/5gaKmk05SMBZaiJZog3dY+NsB/4fmCg8ZoWT3HLys I/ZuOKNLSwPek1pi9SBT6ZDFNM3LbO3TW04Aq8Yr7XxK4= Received: from localhost.localdomain (unknown []) by gzga-smtp-mtada-g1-2 (Coremail) with SMTP id _____wDHbznXdwpqiJnmBg--.55635S2; Mon, 18 May 2026 10:22:15 +0800 (CST) Message-ID: <6A0A77E0.6080704@126.com> Date: Mon, 18 May 2026 10:22:24 +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: Vladimir Oltean , Hongling Zeng CC: vkoul@kernel.org, neil.armstrong@linaro.org, johan@kernel.org, kishon@kernel.org, rogerq@ti.com, linux-phy@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 2/2] phy: ti-pipe3: Fix EPROBE_DEFER handling for clock resources References: <20260515040737.28075-1-zenghongling@kylinos.cn> <20260515040737.28075-1-zenghongling@kylinos.cn> <20260515155834.zgdp3xq7cbhq66jm@skbuf> In-Reply-To: <20260515155834.zgdp3xq7cbhq66jm@skbuf> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-CM-TRANSID:_____wDHbznXdwpqiJnmBg--.55635S2 X-Coremail-Antispam: 1Uf129KBjvJXoWxAFWrGFyfuFyxGF15AF1rCrg_yoW5Kr45pF WDGa4Yya4vyrWkC3Waqr1Iq3WSyw1Ika1UWrWjg34rZ3ZxtF18uF47Kr4jgFyjkrWkCw4F y3Wjqas0ka4DZFJanT9S1TB71UUUUU7qnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDUYxBIdaVFxhVjvjDU0xZFpf9x07j4dgXUUUUU= X-CM-SenderInfo: x2kr0wpolqwiqxrzqiyswou0bp/xtbBrxcwAWoKd9cD8QAA37 在 2026年05月15日 23:58, Vladimir Oltean 写道: > On Fri, May 15, 2026 at 12:07:37PM +0800, Hongling Zeng wrote: >> 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 >> - For SATA refclk, only ignore -ENOENT (clock not found in old DTBs) >> but propagate other errors like -EPROBE_DEFER >> >> 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 >> --- >> drivers/phy/ti/phy-ti-pipe3.c | 17 ++++++++++++----- >> 1 file changed, 12 insertions(+), 5 deletions(-) >> >> diff --git a/drivers/phy/ti/phy-ti-pipe3.c b/drivers/phy/ti/phy-ti-pipe3.c >> index 58fbc3b27813..2bfcd0c70abd 100644 >> --- a/drivers/phy/ti/phy-ti-pipe3.c >> +++ b/drivers/phy/ti/phy-ti-pipe3.c >> @@ -604,15 +604,22 @@ static int ti_pipe3_get_clk(struct ti_pipe3 *phy) >> { >> struct clk *clk; >> struct device *dev = phy->dev; >> + int ret; >> >> phy->refclk = devm_clk_get(dev, "refclk"); > When phy->mode == PIPE3_MODE_SATA, I think it would be a good idea to > call devm_clk_get_optional() which converts ENOENT to 0 for you. > Otherwise call devm_clk_get(). In both cases, you can propagate the > returned error code without special-casing anything. Thank you for the review and suggestions. I've updated the patch to use devm_clk_get_optional() for SATA PHY refclk as suggested. This simplifies the error handling by automatically converting -ENOENT to NULL, allowing clean propagation of all other errors including -EPROBE_DEFER. I've also fixed the patch version numbering to v4 and ensured the patches are in the same series to avoid breaking Patchwork. Please see the attached v4 patch series. > >> if (IS_ERR(phy->refclk)) { >> - dev_err(dev, "unable to get refclk\n"); >> + ret = PTR_ERR(phy->refclk); >> /* older DTBs have missing refclk in SATA PHY >> - * so don't bail out in case of SATA PHY. >> + * so don't bail out for -ENOENT, but still defer >> + * probe for other errors like -EPROBE_DEFER. >> */ >> - if (phy->mode != PIPE3_MODE_SATA) >> - return PTR_ERR(phy->refclk); >> + if (ret == -ENOENT) { >> + if (phy->mode != PIPE3_MODE_SATA) >> + return ret; >> + } else { >> + dev_err(dev, "unable to get refclk\n"); >> + return ret; >> + } >> } >> >> if (phy->mode != PIPE3_MODE_SATA) { >> @@ -629,7 +636,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); >> } >> } >> >> -- >> 2.25.1 >> >> > Because of the broken threading this patch can't be applied anyway, so > > pw-bot: cr