aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/regulator/virtual.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/regulator/virtual.c')
-rw-r--r--drivers/regulator/virtual.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/drivers/regulator/virtual.c b/drivers/regulator/virtual.c
index 5ddb464b1c3f..3d08348584e1 100644
--- a/drivers/regulator/virtual.c
+++ b/drivers/regulator/virtual.c
@@ -226,13 +226,17 @@ 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 if (strncmp(buf, "fast", strlen("fast")) == 0) 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 */
233 if (sysfs_streq(buf, "fast\n") == 0)
230 mode = REGULATOR_MODE_FAST; 234 mode = REGULATOR_MODE_FAST;
231 else if (strncmp(buf, "normal", strlen("normal")) == 0) 235 else if (sysfs_streq(buf, "normal\n") == 0)
232 mode = REGULATOR_MODE_NORMAL; 236 mode = REGULATOR_MODE_NORMAL;
233 else if (strncmp(buf, "idle", strlen("idle")) == 0) 237 else if (sysfs_streq(buf, "idle\n") == 0)
234 mode = REGULATOR_MODE_IDLE; 238 mode = REGULATOR_MODE_IDLE;
235 else if (strncmp(buf, "standby", strlen("standby")) == 0) 239 else if (sysfs_streq(buf, "standby\n") == 0)
236 mode = REGULATOR_MODE_STANDBY; 240 mode = REGULATOR_MODE_STANDBY;
237 else { 241 else {
238 dev_err(dev, "Configuring invalid mode\n"); 242 dev_err(dev, "Configuring invalid mode\n");
@@ -256,7 +260,7 @@ static DEVICE_ATTR(min_microamps, 0666, show_min_uA, set_min_uA);
256static DEVICE_ATTR(max_microamps, 0666, show_max_uA, set_max_uA); 260static DEVICE_ATTR(max_microamps, 0666, show_max_uA, set_max_uA);
257static DEVICE_ATTR(mode, 0666, show_mode, set_mode); 261static DEVICE_ATTR(mode, 0666, show_mode, set_mode);
258 262
259struct device_attribute *attributes[] = { 263static struct device_attribute *attributes[] = {
260 &dev_attr_min_microvolts, 264 &dev_attr_min_microvolts,
261 &dev_attr_max_microvolts, 265 &dev_attr_max_microvolts,
262 &dev_attr_min_microamps, 266 &dev_attr_min_microamps,