Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752853Ab1BDNV0 (ORCPT ); Fri, 4 Feb 2011 08:21:26 -0500 Received: from caramon.arm.linux.org.uk ([78.32.30.218]:51112 "EHLO caramon.arm.linux.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752286Ab1BDNVZ (ORCPT ); Fri, 4 Feb 2011 08:21:25 -0500 Date: Fri, 4 Feb 2011 13:20:40 +0000 From: Russell King - ARM Linux To: Richard Zhao Cc: Jeremy Kerr , Nicolas Pitre , Lorenzo Pieralisi , Saravana Kannan , linux-sh@vger.kernel.org, Ben Herrenschmidt , Sascha Hauer , Paul Mundt , linux-kernel@vger.kernel.org, Dima Zavin , Ben Dooks , Uwe =?iso-8859-1?Q?Kleine-K=F6nig?= , Vincent Guittot , linux-arm-kernel@lists.infradead.org Subject: Re: Locking in the clk API, part 2: clk_prepare/clk_unprepare Message-ID: <20110204132040.GI14627@n2100.arm.linux.org.uk> References: <201102011711.31258.jeremy.kerr@canonical.com> <20110204124534.GA2597@richard-laptop> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20110204124534.GA2597@richard-laptop> User-Agent: Mutt/1.5.19 (2009-01-05) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1073 Lines: 36 On Fri, Feb 04, 2011 at 08:45:34PM +0800, Richard Zhao wrote: > > == Implementation == > > > > Basically: > > > > struct clk { > > const struct clk_ops *ops > > int enable_count; > > spinlock_t enable_lock; > > int prepare_count; > > struct mutex prepare_lock; > > }; > > > > int clk_enable(struct clk *clk) > > { > > int ret = 0; > > > > spin_lock(&clk->enable_lock); > > if (!clk->enable_count) > > ret = clk->ops->enable(clk); > > > > if (!ret) > > clk->enable_count++; > > spin_unlock(&clk->enable_lock); > > > > return ret; > > } > Why do we not call parent's clk_enable in this function? For flexible? How many > different cases is causing us to move the effert to platform clock driver? You may notice that struct clk above doesn't have a parent. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/