From patchwork Wed Feb 25 14:53:37 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shawn Guo X-Patchwork-Id: 45075 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-lb0-f197.google.com (mail-lb0-f197.google.com [209.85.217.197]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id A0A4320502 for ; Wed, 25 Feb 2015 14:55:45 +0000 (UTC) Received: by lbdu10 with SMTP id u10sf3306028lbd.3 for ; Wed, 25 Feb 2015 06:55:44 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:sender:precedence:list-id :x-original-sender:x-original-authentication-results:mailing-list :list-post:list-help:list-archive:list-unsubscribe; bh=yeo2CEdqrWFWRCZmIr2tlq0SRWYoE3NQO61bxKxUsX4=; b=C4mM9hp++IBtvefVsy75cQ7eNwnBXeizis6lo0GG6M75jr/S54XV6/82v+DfRVIQZ/ wYm6+lS+Xtgs1HT7e6LawM6GrVVAxCsn+uh3TQkU7b4ftP8tlIzDHdfw3HYOpR/iQnfF 0yW8n/VvrjMffCtT3YwH61YcRZc9yt4ZHeXwTbDYNk1GDr86hde+8DK1VV1ylP4S/Ufs Hm7ERaDKKQQXX9bcVubyjF+5n0j+cg0BjX1QeskN7LTOyPtL6GBrnrJPVD/um2vug9fx OqBztNnlpJjb4SRHsK01PNsoLQjHRlbvjMnTITXodWEzS0MdJvyM+6lTrIx/SGQN/oTS of1A== X-Gm-Message-State: ALoCoQl6ViCl/uxk/HYY5Ux66pvP6bpkIC9cA8Jmv5LexIkJ5MvZ1SpIS+n7+Yd1JyWBiil3VHsn X-Received: by 10.112.9.65 with SMTP id x1mr558240lba.16.1424876144569; Wed, 25 Feb 2015 06:55:44 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.22.129 with SMTP id d1ls694199laf.18.gmail; Wed, 25 Feb 2015 06:55:44 -0800 (PST) X-Received: by 10.112.215.35 with SMTP id of3mr3099612lbc.101.1424876144385; Wed, 25 Feb 2015 06:55:44 -0800 (PST) Received: from mail-lb0-f177.google.com (mail-lb0-f177.google.com. [209.85.217.177]) by mx.google.com with ESMTPS id d3si17026248laf.55.2015.02.25.06.55.44 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 25 Feb 2015 06:55:44 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.177 as permitted sender) client-ip=209.85.217.177; Received: by lbdu10 with SMTP id u10so4356808lbd.7 for ; Wed, 25 Feb 2015 06:55:44 -0800 (PST) X-Received: by 10.152.22.67 with SMTP id b3mr2981772laf.117.1424876144000; Wed, 25 Feb 2015 06:55:44 -0800 (PST) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.35.133 with SMTP id h5csp2668819lbj; Wed, 25 Feb 2015 06:55:43 -0800 (PST) X-Received: by 10.70.94.195 with SMTP id de3mr5922823pdb.59.1424876142258; Wed, 25 Feb 2015 06:55:42 -0800 (PST) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id xt17si24191169pac.212.2015.02.25.06.55.41 for ; Wed, 25 Feb 2015 06:55:42 -0800 (PST) Received-SPF: none (google.com: linux-serial-owner@vger.kernel.org does not designate permitted sender hosts) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752856AbbBYOzl (ORCPT ); Wed, 25 Feb 2015 09:55:41 -0500 Received: from mail-pa0-f46.google.com ([209.85.220.46]:39174 "EHLO mail-pa0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752516AbbBYOzk (ORCPT ); Wed, 25 Feb 2015 09:55:40 -0500 Received: by pablf10 with SMTP id lf10so5770808pab.6 for ; Wed, 25 Feb 2015 06:55:40 -0800 (PST) X-Received: by 10.70.92.3 with SMTP id ci3mr5905862pdb.147.1424876139934; Wed, 25 Feb 2015 06:55:39 -0800 (PST) Received: from localhost.localdomain (119.81.172.112-static.reverse.softlayer.com. [119.81.172.112]) by mx.google.com with ESMTPSA id nd5sm41502517pbc.64.2015.02.25.06.55.32 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 25 Feb 2015 06:55:39 -0800 (PST) From: Shawn Guo To: Mike Turquette Cc: linux-arm-kernel@lists.infradead.org, kernel@pengutronix.de, Russell King , Stephen Boyd , Thierry Reding , Greg Kroah-Hartman , Mark Brown , linux-pwm@vger.kernel.org, alsa-devel@alsa-project.org, dri-devel@lists.freedesktop.org, linux-serial@vger.kernel.org, Shawn Guo Subject: [PATCH 7/8] ASoC: fsl_spdif: fix struct clk pointer comparing Date: Wed, 25 Feb 2015 22:53:37 +0800 Message-Id: <1424876018-17852-8-git-send-email-shawn.guo@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1424876018-17852-1-git-send-email-shawn.guo@linaro.org> References: <1424876018-17852-1-git-send-email-shawn.guo@linaro.org> Sender: linux-serial-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-serial@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: shawn.guo@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.177 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , Since commit 035a61c314eb ("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 035a61c314eb 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 --- sound/soc/fsl/fsl_spdif.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sound/soc/fsl/fsl_spdif.c b/sound/soc/fsl/fsl_spdif.c index 75870c0ea2c9..91eb3aef7f02 100644 --- a/sound/soc/fsl/fsl_spdif.c +++ b/sound/soc/fsl/fsl_spdif.c @@ -1049,7 +1049,7 @@ static u32 fsl_spdif_txclk_caldiv(struct fsl_spdif_priv *spdif_priv, enum spdif_txrate index, bool round) { const u32 rate[] = { 32000, 44100, 48000, 96000, 192000 }; - bool is_sysclk = clk == spdif_priv->sysclk; + bool is_sysclk = clk_is_match(clk, spdif_priv->sysclk); u64 rate_ideal, rate_actual, sub; u32 sysclk_dfmin, sysclk_dfmax; u32 txclk_df, sysclk_df, arate; @@ -1143,7 +1143,7 @@ static int fsl_spdif_probe_txclk(struct fsl_spdif_priv *spdif_priv, spdif_priv->txclk_src[index], rate[index]); dev_dbg(&pdev->dev, "use txclk df %d for %dHz sample rate\n", spdif_priv->txclk_df[index], rate[index]); - if (spdif_priv->txclk[index] == spdif_priv->sysclk) + if (clk_is_match(spdif_priv->txclk[index], spdif_priv->sysclk)) dev_dbg(&pdev->dev, "use sysclk df %d for %dHz sample rate\n", spdif_priv->sysclk_df[index], rate[index]); dev_dbg(&pdev->dev, "the best rate for %dHz sample rate is %dHz\n",