Commit Graph

11 Commits

Author SHA1 Message Date
Dmitry Torokhov
4cf95663c8 Regulators: virtual - use sysfs attribute groups
Instead of open-coding sysfs attribute group use canned solution.
Also add __devinit/__devexit markups for probe and remove methods
and use 'bool' where it makes sense.

Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
2010-03-03 14:49:26 +00:00
Mark Brown
72b86876d4 regulator: Improve virtual consumer probe error handling
Report errors to the user and try harder to clean up if we're not
able to probe.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
2009-09-22 13:32:39 +01:00
Mark Brown
a5d2abce43 regulator: Make virtual consumer a bit more chatty
This makes it easier to read the logs when doing testing.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
2009-09-22 13:32:35 +01:00
Mark Brown
a07ac21714 regulator: Make virtual consumer use dev_printk
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
2009-09-22 13:32:35 +01:00
Mark Brown
d61c3d56e2 regulator: Report regulator_get() failure in virtual consumer
The core will no longer complain so we should log an error here.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
2009-09-22 13:32:35 +01:00
Mark Brown
38c53c8913 regulator: Set MODULE_ALIAS for regulator drivers
Several of the regulator drivers didn't have MODULE_ALIAS so couldn't be
auto loaded. Add the MODULE_ALIAS in case they do get built as modules.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
2009-06-15 11:18:24 +01:00
Mike Rapoport
aa61d558f0 regulator/virtual: fix strings compare predicates
Signed-off-by: Mike Rapoport <mike@compulab.co.il>
Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
2009-04-28 18:58:07 +01:00
Mark Brown
fefdae4246 regulator: Mark attributes table for virtual regulator static
It's not exported.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
2009-03-31 09:56:22 +01:00
Andrew Morton
9485397aa2 regulator: minor cleanup of virtual consumer
On Thu, 15 Jan 2009 16:10:22 -0800
Andrew Morton <akpm@linux-foundation.org> wrote:

> On Wed, 14 Jan 2009 13:16:27 -0800
> David Brownell <david-b@pacbell.net> wrote:
>
> > From: David Brownell <dbrownell@users.sourceforge.net>
> >
> > Minor cleanup to the regulator set_mode sysfs support:
> > switch to sysfs_streq() in set_mode(), which is also
> > a code shrink.  Use the same strings that get_mode()
> > uses, shrinking data too.
> >
> > Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
> > ---
> >  drivers/regulator/virtual.c |    8 ++++----
> >  1 file changed, 4 insertions(+), 4 deletions(-)
> >
> > --- a/drivers/regulator/virtual.c
> > +++ b/drivers/regulator/virtual.c
> > @@ -226,13 +226,13 @@ static ssize_t set_mode(struct device *d
> >  	unsigned int mode;
> >  	int ret;
> >
> > -	if (strncmp(buf, "fast", strlen("fast")) == 0)
> > +	if (sysfs_streq(buf, "fast\n") == 0)
> >  		mode = REGULATOR_MODE_FAST;
> > -	else if (strncmp(buf, "normal", strlen("normal")) == 0)
> > +	else if (sysfs_streq(buf, "normal\n") == 0)
> >  		mode = REGULATOR_MODE_NORMAL;
> > -	else if (strncmp(buf, "idle", strlen("idle")) == 0)
> > +	else if (sysfs_streq(buf, "idle\n") == 0)
> >  		mode = REGULATOR_MODE_IDLE;
> > -	else if (strncmp(buf, "standby", strlen("standby")) == 0)
> > +	else if (sysfs_streq(buf, "standby\n") == 0)
> >  		mode = REGULATOR_MODE_STANDBY;
>
> we don't need the \n's, do we?

oh, it's for the string sharing.  Sneaky.

I wonder how many people will try to fix that up for us?

Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>

Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
2009-03-31 09:56:20 +01:00
David Brownell
93e14baa44 regulator: minor cleanup of virtual consumer
Minor cleanup to the regulator set_mode sysfs support:
switch to sysfs_streq() in set_mode(), which is also
a code shrink.  Use the same strings that get_mode()
uses, shrinking data too.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
2009-03-31 09:56:19 +01:00
Mark Brown
c080909eef regulator: regulator test harness
This provides a virtual regulator test harness which exposes a sysfs
interface for setting power requirements, intended for test purposes only.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Philipp Zabel <philipp.zabel@gmail.com>
Signed-off-by: Liam Girdwood <lg@opensource.wolfsonmicro.com>
2008-07-30 10:10:21 +01:00