From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailgw.kylinos.cn (mailgw.kylinos.cn [124.126.103.232]) (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 4C0ED25A65B for ; Fri, 17 Jan 2025 02:15:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=124.126.103.232 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737080140; cv=none; b=gTFeYsWjTIR2XHZx+HXFcfI2Oel7v1e/fCHkp24Y7l0lo5RposvSfLX1yGqMG8CNAPTsoQWI+2LqdIPY+Qj2tnJwiKr9m3GjzZmII9UtVr3eS1V0/NHu3KH4B5qbxLZAqku2MXIXG+fqgqpd+jyOkoeQmapcBB6ThUoJ9vdgbHI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737080140; c=relaxed/simple; bh=nwdGmWxjwd2xe6E9rwXPaPEmFATD0lfYORDi6gygZlk=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=h0D4TY0JNbXkNBa4Y/ZvdCsTX6cMarhem1SiAGCtB5EQcTgCBI5xwCRXOineaTTIwKlEIvwOedkZ96zVWv1qY7uxJv/CSo6pBJ8lbihmG35We66WRPqTdz5azcdO0zjhChKldnQQQ40xKpA5LEbMNSzZAHJu0uV7Is84cg6XVrk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=kylinos.cn; spf=pass smtp.mailfrom=kylinos.cn; arc=none smtp.client-ip=124.126.103.232 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=kylinos.cn Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=kylinos.cn X-UUID: ede0c582d47811efa216b1d71e6e1362-20250117 X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.45,REQID:cd5aa183-3500-4275-815d-a0e4875f5d2c,IP:0,U RL:0,TC:0,Content:0,EDM:0,RT:0,SF:0,FILE:0,BULK:0,RULE:Release_Ham,ACTION: release,TS:0 X-CID-META: VersionHash:6493067,CLOUDID:017efe4cd06208e99f718fb585452b68,BulkI D:nil,BulkQuantity:0,Recheck:0,SF:80|81|82|83|102,TC:nil,Content:0|52,EDM: -3,IP:nil,URL:0,File:nil,RT:nil,Bulk:nil,QS:nil,BEC:nil,COL:0,OSI:0,OSA:0, AV:0,LES:1,SPR:NO,DKR:0,DKP:0,BRR:0,BRE:0,ARC:0 X-CID-BVR: 1,FCT|NGT X-CID-BAS: 1,FCT|NGT,0,_ X-CID-FACTOR: TF_CID_SPAM_SNR X-UUID: ede0c582d47811efa216b1d71e6e1362-20250117 Received: from node4.com.cn [(10.44.16.170)] by mailgw.kylinos.cn (envelope-from ) (Generic MTA) with ESMTP id 1641470715; Fri, 17 Jan 2025 10:15:32 +0800 Received: from node4.com.cn (localhost [127.0.0.1]) by node4.com.cn (NSMail) with SMTP id 3AA7C16002081; Fri, 17 Jan 2025 10:15:32 +0800 (CST) X-ns-mid: postfix-6789BD44-154016647 Received: from [10.42.13.56] (unknown [10.42.13.56]) by node4.com.cn (NSMail) with ESMTPA id F3BE416002081; Fri, 17 Jan 2025 02:15:31 +0000 (UTC) Message-ID: <476dace4-92fb-4d92-a342-cffd6f77b8f1@kylinos.cn> Date: Fri, 17 Jan 2025 10:15:31 +0800 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH V5] phy: freescale: fsl-samsung-hdmi: fix build error in fsl_samsung_hdmi_phy_configure_pll_lock_det To: xiaopeitux@foxmail.com Cc: vkoul@kernel.org, linux-kernel@vger.kernel.org References: From: Pei Xiao In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable =E5=9C=A8 2025/1/17 09:59, Adam Ford =E5=86=99=E9=81=93: > On Mon, Jan 13, 2025 at 2:41=E2=80=AFAM wrote: >> From: Pei Xiao >> >> FIELD_PREP() checks that a value fits into the available bitfield, >> but the index div equals to 4,is out of range. >> >> which gcc complains about: >> In function =E2=80=98fsl_samsung_hdmi_phy_configure_pll_lock_det=E2=80= =99, >> inlined from =E2=80=98fsl_samsung_hdmi_phy_configure=E2=80=99 at >> drivers/phy/freescale/phy-fsl-samsung-hdmi.c :470:2: >> ././include/linux/compiler_types.h:542:38: error: call to =E2=80=98__c= ompiletime_assert_538=E2=80=99 >> declared with attribute error: FIELD_PREP: value too large for the fie= ld >> 542 | _compiletime_assert(condition, msg, __compiletime_assert_, >> __COUNTER__) >> | ^ >> ././include/linux/compiler_types.h:523:4: note: in definition of >> macro =E2=80=98__compiletime_assert=E2=80=99 523 | prefix ## suffix= (); >> | ^~~~~~ >> ././include/linux/compiler_types.h:542:2: note: in expansion of macro >> =E2=80=98_compiletime_assert=E2=80=99 >> 542 | _compiletime_assert(condition, msg, __compiletime_assert_, >> __COUNTER__) >> >> REG12_CK_DIV_MASK only two bit, limit div to range 0~3, >> so build error will fix. >> > LGTM. > > Reviewed-by: Adam Ford loop Vkoul for=C2=A0email address was written incorrectly. >> Fixes: d567679f2b6a ("phy: freescale: fsl-samsung-hdmi: Clean up fld_t= g_code calculation") >> Signed-off-by: Pei Xiao >> >> Changlog: >> --- >> V5: add return ret from Geert suggestion >> V4: change to use if statement >> V3: change to use do-while >> V2: change to use logical AND >> --- >> drivers/phy/freescale/phy-fsl-samsung-hdmi.c | 13 +++++++++++-- >> 1 file changed, 11 insertions(+), 2 deletions(-) >> >> diff --git a/drivers/phy/freescale/phy-fsl-samsung-hdmi.c b/drivers/ph= y/freescale/phy-fsl-samsung-hdmi.c >> index 5eac70a1e858..6817ceabaab4 100644 >> --- a/drivers/phy/freescale/phy-fsl-samsung-hdmi.c >> +++ b/drivers/phy/freescale/phy-fsl-samsung-hdmi.c >> @@ -325,7 +325,7 @@ to_fsl_samsung_hdmi_phy(struct clk_hw *hw) >> return container_of(hw, struct fsl_samsung_hdmi_phy, hw); >> } >> >> -static void >> +static int >> fsl_samsung_hdmi_phy_configure_pll_lock_det(struct fsl_samsung_hdmi_p= hy *phy, >> const struct phy_config *c= fg) >> { >> @@ -341,6 +341,9 @@ fsl_samsung_hdmi_phy_configure_pll_lock_det(struct= fsl_samsung_hdmi_phy *phy, >> break; >> } >> >> + if (unlikely(div =3D=3D 4)) >> + return -EINVAL; >> + >> writeb(FIELD_PREP(REG12_CK_DIV_MASK, div), phy->regs + PHY_REG= (12)); >> >> /* >> @@ -364,6 +367,8 @@ fsl_samsung_hdmi_phy_configure_pll_lock_det(struct= fsl_samsung_hdmi_phy *phy, >> FIELD_PREP(REG14_RP_CODE_MASK, 2) | >> FIELD_PREP(REG14_TG_CODE_HIGH_MASK, fld_tg_code >> 8), >> phy->regs + PHY_REG(14)); >> + >> + return 0; >> } >> >> static unsigned long fsl_samsung_hdmi_phy_find_pms(unsigned long fout= , u8 *p, u16 *m, u8 *s) >> @@ -467,7 +472,11 @@ static int fsl_samsung_hdmi_phy_configure(struct = fsl_samsung_hdmi_phy *phy, >> writeb(REG21_SEL_TX_CK_INV | FIELD_PREP(REG21_PMS_S_MASK, >> cfg->pll_div_regs[2] >> 4), phy->regs + PHY_REG(21)); >> >> - fsl_samsung_hdmi_phy_configure_pll_lock_det(phy, cfg); >> + ret =3D fsl_samsung_hdmi_phy_configure_pll_lock_det(phy, cfg); >> + if (ret) { >> + dev_err(phy->dev, "pixclock too large\n"); >> + return ret; >> + } >> >> writeb(REG33_FIX_DA | REG33_MODE_SET_DONE, phy->regs + PHY_REG= (33)); >> >> -- >> 2.25.1 >>