From: Adam Ford Date: Sat, 26 Oct 2024 13:19:58 +0000 (-0500) Subject: phy: freescale: fsl-samsung-hdmi: Stop searching when exact match is found X-Git-Tag: v6.14-rc1~42^2~16 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=1b9b8b159601d174526ce1c3a62ebe3a7286003b;p=thirdparty%2Flinux.git phy: freescale: fsl-samsung-hdmi: Stop searching when exact match is found There are a series of for-loops which check various values of P and S for the integer divder PLL. The for loops search all entries and use the one closest to the nominal, but it continues to searches through all for loops even after the nominal is achieved. Ending when the nominal value is found stops wasting time, since it will not find a better value than a deviation of 0 Hz. Signed-off-by: Adam Ford Reviewed-by: Frieder Schrempf Link: https://lore.kernel.org/r/20241026132014.73050-2-aford173@gmail.com Signed-off-by: Vinod Koul --- diff --git a/drivers/phy/freescale/phy-fsl-samsung-hdmi.c b/drivers/phy/freescale/phy-fsl-samsung-hdmi.c index 412c03b7dcd69..121f67455cec1 100644 --- a/drivers/phy/freescale/phy-fsl-samsung-hdmi.c +++ b/drivers/phy/freescale/phy-fsl-samsung-hdmi.c @@ -440,9 +440,13 @@ static unsigned long fsl_samsung_hdmi_phy_find_pms(unsigned long fout, u8 *p, u1 min_delta = delta; best_freq = tmp; } + + /* If we have an exact match, stop looking for a better value */ + if (!delta) + goto done; } } - +done: if (best_freq) { *p = best_p; *m = best_m;