All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>
To: Russell King - ARM Linux <linux@arm.linux.org.uk>
Cc: linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org,
	linux-watchdog@vger.kernel.org, Lior Amsalem <alior@marvell.com>,
	Andrew Lunn <andrew@lunn.ch>, Jason Cooper <jason@lakedaemon.net>,
	Tawfik Bayouk <tawfik@marvell.com>,
	Daniel Lezcano <daniel.lezcano@linaro.org>,
	Wim Van Sebroeck <wim@iguana.be>, Arnd Bergmann <arnd@arndb.de>,
	Gregory Clement <gregory.clement@free-electrons.com>,
	Guenter Roeck <linux@roeck-us.net>,
	Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
Subject: Re: [PATCH v5 14/20] watchdog: orion: Add support for Armada 370 and Armada XP SoC
Date: Tue, 28 Jan 2014 07:27:50 -0300	[thread overview]
Message-ID: <20140128102750.GA13052@localhost> (raw)
In-Reply-To: <20140127173624.GT15937@n2100.arm.linux.org.uk>

On Mon, Jan 27, 2014 at 05:36:24PM +0000, Russell King - ARM Linux wrote:
[..]
> > +static int armadaxp_wdt_clock_init(struct platform_device *pdev,
> > +				   struct orion_watchdog *dev)
> > +{
> > +	int ret;
> > +
> > +	dev->clk = of_clk_get_by_name(pdev->dev.of_node, "fixed");
> > +	if (IS_ERR(dev->clk))
> > +		return PTR_ERR(dev->clk);
> > +	ret = clk_prepare_enable(dev->clk);
> > +	if (ret)
> > +		return ret;
> > +
> > +	/* Enable the fixed watchdog clock input */
> > +	atomic_io_modify(dev->reg + TIMER_CTRL,
> > +			 WDT_AXP_FIXED_ENABLE_BIT,
> > +			 WDT_AXP_FIXED_ENABLE_BIT);
> > +
> > +	dev->clk_rate = clk_get_rate(dev->clk);
> > +	return 0;
> > +}
> 
> Doesn't this result in dev->clk being leaked?  Or at least a difference
> in the way dev->clk needs to be cleaned up between these two functions?
> 

Yes, indeed.

> I think it would be better in this case to use the standard clk_get() in
> the first function and always use clk_put()... until there is a devm_*
> version of the of_clk_get* functions.
> 

Sound good.

Thanks,
-- 
Ezequiel García, Free Electrons
Embedded Linux, Kernel and Android Engineering
http://free-electrons.com
--
To unsubscribe from this list: send the line "unsubscribe linux-watchdog" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

WARNING: multiple messages have this Message-ID (diff)
From: ezequiel.garcia@free-electrons.com (Ezequiel Garcia)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v5 14/20] watchdog: orion: Add support for Armada 370 and Armada XP SoC
Date: Tue, 28 Jan 2014 07:27:50 -0300	[thread overview]
Message-ID: <20140128102750.GA13052@localhost> (raw)
In-Reply-To: <20140127173624.GT15937@n2100.arm.linux.org.uk>

On Mon, Jan 27, 2014 at 05:36:24PM +0000, Russell King - ARM Linux wrote:
[..]
> > +static int armadaxp_wdt_clock_init(struct platform_device *pdev,
> > +				   struct orion_watchdog *dev)
> > +{
> > +	int ret;
> > +
> > +	dev->clk = of_clk_get_by_name(pdev->dev.of_node, "fixed");
> > +	if (IS_ERR(dev->clk))
> > +		return PTR_ERR(dev->clk);
> > +	ret = clk_prepare_enable(dev->clk);
> > +	if (ret)
> > +		return ret;
> > +
> > +	/* Enable the fixed watchdog clock input */
> > +	atomic_io_modify(dev->reg + TIMER_CTRL,
> > +			 WDT_AXP_FIXED_ENABLE_BIT,
> > +			 WDT_AXP_FIXED_ENABLE_BIT);
> > +
> > +	dev->clk_rate = clk_get_rate(dev->clk);
> > +	return 0;
> > +}
> 
> Doesn't this result in dev->clk being leaked?  Or at least a difference
> in the way dev->clk needs to be cleaned up between these two functions?
> 

Yes, indeed.

> I think it would be better in this case to use the standard clk_get() in
> the first function and always use clk_put()... until there is a devm_*
> version of the of_clk_get* functions.
> 

Sound good.

Thanks,
-- 
Ezequiel Garc?a, Free Electrons
Embedded Linux, Kernel and Android Engineering
http://free-electrons.com

WARNING: multiple messages have this Message-ID (diff)
From: Ezequiel Garcia <ezequiel.garcia-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
To: Russell King - ARM Linux <linux-lFZ/pmaqli7XmaaqVzeoHQ@public.gmane.org>
Cc: linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org,
	devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-watchdog-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	Lior Amsalem <alior-eYqpPyKDWXRBDgjK7y7TUQ@public.gmane.org>,
	Andrew Lunn <andrew-g2DYL2Zd6BY@public.gmane.org>,
	Jason Cooper <jason-NLaQJdtUoK4Be96aLqz0jA@public.gmane.org>,
	Tawfik Bayouk <tawfik-eYqpPyKDWXRBDgjK7y7TUQ@public.gmane.org>,
	Daniel Lezcano
	<daniel.lezcano-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>,
	Wim Van Sebroeck <wim-IQzOog9fTRqzQB+pC5nmwQ@public.gmane.org>,
	Arnd Bergmann <arnd-r2nGTMty4D4@public.gmane.org>,
	Gregory Clement
	<gregory.clement-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>,
	Guenter Roeck <linux-0h96xk9xTtrk1uMJSBkQmQ@public.gmane.org>,
	Sebastian Hesselbarth
	<sebastian.hesselbarth-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Subject: Re: [PATCH v5 14/20] watchdog: orion: Add support for Armada 370 and Armada XP SoC
Date: Tue, 28 Jan 2014 07:27:50 -0300	[thread overview]
Message-ID: <20140128102750.GA13052@localhost> (raw)
In-Reply-To: <20140127173624.GT15937-l+eeeJia6m9vn6HldHNs0ANdhmdF6hFW@public.gmane.org>

On Mon, Jan 27, 2014 at 05:36:24PM +0000, Russell King - ARM Linux wrote:
[..]
> > +static int armadaxp_wdt_clock_init(struct platform_device *pdev,
> > +				   struct orion_watchdog *dev)
> > +{
> > +	int ret;
> > +
> > +	dev->clk = of_clk_get_by_name(pdev->dev.of_node, "fixed");
> > +	if (IS_ERR(dev->clk))
> > +		return PTR_ERR(dev->clk);
> > +	ret = clk_prepare_enable(dev->clk);
> > +	if (ret)
> > +		return ret;
> > +
> > +	/* Enable the fixed watchdog clock input */
> > +	atomic_io_modify(dev->reg + TIMER_CTRL,
> > +			 WDT_AXP_FIXED_ENABLE_BIT,
> > +			 WDT_AXP_FIXED_ENABLE_BIT);
> > +
> > +	dev->clk_rate = clk_get_rate(dev->clk);
> > +	return 0;
> > +}
> 
> Doesn't this result in dev->clk being leaked?  Or at least a difference
> in the way dev->clk needs to be cleaned up between these two functions?
> 

Yes, indeed.

> I think it would be better in this case to use the standard clk_get() in
> the first function and always use clk_put()... until there is a devm_*
> version of the of_clk_get* functions.
> 

Sound good.

Thanks,
-- 
Ezequiel García, Free Electrons
Embedded Linux, Kernel and Android Engineering
http://free-electrons.com
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  reply	other threads:[~2014-01-28 10:27 UTC|newest]

Thread overview: 109+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-27 15:27 [PATCH v5 00/20] Armada 370/XP watchdog support Ezequiel Garcia
2014-01-27 15:27 ` Ezequiel Garcia
2014-01-27 15:27 ` Ezequiel Garcia
2014-01-27 15:27 ` [PATCH v5 01/20] ARM: Introduce atomic MMIO modify Ezequiel Garcia
2014-01-27 15:27   ` Ezequiel Garcia
2014-01-27 15:27   ` Ezequiel Garcia
2014-01-28 10:31   ` Ezequiel Garcia
2014-01-27 15:27 ` [PATCH v5 02/20] clocksource: orion: Use atomic access for shared registers Ezequiel Garcia
2014-01-27 15:27   ` Ezequiel Garcia
2014-01-27 15:27   ` Ezequiel Garcia
2014-02-05 19:10   ` Jason Cooper
2014-02-05 19:10     ` Jason Cooper
2014-02-05 19:10     ` Jason Cooper
2014-02-05 23:19     ` Ezequiel Garcia
2014-02-05 23:19       ` Ezequiel Garcia
2014-02-05 23:19       ` Ezequiel Garcia
2014-02-06 23:47       ` Daniel Lezcano
2014-02-06 23:47         ` Daniel Lezcano
2014-02-06 23:47         ` Daniel Lezcano
2014-01-27 15:27 ` [PATCH v5 03/20] watchdog: orion: Add clock error handling Ezequiel Garcia
2014-01-27 15:27   ` Ezequiel Garcia
2014-01-27 15:27   ` Ezequiel Garcia
2014-01-27 15:27 ` [PATCH v5 04/20] watchdog: orion: Use atomic access for shared registers Ezequiel Garcia
2014-01-27 15:27   ` Ezequiel Garcia
2014-01-27 15:27   ` Ezequiel Garcia
2014-01-27 15:27 ` [PATCH v5 05/20] watchdog: orion: Remove unused macros Ezequiel Garcia
2014-01-27 15:27   ` Ezequiel Garcia
2014-01-27 15:27   ` Ezequiel Garcia
2014-01-27 15:27 ` [PATCH v5 06/20] watchdog: orion: Make sure the watchdog is initially stopped Ezequiel Garcia
2014-01-27 15:27   ` Ezequiel Garcia
2014-01-27 15:27   ` Ezequiel Garcia
2014-01-27 15:27 ` [PATCH v5 07/20] watchdog: orion: Handle the interrupt so it's properly acked Ezequiel Garcia
2014-01-27 15:27   ` Ezequiel Garcia
2014-01-27 15:27   ` Ezequiel Garcia
2014-01-27 15:27 ` [PATCH v5 08/20] watchdog: orion: Make RSTOUT register a separate resource Ezequiel Garcia
2014-01-27 15:27   ` Ezequiel Garcia
2014-01-27 15:27   ` Ezequiel Garcia
2014-01-27 15:27 ` [PATCH v5 09/20] watchdog: orion: Remove unneeded BRIDGE_CAUSE clear Ezequiel Garcia
2014-01-27 15:27   ` Ezequiel Garcia
2014-01-27 15:27   ` Ezequiel Garcia
2014-01-27 15:27 ` [PATCH v5 10/20] watchdog: orion: Introduce an orion_watchdog device structure Ezequiel Garcia
2014-01-27 15:27   ` Ezequiel Garcia
2014-01-27 15:27   ` Ezequiel Garcia
2014-01-27 15:27 ` [PATCH v5 11/20] watchdog: orion: Introduce per-compatible of_device_id data Ezequiel Garcia
2014-01-27 15:27   ` Ezequiel Garcia
2014-01-27 15:27   ` Ezequiel Garcia
2014-01-27 15:27 ` [PATCH v5 12/20] watchdog: orion: Add per-compatible clock initialization Ezequiel Garcia
2014-01-27 15:27   ` Ezequiel Garcia
2014-01-27 15:27   ` Ezequiel Garcia
2014-01-27 15:27 ` [PATCH v5 13/20] watchdog: orion: Add per-compatible watchdog start implementation Ezequiel Garcia
2014-01-27 15:27   ` Ezequiel Garcia
2014-01-27 15:27   ` Ezequiel Garcia
2014-01-27 15:27 ` [PATCH v5 14/20] watchdog: orion: Add support for Armada 370 and Armada XP SoC Ezequiel Garcia
2014-01-27 15:27   ` Ezequiel Garcia
2014-01-27 15:27   ` Ezequiel Garcia
2014-01-27 17:36   ` Russell King - ARM Linux
2014-01-27 17:36     ` Russell King - ARM Linux
2014-01-27 17:36     ` Russell King - ARM Linux
2014-01-28 10:27     ` Ezequiel Garcia [this message]
2014-01-28 10:27       ` Ezequiel Garcia
2014-01-28 10:27       ` Ezequiel Garcia
2014-01-27 15:27 ` [PATCH v5 15/20] ARM: mvebu: Enable Armada 370/XP watchdog in the devicetree Ezequiel Garcia
2014-01-27 15:27   ` Ezequiel Garcia
2014-01-27 15:27   ` Ezequiel Garcia
2014-01-27 15:27 ` [PATCH v5 16/20] ARM: kirkwood: Add RSTOUT 'reg' entry to devicetree Ezequiel Garcia
2014-01-27 15:27   ` Ezequiel Garcia
2014-01-27 15:27   ` Ezequiel Garcia
2014-01-29 20:15   ` Andrew Lunn
2014-01-29 20:15     ` Andrew Lunn
2014-01-29 20:15     ` Andrew Lunn
2014-01-27 15:27 ` [PATCH v5 17/20] ARM: dove: Enable Dove watchdog in the devicetree Ezequiel Garcia
2014-01-27 15:27   ` Ezequiel Garcia
2014-01-27 15:27   ` Ezequiel Garcia
2014-01-27 15:27 ` [PATCH v5 18/20] watchdog: orion: Enable the build on ARCH_MVEBU Ezequiel Garcia
2014-01-27 15:27   ` Ezequiel Garcia
2014-01-27 15:27   ` Ezequiel Garcia
2014-01-27 15:27 ` [PATCH v5 19/20] ARM: mvebu: Enable watchdog support in defconfig Ezequiel Garcia
2014-01-27 15:27   ` Ezequiel Garcia
2014-01-27 15:27   ` Ezequiel Garcia
2014-01-27 15:27 ` [PATCH v5 20/20] ARM: dove: Enable watchdog support in the defconfig Ezequiel Garcia
2014-01-27 15:27   ` Ezequiel Garcia
2014-01-27 15:27   ` Ezequiel Garcia
2014-01-27 15:50 ` [PATCH v5 00/20] Armada 370/XP watchdog support Jason Cooper
2014-01-27 15:50   ` Jason Cooper
2014-01-27 15:50   ` Jason Cooper
2014-01-29 18:19 ` Ezequiel Garcia
2014-01-29 18:19   ` Ezequiel Garcia
2014-01-29 18:19   ` Ezequiel Garcia
2014-01-30 20:53   ` Jason Cooper
2014-01-30 20:53     ` Jason Cooper
2014-01-30 20:53     ` Jason Cooper
2014-01-30 21:50     ` Ezequiel Garcia
2014-01-30 21:50       ` Ezequiel Garcia
2014-01-30 21:50       ` Ezequiel Garcia
2014-01-30 22:00       ` Sebastian Hesselbarth
2014-01-30 22:00         ` Sebastian Hesselbarth
2014-01-30 22:00         ` Sebastian Hesselbarth
2014-01-30 22:16         ` Jason Cooper
2014-01-30 22:16           ` Jason Cooper
2014-01-30 22:16           ` Jason Cooper
2014-01-30 22:37         ` Ezequiel Garcia
2014-01-30 22:37           ` Ezequiel Garcia
2014-01-30 22:37           ` Ezequiel Garcia
2014-01-31 17:25   ` Willy Tarreau
2014-01-31 17:25     ` Willy Tarreau
2014-01-31 17:25     ` Willy Tarreau
2014-02-05 19:06 ` Jason Cooper
2014-02-05 19:06   ` Jason Cooper
2014-02-05 19:06   ` Jason Cooper

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=20140128102750.GA13052@localhost \
    --to=ezequiel.garcia@free-electrons.com \
    --cc=alior@marvell.com \
    --cc=andrew@lunn.ch \
    --cc=arnd@arndb.de \
    --cc=daniel.lezcano@linaro.org \
    --cc=devicetree@vger.kernel.org \
    --cc=gregory.clement@free-electrons.com \
    --cc=jason@lakedaemon.net \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-watchdog@vger.kernel.org \
    --cc=linux@arm.linux.org.uk \
    --cc=linux@roeck-us.net \
    --cc=sebastian.hesselbarth@gmail.com \
    --cc=tawfik@marvell.com \
    --cc=wim@iguana.be \
    /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.