Hi! > ...instead of custom approach. > > Signed-off-by: Andy Shevchenko > --- > drivers/base/power/sysfs.c | 39 +++++++++------------------------------ > 1 file changed, 9 insertions(+), 30 deletions(-) > > diff --git a/drivers/base/power/sysfs.c b/drivers/base/power/sysfs.c > index e153e28b1857..662632ac5e0e 100644 > --- a/drivers/base/power/sysfs.c > +++ b/drivers/base/power/sysfs.c > @@ -108,16 +108,10 @@ static ssize_t control_show(struct device *dev, struct device_attribute *attr, > static ssize_t control_store(struct device * dev, struct device_attribute *attr, > const char * buf, size_t n) > { > - char *cp; > - int len = n; > - > - cp = memchr(buf, '\n', n); > - if (cp) > - len = cp - buf; > device_lock(dev); > - if (len == sizeof ctrl_auto - 1 && strncmp(buf, ctrl_auto, len) == 0) > + if (sysfs_streq(buf, ctrl_auto)) > pm_runtime_allow(dev); > - else if (len == sizeof ctrl_on - 1 && strncmp(buf, ctrl_on, len) == 0) > + else if (sysfs_streq(buf, ctrl_on)) > pm_runtime_forbid(dev); > else > n = -EINVAL; Are you sure? _streq does not get passed size_t n; how does it guarantee no out-of-bounds access? Best regards, Pavel -- (english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html