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: <5696378B.6070704@nvidia.com>
Date:	Wed, 13 Jan 2016 17:09:55 +0530
From:	Laxman Dewangan <ldewangan@...dia.com>
To:	Krzysztof Kozlowski <k.kozlowski@...sung.com>,
	<robh+dt@...nel.org>, <pawel.moll@....com>, <mark.rutland@....com>,
	<ijc+devicetree@...lion.org.uk>, <galak@...eaurora.org>,
	<linus.walleij@...aro.org>, <gnurou@...il.com>,
	<lee.jones@...aro.org>, <broonie@...nel.org>,
	<a.zummo@...ertech.it>, <alexandre.belloni@...e-electrons.com>
CC:	<lgirdwood@...il.com>, <devicetree@...r.kernel.org>,
	<linux-kernel@...r.kernel.org>, <linux-gpio@...r.kernel.org>,
	<rtc-linux@...glegroups.com>, <swarren@...dia.com>,
	<treding@...dia.com>, Mallikarjun Kasoju <mkasoju@...dia.com>
Subject: Re: [PATCH V2 6/6] regulator: max77620: add regulator driver for
 max77620/max20024


On Wednesday 13 January 2016 06:58 AM, Krzysztof Kozlowski wrote:
> On 12.01.2016 18:17, Laxman Dewangan wrote:
> +
> +	ret = of_regulator_match(&pdev->dev, np, max77620_regulator_matches,
> +			ARRAY_SIZE(max77620_regulator_matches));
> Why not using 'regulators_node' and getting rid of this and some code
> below? If you need to parse custom regulator properties use 'of_parse_cb'.
>

Yaah, this is something new and I think Mark also wanted to do this 
cleanup on his comment. I did not understand it previously. Looks cool now.

However, I have requirement to configure PMIC with some inital setting 
based on init_data (parsed) before regulator registration happened. Once 
I move to this new mecahinsm, the inti_data parsing and regulator init 
happen in the same function. So I need to have one callback from 
regulator_register to driver.
Something below. This will do the pre configuration before 
regulator_register happena dn machine constraint sets.

I can not use the init_data->regulator_init() as I need to have the init 
data passed to the driver.

Created sample patch below.

ldewangan@...wanganubuntu-System-Product-Name:~/upstream/linux-next/linux-next/drivers/regulator$ 
git diff core.c ../../include/linux/regulator/driver.h
diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
index 3308c6b..aa2ca20 100644
--- a/drivers/regulator/core.c
+++ b/drivers/regulator/core.c
@@ -3899,6 +3899,17 @@ regulator_register(const struct regulator_desc 
*regulator_desc,
                 rdev->dev.of_node = of_node_get(config->of_node);
         }

+       if (init_data && regulator_desc->pre_register_init) {
+               ret = regulator_desc->pre_register_init(regulator_desc,
+                                       config, init_data);
+               if (ret < 0) {
+                       dev_err(dev, "Pre register failed: %d\n", ret);
+                       kfree(rdev);
+                       kfree(config);
+                       return ERR_PTR(ret);
+               }
+       }
+
         mutex_lock(&regulator_list_mutex);

         mutex_init(&rdev->mutex);
diff --git a/include/linux/regulator/driver.h 
b/include/linux/regulator/driver.h
index 16ac9e1..fd1d989 100644
--- a/include/linux/regulator/driver.h
+++ b/include/linux/regulator/driver.h
@@ -280,6 +280,9 @@ struct regulator_desc {
         int (*of_parse_cb)(struct device_node *,
                             const struct regulator_desc *,
                             struct regulator_config *);
+       int (*pre_register_init)(const struct regulator_desc *,
+                       struct regulator_config *,
+                       struct regulator_init_data *);
         int id;
         bool continuous_voltage_range;
         unsigned n_voltages;

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ