Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1329654 > unrolled thread

Re: [PATCH 1/2] devm: add helper devm_add_action_or_reset()

Started byStephen Boyd <sboyd@codeaurora.org>
First post2016-02-08 23:40 +0100
Last post2016-02-09 00:20 +0100
Articles 2 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: [PATCH 1/2] devm: add helper devm_add_action_or_reset() Stephen Boyd <sboyd@codeaurora.org> - 2016-02-08 23:40 +0100
    Re: [PATCH 1/2] devm: add helper devm_add_action_or_reset() Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-02-09 00:20 +0100

#1329654 — Re: [PATCH 1/2] devm: add helper devm_add_action_or_reset()

FromStephen Boyd <sboyd@codeaurora.org>
Date2016-02-08 23:40 +0100
SubjectRe: [PATCH 1/2] devm: add helper devm_add_action_or_reset()
Message-ID<r02Dn-36m-7@gated-at.bofh.it>
On 12/23, Sudip Mukherjee wrote:
> Add a helper function devm_add_action_or_reset() which will internally
> call devm_add_action(). But if devm_add_action() fails then it will
> execute the action mentioned and return the error code.
> 
> Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org>
> ---

Greg, can I get your ack here to take this through clk-tree?

> 
> Next patch of the series will use this helper. And from a first glance
> more use of this helper will be there.
> 
>  include/linux/device.h | 12 ++++++++++++
>  1 file changed, 12 insertions(+)
> 
> diff --git a/include/linux/device.h b/include/linux/device.h
> index f627ba2..f2455d0 100644
> --- a/include/linux/device.h
> +++ b/include/linux/device.h
> @@ -682,6 +682,18 @@ void __iomem *devm_ioremap_resource(struct device *dev, struct resource *res);
>  int devm_add_action(struct device *dev, void (*action)(void *), void *data);
>  void devm_remove_action(struct device *dev, void (*action)(void *), void *data);
>  
> +static inline int devm_add_action_or_reset(struct device *dev,
> +					   void (*action)(void *), void *data)
> +{
> +	int ret;
> +
> +	ret = devm_add_action(dev, action, data);
> +	if (ret)
> +		action(data);
> +
> +	return ret;
> +}
> +
>  struct device_dma_parameters {
>  	/*
>  	 * a low level driver may set these to teach IOMMU code about

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

[toc] | [next] | [standalone]


#1329679

FromGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Date2016-02-09 00:20 +0100
Message-ID<r03g5-3zZ-5@gated-at.bofh.it>
In reply to#1329654
On Mon, Feb 08, 2016 at 02:35:46PM -0800, Stephen Boyd wrote:
> On 12/23, Sudip Mukherjee wrote:
> > Add a helper function devm_add_action_or_reset() which will internally
> > call devm_add_action(). But if devm_add_action() fails then it will
> > execute the action mentioned and return the error code.
> > 
> > Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org>
> > ---
> 
> Greg, can I get your ack here to take this through clk-tree?

Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web