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:
 <PH0PR03MB65126A498E701500D1C6D46F8EEE2@PH0PR03MB6512.namprd03.prod.outlook.com>
Date: Wed, 29 Jan 2025 08:32:02 +0000
From: "Hennerich, Michael" <Michael.Hennerich@...log.com>
To: Isaac Scott <isaac.scott@...asonboard.com>
CC: "lgirdwood@...il.com" <lgirdwood@...il.com>,
        "broonie@...nel.org"
	<broonie@...nel.org>,
        "linux-kernel@...r.kernel.org"
	<linux-kernel@...r.kernel.org>
Subject: RE: [PATCH v2 3/3] regulator: ad5398: Add device tree support



> -----Original Message-----
> From: Isaac Scott <isaac.scott@...asonboard.com>
> Sent: Tuesday, January 28, 2025 6:32 PM
> To: Hennerich, Michael <Michael.Hennerich@...log.com>
> Cc: lgirdwood@...il.com; broonie@...nel.org; linux-kernel@...r.kernel.org;
> Isaac Scott <isaac.scott@...asonboard.com>
> Subject: [PATCH v2 3/3] regulator: ad5398: Add device tree support
> 
> 
> Previously, the ad5398 driver used only platform_data, which is deprecated in
> favour of device tree. This caused the AD5398 to fail to probe as it could not
> load its init_data. If the AD5398 has a device tree node, pull the init_data from
> there using of_get_regulator_init_data.
> 
> Signed-off-by: Isaac Scott <isaac.scott@...asonboard.com>

Acked-by: Michael Hennerich <michael.hennerich@...log.com>

> ---
>  drivers/regulator/ad5398.c | 12 +++++++++---
>  1 file changed, 9 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/regulator/ad5398.c b/drivers/regulator/ad5398.c index
> 0c60ecd1f0f2..619c999946f3 100644
> --- a/drivers/regulator/ad5398.c
> +++ b/drivers/regulator/ad5398.c
> @@ -14,6 +14,7 @@
>  #include <linux/platform_device.h>
>  #include <linux/regulator/driver.h>
>  #include <linux/regulator/machine.h>
> +#include <linux/regulator/of_regulator.h>
> 
>  #define AD5398_SW_POWER_DOWN	BIT(16)
> 
> @@ -220,15 +221,20 @@ static int ad5398_probe(struct i2c_client *client)
>  	const struct ad5398_current_data_format *df =
>  			(struct ad5398_current_data_format *)id-
> >driver_data;
> 
> -	if (!init_data)
> -		return -EINVAL;
> -
>  	chip = devm_kzalloc(&client->dev, sizeof(*chip), GFP_KERNEL);
>  	if (!chip)
>  		return -ENOMEM;
> 
>  	config.dev = &client->dev;
> +	if (client->dev.of_node)
> +		init_data = of_get_regulator_init_data(&client->dev,
> +						       client->dev.of_node,
> +						       &ad5398_reg);
> +	if (!init_data)
> +		return -EINVAL;
> +
>  	config.init_data = init_data;
> +	config.of_node = client->dev.of_node;
>  	config.driver_data = chip;
> 
>  	chip->client = client;
> --
> 2.43.0


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ