From patchwork Thu May 7 10:31:39 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Magnus Damm X-Patchwork-Id: 22299 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n47AYSfs030799 for ; Thu, 7 May 2009 10:34:28 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751521AbZEGKe0 (ORCPT ); Thu, 7 May 2009 06:34:26 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1753471AbZEGKe0 (ORCPT ); Thu, 7 May 2009 06:34:26 -0400 Received: from rv-out-0506.google.com ([209.85.198.231]:29976 "EHLO rv-out-0506.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751521AbZEGKeZ (ORCPT ); Thu, 7 May 2009 06:34:25 -0400 Received: by rv-out-0506.google.com with SMTP id f9so542485rvb.1 for ; Thu, 07 May 2009 03:34:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:from:to:cc:date:message-id :subject; bh=6ED3dNFkfg1zn+/ace0uWNzKV8Zjrbbyy6uRtLpiiCg=; b=blURWOGaonmt0OXDhjuBBXuk67zVPI7+ivSJGyFETWI3d6NsPqh0qoOpV1zsWQGomQ I5e7NoXkeyI4PpX13PdRkRUN5cF6kgqzDQ3uCMaJIYP8VUrXleKQdbW6b/pKHm6GiOEI ULUyXOXzb5Wyj1i3qdlXnlAqfUaatanpGEHA0= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:cc:date:message-id:subject; b=SixJUkzxy3czMR8RpMwH8Frz/xa5XVkANBYb6x3X+PXJYdcsYOnjGPbmYbkmIP85Nr i2pY8+sq7wMdqrR+ebvO1kCspygaTdhnv1H+MMxlcdI+8bjmK07HDNh5Mq61oH+8qERX 7KXBIp84j+3f1rrJ3bWhLANkS1MK8MOT9FlYI= Received: by 10.115.60.1 with SMTP id n1mr2291428wak.113.1241692465840; Thu, 07 May 2009 03:34:25 -0700 (PDT) Received: from rx1.opensource.se (210.5.32.202.bf.2iij.net [202.32.5.210]) by mx.google.com with ESMTPS id n6sm14647046wag.39.2009.05.07.03.34.23 (version=TLSv1/SSLv3 cipher=RC4-MD5); Thu, 07 May 2009 03:34:24 -0700 (PDT) From: Magnus Damm To: linux-sh@vger.kernel.org Cc: Magnus Damm , lethal@linux-sh.org Date: Thu, 07 May 2009 19:31:39 +0900 Message-Id: <20090507103139.31790.67489.sendpatchset@rx1.opensource.se> Subject: [PATCH] sh: call clock framework init() callback once Sender: linux-sh-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-sh@vger.kernel.org From: Magnus Damm Make sure that clk->ops->init() only gets called once in the case of CLK_ALWAYS_ENABLED. Without this patch the init() callback may be called multiple times. Signed-off-by: Magnus Damm --- arch/sh/kernel/cpu/clock.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe linux-sh" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html --- 0001/arch/sh/kernel/cpu/clock.c +++ work/arch/sh/kernel/cpu/clock.c 2009-05-07 15:00:52.000000000 +0900 @@ -99,15 +99,18 @@ static int __clk_enable(struct clk *clk) * changes and the clock needs to hunt for the proper set of * divisors to use before it can effectively recalc. */ + + if (clk->flags & CLK_ALWAYS_ENABLED) { + kref_get(&clk->kref); + return 0; + } + if (unlikely(atomic_read(&clk->kref.refcount) == 1)) if (clk->ops && clk->ops->init) clk->ops->init(clk); kref_get(&clk->kref); - if (clk->flags & CLK_ALWAYS_ENABLED) - return 0; - if (likely(clk->ops && clk->ops->enable)) clk->ops->enable(clk);