From patchwork Wed Feb 25 14:53:34 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shawn Guo X-Patchwork-Id: 443422 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 2A74A14007D for ; Thu, 26 Feb 2015 01:55:16 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752809AbbBYOzP (ORCPT ); Wed, 25 Feb 2015 09:55:15 -0500 Received: from mail-pd0-f170.google.com ([209.85.192.170]:35993 "EHLO mail-pd0-f170.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752779AbbBYOzO (ORCPT ); Wed, 25 Feb 2015 09:55:14 -0500 Received: by pdjp10 with SMTP id p10so5406101pdj.3 for ; Wed, 25 Feb 2015 06:55:14 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=OVmFDNna2j4GqLvMgq9Zt/fMRkqabcixRvKCtrca/fs=; b=dpK2wTa2I6kuJeoWsRp0X0Z+Px0b65xOm7OcZhtW4ecM4b2qgzg8Qt1dynN50j+Scz 0UtKAIaGxgNYo7UR0DyG+m2lEIjqMqnMAv1xc6mh6GpmqfxZ8pUy+VPgLY1Tn5popEED 62TTZqDg68sLWkZVA+voRlM7D8YgriGY77UYUFyVe+HkCmMiFl3SadAI7+9qRY7aLTkQ btcFjuidlGawq/izWp+2FrO/f0T6/UuB96rKZ0fg5C5JLIf/RqRSQomMCVgPyqr4j75V IbQc774UyCRP94UdCa+NS1glfPvPgSgYuLDzNkXNwVDCi/OkCDZ8Qhc4XBqtdjiMufXf Zavg== X-Gm-Message-State: ALoCoQm+CHp/OaglHa2jUd19svIixFrbR4RFwTSmmYQBHgvhDM49g/6sCnWBphAyTqyTmsBRRSkK X-Received: by 10.70.123.40 with SMTP id lx8mr6212306pdb.42.1424876114444; Wed, 25 Feb 2015 06:55:14 -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.05 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 25 Feb 2015 06:55:13 -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 4/8] pwm: atmel-hlcdc: fix struct clk pointer comparing Date: Wed, 25 Feb 2015 22:53:34 +0800 Message-Id: <1424876018-17852-5-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-pwm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pwm@vger.kernel.org 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 Acked-by: Nicolas Ferre Acked-by: Boris Brezillon Acked-by: Thierry Reding --- drivers/pwm/pwm-atmel-hlcdc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/pwm/pwm-atmel-hlcdc.c b/drivers/pwm/pwm-atmel-hlcdc.c index 522f7075bb1a..36475949b829 100644 --- a/drivers/pwm/pwm-atmel-hlcdc.c +++ b/drivers/pwm/pwm-atmel-hlcdc.c @@ -97,7 +97,7 @@ static int atmel_hlcdc_pwm_config(struct pwm_chip *c, pwmcfg = ATMEL_HLCDC_PWMPS(pres); - if (new_clk != chip->cur_clk) { + if (!clk_is_match(new_clk, chip->cur_clk)) { u32 gencfg = 0; int ret;