All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stephen Boyd <sboyd@codeaurora.org>
To: linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH v2] clk: let clk_disable() return immediately if clk is NULL or error
Date: Sat, 16 Apr 2016 00:04:43 +0000	[thread overview]
Message-ID: <20160416000443.GA26353@codeaurora.org> (raw)
In-Reply-To: <CAK7LNARbzRLq_NGWJ8CFBBf6w4cVGCNh45fo6JO=+F7FACBSxA@mail.gmail.com>

On 04/14, Masahiro Yamada wrote:
> 
> OK, now I notice another problem in my code;
> if foo_clk_init() fails for reason [2],
> clk_disable() WARN's due to zero enable_count.
> 
> if (WARN_ON(core->enable_count = 0))
>          return;
> 
> 
> 
> Perhaps, I got screwed up by splitting clock init stuff
> into a helper function.

Yep! Can't we just split the enable/disable out into another
function separate from the clk_get/put part? That would make
things more symmetric and avoid this problem.

-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project

WARNING: multiple messages have this Message-ID (diff)
From: Stephen Boyd <sboyd@codeaurora.org>
To: Masahiro Yamada <yamada.masahiro@socionext.com>
Cc: linux-mips@linux-mips.org, Rich Felker <dalias@libc.org>,
	linux-sh@vger.kernel.org,
	Michael Turquette <mturquette@baylibre.com>,
	Greg Ungerer <gerg@uclinux.org>,
	linux-clk@vger.kernel.org, Russell King <linux@arm.linux.org.uk>,
	Yoshinori Sato <ysato@users.sourceforge.jp>,
	Magnus Damm <magnus.damm@gmail.com>,
	Geert Uytterhoeven <geert@linux-m68k.org>,
	Wan ZongShun <mcuos.com@gmail.com>,
	Steven Miao <realmz6@gmail.com>,
	adi-buildroot-devel@lists.sourceforge.net,
	Haojian Zhuang <haojian.zhuang@gmail.com>,
	linux-m68k@vger.kernel.org, Simon Horman <horms@verge.net.au>,
	linux-arm-kernel <linux-arm-kernel@lists.infradead.org>,
	John Crispin <blogic@openwrt.org>,
	Eric Miao <eric.y.miao@gmail.com>,
	Ryan Mallon <rmallon@gmail.com>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Ralf Baechle <ralf@linux-mips.org>,
	linux-renesas-soc@vger.kernel.org,
	Hartley Sweeten <hsweeten@visionengravers.com>
Subject: Re: [PATCH v2] clk: let clk_disable() return immediately if clk is NULL or error
Date: Fri, 15 Apr 2016 17:04:43 -0700	[thread overview]
Message-ID: <20160416000443.GA26353@codeaurora.org> (raw)
In-Reply-To: <CAK7LNARbzRLq_NGWJ8CFBBf6w4cVGCNh45fo6JO=+F7FACBSxA@mail.gmail.com>

On 04/14, Masahiro Yamada wrote:
> 
> OK, now I notice another problem in my code;
> if foo_clk_init() fails for reason [2],
> clk_disable() WARN's due to zero enable_count.
> 
> if (WARN_ON(core->enable_count == 0))
>          return;
> 
> 
> 
> Perhaps, I got screwed up by splitting clock init stuff
> into a helper function.

Yep! Can't we just split the enable/disable out into another
function separate from the clk_get/put part? That would make
things more symmetric and avoid this problem.

-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project

WARNING: multiple messages have this Message-ID (diff)
From: Stephen Boyd <sboyd@codeaurora.org>
To: Masahiro Yamada <yamada.masahiro@socionext.com>
Cc: linux-mips@linux-mips.org, Rich Felker <dalias@libc.org>,
	linux-sh@vger.kernel.org,
	Michael Turquette <mturquette@baylibre.com>,
	Greg Ungerer <gerg@uclinux.org>,
	linux-clk@vger.kernel.org, Russell King <linux@arm.linux.org.uk>,
	Yoshinori Sato <ysato@users.sourceforge.jp>,
	Magnus Damm <magnus.damm@gmail.com>,
	Geert Uytterhoeven <geert@linux-m68k.org>,
	Wan ZongShun <mcuos.com@gmail.com>,
	Steven Miao <realmz6@gmail.com>,
	adi-buildroot-devel@lists.sourceforge.net,
	Haojian Zhuang <haojian.zhuang@gmail.com>,
	linux-m68k@lists.linux-m68k.org,
	Simon Horman <horms@verge.net.au>,
	linux-arm-kernel <linux-arm-kernel@lists.infradead.org>,
	John Crispin <blogic@openwrt.org>,
	Eric Miao <eric.y.miao@gmail.com>,
	Ryan Mallon <rmallon@gmail.com>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Ralf Baechle <ralf@linux-mips.org>,
	linux-renesas-soc@vger.kernel.org,
	Hartley Sweeten <hsweeten@visionengravers.com>
Subject: Re: [PATCH v2] clk: let clk_disable() return immediately if clk is NULL or error
Date: Fri, 15 Apr 2016 17:04:43 -0700	[thread overview]
Message-ID: <20160416000443.GA26353@codeaurora.org> (raw)
In-Reply-To: <CAK7LNARbzRLq_NGWJ8CFBBf6w4cVGCNh45fo6JO=+F7FACBSxA@mail.gmail.com>

On 04/14, Masahiro Yamada wrote:
> 
> OK, now I notice another problem in my code;
> if foo_clk_init() fails for reason [2],
> clk_disable() WARN's due to zero enable_count.
> 
> if (WARN_ON(core->enable_count == 0))
>          return;
> 
> 
> 
> Perhaps, I got screwed up by splitting clock init stuff
> into a helper function.

Yep! Can't we just split the enable/disable out into another
function separate from the clk_get/put part? That would make
things more symmetric and avoid this problem.

-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project

WARNING: multiple messages have this Message-ID (diff)
From: sboyd@codeaurora.org (Stephen Boyd)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v2] clk: let clk_disable() return immediately if clk is NULL or error
Date: Fri, 15 Apr 2016 17:04:43 -0700	[thread overview]
Message-ID: <20160416000443.GA26353@codeaurora.org> (raw)
In-Reply-To: <CAK7LNARbzRLq_NGWJ8CFBBf6w4cVGCNh45fo6JO=+F7FACBSxA@mail.gmail.com>

On 04/14, Masahiro Yamada wrote:
> 
> OK, now I notice another problem in my code;
> if foo_clk_init() fails for reason [2],
> clk_disable() WARN's due to zero enable_count.
> 
> if (WARN_ON(core->enable_count == 0))
>          return;
> 
> 
> 
> Perhaps, I got screwed up by splitting clock init stuff
> into a helper function.

Yep! Can't we just split the enable/disable out into another
function separate from the clk_get/put part? That would make
things more symmetric and avoid this problem.

-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project

  parent reply	other threads:[~2016-04-16  0:04 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-05  1:51 [PATCH v2] clk: let clk_disable() return immediately if clk is NULL or error Masahiro Yamada
2016-04-05  1:51 ` Masahiro Yamada
2016-04-05  1:51 ` Masahiro Yamada
2016-04-05  1:51 ` Masahiro Yamada
2016-04-08  0:33 ` Stephen Boyd
2016-04-08  0:33   ` Stephen Boyd
2016-04-08  0:33   ` Stephen Boyd
2016-04-08  0:33   ` Stephen Boyd
2016-04-08  1:52   ` Masahiro Yamada
2016-04-08  1:52   ` Masahiro Yamada
2016-04-08  1:52     ` Masahiro Yamada
2016-04-08  1:52     ` Masahiro Yamada
2016-04-08  1:52     ` Masahiro Yamada
2016-04-14  0:33     ` Stephen Boyd
2016-04-14  0:33     ` Stephen Boyd
2016-04-14  0:33       ` Stephen Boyd
2016-04-14  0:33       ` Stephen Boyd
2016-04-14  0:33       ` Stephen Boyd
2016-04-14  1:49       ` Masahiro Yamada
2016-04-14  1:49         ` Masahiro Yamada
2016-04-14  1:49         ` Masahiro Yamada
2016-04-14  1:49         ` Masahiro Yamada
2016-04-16  0:04         ` Stephen Boyd
2016-04-16  0:04         ` Stephen Boyd [this message]
2016-04-16  0:04           ` Stephen Boyd
2016-04-16  0:04           ` Stephen Boyd
2016-04-16  0:04           ` Stephen Boyd
2016-04-14  1:49       ` Masahiro Yamada
2016-04-08 10:06   ` Ralf Baechle
2016-04-08 10:06     ` Ralf Baechle
2016-04-08 10:06     ` Ralf Baechle
2016-04-08 10:06     ` Ralf Baechle
2016-04-08 11:15     ` Masahiro Yamada
2016-04-08 11:15       ` Masahiro Yamada
2016-04-08 11:15       ` Masahiro Yamada
2016-04-08 11:15       ` Masahiro Yamada
2016-04-14  0:40     ` Stephen Boyd
2016-04-14  0:40       ` Stephen Boyd
2016-04-14  0:40       ` Stephen Boyd
2016-04-14  0:40       ` Stephen Boyd
2016-04-08  0:33 ` Stephen Boyd
2016-04-05  1:51 Masahiro Yamada

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160416000443.GA26353@codeaurora.org \
    --to=sboyd@codeaurora.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.