Skip to content

Commit

Permalink
regulator: minor cleanup of virtual consumer
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
David Brownell authored and Liam Girdwood committed Mar 31, 2009
1 parent 15f7176 commit 93e14ba
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions drivers/regulator/virtual.c
Original file line number Diff line number Diff line change
Expand Up @@ -226,13 +226,13 @@ static ssize_t set_mode(struct device *dev, struct device_attribute *attr,
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;
else {
dev_err(dev, "Configuring invalid mode\n");
Expand Down

0 comments on commit 93e14ba

Please sign in to comment.