remarkable-linux/drivers/regulator
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
..
bq24022.c regulator: move bq24022 init back to module_init instead of subsys_initcall 2009-01-30 21:50:49 +00:00
core.c regulator: add get_status() 2009-03-31 09:56:20 +01:00
da903x.c regulator: da903x: make da903x_is_enabled return 0 or 1 2009-01-08 20:10:31 +00:00
fixed.c
Kconfig regulator: PCF50633 pmic driver 2009-01-11 01:34:25 +01:00
Makefile regulator: PCF50633 pmic driver 2009-01-11 01:34:25 +01:00
pcf50633-regulator.c regulator: PCF50633 pmic driver 2009-01-11 01:34:25 +01:00
virtual.c regulator: minor cleanup of virtual consumer 2009-03-31 09:56:20 +01:00
wm8350-regulator.c leds: Fix bounds checking of wm8350->pmic.led 2009-01-30 21:50:49 +00:00
wm8400-regulator.c move wm8400-regulator's probe function to .devinit.text 2009-01-17 13:46:40 +00:00