lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <743d4b6b-c854-468f-a0c4-8adbf58cd0ea@vivo.com>
Date: Mon, 2 Sep 2024 17:52:23 +0800
From: Yuesong Li <liyuesong@...o.com>
To: p.zabel@...gutronix.de
Cc: linux-kernel@...r.kernel.org, opensource.kernel@...o.com
Subject: Re: [PATCH RFC] reset: Provide new devm_reset helpers for get and
 deassert reset control



On 2024/8/30 11:33, Yuesong Li wrote:
> When a driver wants to get reset control and deassert it,this
> helper will handle the return value of these function, also it
> will register a devres so that when the device been detached, the
> reset control will be assert.
> 
> Signed-off-by: Yuesong Li <liyuesong@...o.com>
> ---
>   include/linux/reset.h | 29 +++++++++++++++++++++++++++++
>   1 file changed, 29 insertions(+)
> 
> diff --git a/include/linux/reset.h b/include/linux/reset.h
> index 514ddf003efc..d7e02968b63b 100644
> --- a/include/linux/reset.h
> +++ b/include/linux/reset.h
> @@ -806,6 +806,35 @@ devm_reset_control_get_shared_by_index(struct device *dev, int index)
>   	return __devm_reset_control_get(dev, NULL, index, true, false, false);
>   }
>   
> +/**
> + * devm_reset_control_get_deassert - resource managed
> + * @dev: device to be reset by the controller
> + * @index: index of the reset controller
> + *
> + * A helper function to automatically handle return value of
> + * devm_reset_control_get_exclusive() and reset_control_deassert().
> + */
> +static struct reset_control *devm_reset_control_get_deassert(
> +			  struct device *dev, const char *id)
> +{
> +	int ret;
> +	struct reset_control *reset;
> +
> +	reset = devm_reset_control_get_exclusive(dev, id);
> +	if (IS_ERR(reset))
> +		return reset;
> +
> +	ret = reset_control_deassert(reset);
> +	if (ret)
> +		return ERR_PTR(ret);
> +
> +	ret = devm_add_action_or_reset(dev, (void *)reset_control_assert, (void *)reset);
> +	if (ret)
> +		return ERR_PTR(ret);
> +
> +	return reset;
> +}
> +
>   /*
>    * TEMPORARY calls to use during transition:
>    *

Please ignore this patch, I did not use clang to check the compile 
process. This patch is meant to simplify a common pattern appears in 
more than 10 files. For example in
"drivers/thermal/sun8i_thermal.c" line 393-401
But to pass the complier test, we need to include other header which 
does not make sense. So drop this patch.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ