From: David Brownell Date: Wed, 14 Jan 2009 21:16:27 +0000 (-0800) Subject: regulator: minor cleanup of virtual consumer X-Git-Tag: v2.6.30-rc1~227^2~31 X-Git-Url: https://asedeno.scripts.mit.edu/gitweb/?a=commitdiff_plain;h=93e14baa4494607efe81608725f591e3ba31e3c1;p=linux.git 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 Acked-by: Mark Brown Signed-off-by: Liam Girdwood --- diff --git a/drivers/regulator/virtual.c b/drivers/regulator/virtual.c index 5ddb464b1c3f..a38d42bc8f8f 100644 --- a/drivers/regulator/virtual.c +++ b/drivers/regulator/virtual.c @@ -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");