Skip to content

Commit 81efec8

Browse files
shawnguo2bebarino
authored andcommitted
ASoC: fsl_spdif: fix struct clk pointer comparing
Since commit 035a61c ("clk: Make clk API return per-user struct clk instances"), clk API users can no longer check if two struct clk pointers are pointing to the same hardware clock, i.e. struct clk_hw, by simply comparing two pointers. That's because with the per-user clk change, a brand new struct clk is created whenever clients try to look up the clock by calling clk_get() or sister functions like clk_get_sys() and of_clk_get(). This changes the original behavior where the struct clk is only created for once when clock driver registers the clock to CCF in the first place. The net change here is before commit 035a61c the struct clk pointer is unique for given hardware clock, while after the commit the pointers returned by clk lookup calls become different for the same hardware clock. That said, the struct clk pointer comparing in the code doesn't work any more. Call helper function clk_is_match() instead to fix the problem. Signed-off-by: Shawn Guo <shawn.guo@linaro.org> Signed-off-by: Michael Turquette <mturquette@linaro.org> Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
1 parent a51139f commit 81efec8

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

sound/soc/fsl/fsl_spdif.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1049,7 +1049,7 @@ static u32 fsl_spdif_txclk_caldiv(struct fsl_spdif_priv *spdif_priv,
10491049
enum spdif_txrate index, bool round)
10501050
{
10511051
const u32 rate[] = { 32000, 44100, 48000, 96000, 192000 };
1052-
bool is_sysclk = clk == spdif_priv->sysclk;
1052+
bool is_sysclk = clk_is_match(clk, spdif_priv->sysclk);
10531053
u64 rate_ideal, rate_actual, sub;
10541054
u32 sysclk_dfmin, sysclk_dfmax;
10551055
u32 txclk_df, sysclk_df, arate;
@@ -1143,7 +1143,7 @@ static int fsl_spdif_probe_txclk(struct fsl_spdif_priv *spdif_priv,
11431143
spdif_priv->txclk_src[index], rate[index]);
11441144
dev_dbg(&pdev->dev, "use txclk df %d for %dHz sample rate\n",
11451145
spdif_priv->txclk_df[index], rate[index]);
1146-
if (spdif_priv->txclk[index] == spdif_priv->sysclk)
1146+
if (clk_is_match(spdif_priv->txclk[index], spdif_priv->sysclk))
11471147
dev_dbg(&pdev->dev, "use sysclk df %d for %dHz sample rate\n",
11481148
spdif_priv->sysclk_df[index], rate[index]);
11491149
dev_dbg(&pdev->dev, "the best rate for %dHz sample rate is %dHz\n",

0 commit comments

Comments
 (0)