aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/regulator
diff options
context:
space:
mode:
authorAndrew Morton <akpm@linux-foundation.org>2009-01-15 19:13:01 -0500
committerLiam Girdwood <lrg@slimlogic.co.uk>2009-03-31 04:56:20 -0400
commit9485397aa2195e82da6373586a66689526675ad4 (patch)
treeead9aa2618f292088105269b0c6652f30c8aee62 /drivers/regulator
parent853116a10544206b6b2cf42ebc9d78fba2668888 (diff)
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>
Diffstat (limited to 'drivers/regulator')
-rw-r--r--drivers/regulator/virtual.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/regulator/virtual.c b/drivers/regulator/virtual.c
index a38d42bc8f8f..45ebbc22f470 100644
--- a/drivers/regulator/virtual.c
+++ b/drivers/regulator/virtual.c
@@ -226,6 +226,10 @@ static ssize_t set_mode(struct device *dev, struct device_attribute *attr,
226 unsigned int mode; 226 unsigned int mode;
227 int ret; 227 int ret;
228 228
229 /*
230 * sysfs_streq() doesn't need the \n's, but we add them so the strings
231 * will be shared with show_mode(), above.
232 */
229 if (sysfs_streq(buf, "fast\n") == 0) 233 if (sysfs_streq(buf, "fast\n") == 0)
230 mode = REGULATOR_MODE_FAST; 234 mode = REGULATOR_MODE_FAST;
231 else if (sysfs_streq(buf, "normal\n") == 0) 235 else if (sysfs_streq(buf, "normal\n") == 0)