Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753302AbbBYTlP (ORCPT ); Wed, 25 Feb 2015 14:41:15 -0500 Received: from mail-ob0-f172.google.com ([209.85.214.172]:41357 "EHLO mail-ob0-f172.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752748AbbBYTlO convert rfc822-to-8bit (ORCPT ); Wed, 25 Feb 2015 14:41:14 -0500 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8BIT To: Krzysztof Kozlowski , "Stephen Boyd" , linux-kernel@vger.kernel.org From: Mike Turquette In-Reply-To: <1420792090-14174-1-git-send-email-k.kozlowski@samsung.com> Cc: "Krzysztof Kozlowski" References: <1420792090-14174-1-git-send-email-k.kozlowski@samsung.com> Message-ID: <20150225194058.421.42458@quantum> User-Agent: alot/0.3.5 Subject: Re: [PATCH] clk: Use lockdep asserts to find missing hold of prepare_lock Date: Wed, 25 Feb 2015 11:40:58 -0800 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2838 Lines: 92 Quoting Krzysztof Kozlowski (2015-01-09 00:28:10) > Add lockdep asserts for holding the prepare_lock to all functions > marking this as a requirement in description. Add this to private and > exported functions so all locking misuse could be detected during > debugging. > > Signed-off-by: Krzysztof Kozlowski Applied. Thanks, Mike > --- > drivers/clk/clk.c | 14 ++++++++++++++ > 1 file changed, 14 insertions(+) > > diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c > index f4963b7d4e17..cdbfaa34ace4 100644 > --- a/drivers/clk/clk.c > +++ b/drivers/clk/clk.c > @@ -432,6 +432,8 @@ static void clk_unprepare_unused_subtree(struct clk *clk) > { > struct clk *child; > > + lockdep_assert_held(&prepare_lock); > + > if (!clk) > return; > > @@ -458,6 +460,8 @@ static void clk_disable_unused_subtree(struct clk *clk) > struct clk *child; > unsigned long flags; > > + lockdep_assert_held(&prepare_lock); > + > if (!clk) > goto out; > > @@ -947,6 +951,8 @@ unsigned long __clk_round_rate(struct clk *clk, unsigned long rate) > struct clk *parent; > struct clk_hw *parent_hw; > > + lockdep_assert_held(&prepare_lock); > + > if (!clk) > return 0; > > @@ -1040,6 +1046,8 @@ static void __clk_recalc_accuracies(struct clk *clk) > unsigned long parent_accuracy = 0; > struct clk *child; > > + lockdep_assert_held(&prepare_lock); > + > if (clk->parent) > parent_accuracy = clk->parent->accuracy; > > @@ -1104,6 +1112,8 @@ static void __clk_recalc_rates(struct clk *clk, unsigned long msg) > unsigned long parent_rate = 0; > struct clk *child; > > + lockdep_assert_held(&prepare_lock); > + > old_rate = clk->rate; > > if (clk->parent) > @@ -1297,6 +1307,8 @@ static int __clk_speculate_rates(struct clk *clk, unsigned long parent_rate) > unsigned long new_rate; > int ret = NOTIFY_DONE; > > + lockdep_assert_held(&prepare_lock); > + > new_rate = clk_recalc(clk, parent_rate); > > /* abort rate change if a driver returns NOTIFY_BAD or NOTIFY_STOP */ > @@ -2110,6 +2122,8 @@ static void __clk_release(struct kref *ref) > struct clk *clk = container_of(ref, struct clk, ref); > int i = clk->num_parents; > > + lockdep_assert_held(&prepare_lock); > + > kfree(clk->parents); > while (--i >= 0) > kfree(clk->parent_names[i]); > -- > 1.9.1 > -- 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/