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: <41239c2c-3599-3f0d-59d3-a8eb32814c58@gmail.com>
Date:   Mon, 26 Jun 2023 16:49:46 +0300
From:   Matti Vaittinen <mazziesaccount@...il.com>
To:     Benjamin Bara <bbara93@...il.com>,
        Liam Girdwood <lgirdwood@...il.com>,
        Mark Brown <broonie@...nel.org>
Cc:     support.opensource@...semi.com,
        DLG-Adam.Ward.opensource@...renesas.com,
        Martin Fuzzey <martin.fuzzey@...wbird.group>,
        linux-kernel@...r.kernel.org,
        Benjamin Bara <benjamin.bara@...data.com>
Subject: Re: [PATCH RFC v4 06/13] regulator: set required ops for monitoring
 workarounds

On 6/20/23 23:02, Benjamin Bara wrote:
> From: Benjamin Bara <benjamin.bara@...data.com>
> 
> If the core should be able to handle the monitoring workarounds, certain
> regulator ops are required:
> - is_enabled() to decide whether a monitor should be turned off or not.
> - get_active_protections() to find out if the device-tree is missing
>    active protections.
> - get_mode() if the regulator is in a mode where monitoring is not
>    supported.
> 
> Signed-off-by: Benjamin Bara <benjamin.bara@...data.com>

Reviewed-by: Matti Vaittinen <mazziesaccount@...il.com>

> ---
>   drivers/regulator/core.c | 34 ++++++++++++++++++++++++++++++++++
>   1 file changed, 34 insertions(+)
> 
> diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
> index dc741ac156c3..ca5d6ba889dc 100644
> --- a/drivers/regulator/core.c
> +++ b/drivers/regulator/core.c
> @@ -5540,6 +5540,40 @@ regulator_register(struct device *dev,
>   		goto rinse;
>   	}
>   
> +	/* monitor workaround properties require ops to ensure functionality. */
> +	if (regulator_desc->mon_disable_reg_disabled ||
> +	    regulator_desc->mon_disable_reg_set_higher ||
> +	    regulator_desc->mon_disable_reg_set_lower ||
> +	    regulator_desc->mon_unsupported_reg_modes) {
> +		/*
> +		 * is_enabled() to make sure the monitors aren't disabled on
> +		 * disabled regulators.
> +		 */
> +		if (!regulator_desc->ops->is_enabled) {
> +			ret = -EINVAL;
> +			goto rinse;
> +		}
> +
> +		/*
> +		 * get_active_protections() to know if a regulator is monitored
> +		 * without the device-tree being aware of it.
> +		 */
> +		if (!regulator_desc->ops->get_active_protections) {
> +			ret = -EINVAL;
> +			goto rinse;
> +		}
> +
> +		/*
> +		 * mon_unsupported_reg_modes property requires get_mode() to get
> +		 * the old state in case a state switch is failing.
> +		 */
> +		if (regulator_desc->mon_unsupported_reg_modes &&
> +		    !regulator_desc->ops->get_mode) {
> +			ret = -EINVAL;
> +			goto rinse;
> +		}
> +	}
> +
>   	rdev = kzalloc(sizeof(struct regulator_dev), GFP_KERNEL);
>   	if (rdev == NULL) {
>   		ret = -ENOMEM;
> 

-- 
Matti Vaittinen
Linux kernel developer at ROHM Semiconductors
Oulu Finland

~~ When things go utterly wrong vim users can always type :help! ~~

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ