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] [day] [month] [year] [list]
Message-ID: <alpine.DEB.2.02.1410021341570.11795@atx-linux-37>
Date:	Thu, 2 Oct 2014 13:43:30 -0500
From:	atull <atull@...nsource.altera.com>
To:	Guenter Roeck <linux@...ck-us.net>
CC:	Mark Brown <broonie@...nel.org>, <jdelvare@...e.de>,
	<lm-sensors@...sensors.org>, <lgirdwood@...il.com>,
	<robh+dt@...nel.org>, <pawel.moll@....com>, <mark.rutland@....com>,
	<ijc+devicetree@...lion.org.uk>, <galak@...eaurora.org>,
	<devicetree@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
	<delicious.quinoa@...il.com>, <dinguyen@...nsource.altera.com>,
	<yvanderv@...nsource.altera.com>
Subject: Re: [PATCH v4 3/4] pmbus: add regulator support

On Thu, 2 Oct 2014, Guenter Roeck wrote:

> On 10/02/2014 04:20 AM, Mark Brown wrote:
> > On Wed, Oct 01, 2014 at 02:05:49PM -0500, atull@...nsource.altera.com wrote:
> > > From: Alan Tull <atull@...nsource.altera.com>
> > > 
> > > Add support for simple on/off control of each channel.
> > 
> > This is basically fine but the regulator API has moved on a bit with the
> > DT handling over the time you've been working on this.
> > 
> > > Signed-off-by: Alan Tull <atull@...nsource.altera.com>
> > > 
> > > v2: Remove '#include <linux/regulator/machine.h>'
> > >      Only one regulator per pmbus device
> > 
> > Put this after the --- as covered in SubmittingPatches.
> > 
> > > +static int _pmbus_regulator_on_off(struct regulator_dev *rdev, bool
> > > enable)
> > > +{
> > > +	struct device *dev = rdev_get_dev(rdev);
> > > +	struct i2c_client *client = to_i2c_client(dev->parent);
> > > +	u8 page = rdev_get_id(rdev);
> > > +
> > > +	return pmbus_update_byte_data(client, page, PMBUS_OPERATION,
> > > +				      PB_OPERATION_CONTROL_ON,
> > > +				      enable ? PB_OPERATION_CONTROL_ON : 0);
> > > +}
> > > +
> > > +static int pmbus_regulator_enable(struct regulator_dev *rdev)
> > > +{
> > > +	return _pmbus_regulator_on_off(rdev, 1);
> > > +}
> > 
> > I'm not sure factoring out the code actually won much here.
> > 
> > > +	np_regulators = of_get_child_by_name(dev->of_node, "regulators");
> > > +	if (!np_regulators)
> > > +		return 0;
> > > +
> > > +	ret = of_regulator_match(dev, np_regulators, info->reg_matches,
> > > +				 info->num_regulators);
> > > +	of_node_put(np_regulators);
> > 
> > We now have helpers in the regulator core for this - set of_match and
> > regulators_node in the regulator descriptor and the core will resolve
> > this stuff for you and...
> > 
> > > +		if (pdata && pdata->reg_init_data) {
> > > +			config.init_data = &pdata->reg_init_data[i];
> > > +		} else {
> > > +			config.init_data = info->reg_matches[i].init_data;
> > > +			config.of_node = info->reg_matches[i].of_node;
> > > +		}
> > 
> > ...you can just drop the else case (and check for reg_init_data) here.
> > 
> 
> Guess we'll need another version after all.
> 
> Alan, in that case please provide prototyles for the new API functions
> introduced in patch 2/4.
> 
> Thanks,
> Guenter

OK I have sent out v5 which uses the simplified DT parsing method.

I added the prototypes and made the other fixes requested.

Alan


> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@...r.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ