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]
Date:   Sun, 5 Jun 2022 12:10:17 +0200
From:   saravanan sekar <sravanhome@...il.com>
To:     Robert Marko <robimarko@...il.com>, lgirdwood@...il.com,
        broonie@...nel.org, robh+dt@...nel.org,
        krzysztof.kozlowski+dt@...aro.org, linux-kernel@...r.kernel.org,
        devicetree@...r.kernel.org
Subject: Re: [PATCH v2 3/4] regulator: mp5416: use OF match data

On 04/06/22 16:58, Robert Marko wrote:
> In preparation for adding support for MP5496 which slightly differs from
> MP5416 convert the driver to use OF match data instead of always using the
> MP5416 regulator_desc for regulator registration.
> 
> Signed-off-by: Robert Marko <robimarko@...il.com>
> ---
>   drivers/regulator/mp5416.c | 10 ++++++++--
>   1 file changed, 8 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/regulator/mp5416.c b/drivers/regulator/mp5416.c
> index d8245080df03..011a825570ea 100644
> --- a/drivers/regulator/mp5416.c
> +++ b/drivers/regulator/mp5416.c
> @@ -11,6 +11,7 @@
>   #include <linux/init.h>
>   #include <linux/kernel.h>
>   #include <linux/module.h>
> +#include <linux/of_device.h>
>   #include <linux/platform_device.h>
>   #include <linux/regmap.h>
>   #include <linux/regulator/driver.h>
> @@ -178,6 +179,7 @@ static int mp5416_i2c_probe(struct i2c_client *client)
>   {
>   	struct device *dev = &client->dev;
>   	struct regulator_config config = { NULL, };
> +	static const struct regulator_desc *desc;
>   	struct regulator_dev *rdev;
>   	struct regmap *regmap;
>   	int i;
> @@ -188,12 +190,16 @@ static int mp5416_i2c_probe(struct i2c_client *client)
>   		return PTR_ERR(regmap);
>   	}
>   
> +	desc = of_device_get_match_data(dev);
> +	if (!desc)
> +		return -ENODEV;
> +
>   	config.dev = dev;
>   	config.regmap = regmap;
>   
>   	for (i = 0; i < MP5416_MAX_REGULATORS; i++) {
>   		rdev = devm_regulator_register(dev,
> -					       &mp5416_regulators_desc[i],
> +					       &desc[i],
>   					       &config);
>   		if (IS_ERR(rdev)) {
>   			dev_err(dev, "Failed to register regulator!\n");
> @@ -205,7 +211,7 @@ static int mp5416_i2c_probe(struct i2c_client *client)
>   }
>   
>   static const struct of_device_id mp5416_of_match[] = {
> -	{ .compatible = "mps,mp5416" },
> +	{ .compatible = "mps,mp5416", .data = &mp5416_regulators_desc },
>   	{},
>   };
>   MODULE_DEVICE_TABLE(of, mp5416_of_match);

Acked-by: Saravanan Sekar <sravanhome@...il.com>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ