提交 286c2402 编写于 作者: A Ashutosh Dixit 提交者: Greg Kroah-Hartman

misc: mic: Bug fix for sysfs poll usage.

MIC user space daemon poll's on sysfs changes. The documentation for
sysfs_poll(...) in fs/sysfs/file.c states that "Once poll/select
indicates that the value has changed, you need to close and re-open the
file, or seek to 0 and read again". This step was missed out earlier and
resulted in the daemon spinning continuously rather than getting blocked
in 'poll'. This bug was exposed by commit aea585ef introduced as
part of sysfs changes in 3.13-rc1. A seek to 0 has been introduced to
fix it.
Reviewed-by: NSudeep Dutt <sudeep.dutt@intel.com>
Signed-off-by: NAshutosh Dixit <ashutosh.dixit@intel.com>
Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
上级 9420b348
...@@ -1412,6 +1412,12 @@ mic_config(void *arg) ...@@ -1412,6 +1412,12 @@ mic_config(void *arg)
} }
do { do {
ret = lseek(fd, 0, SEEK_SET);
if (ret < 0) {
mpsslog("%s: Failed to seek to file start '%s': %s\n",
mic->name, pathname, strerror(errno));
goto close_error1;
}
ret = read(fd, value, sizeof(value)); ret = read(fd, value, sizeof(value));
if (ret < 0) { if (ret < 0) {
mpsslog("%s: Failed to read sysfs entry '%s': %s\n", mpsslog("%s: Failed to read sysfs entry '%s': %s\n",
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册