aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/misc/mei/main.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2017-02-22 14:38:22 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2017-02-22 14:38:22 -0500
commite30aee9e10bb5168579e047f05c3d13d09e23356 (patch)
tree12371bdcd52d2427cad838201997479e31b6a9c9 /drivers/misc/mei/main.c
parent8ff546b801e5cca0337c0f0a7234795d0a6309a1 (diff)
parent6cf18e6927c0b224f972e3042fb85770d63cb9f8 (diff)
Merge tag 'char-misc-4.11-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc
Pull char/misc driver updates from Greg KH: "Here is the big char/misc driver patchset for 4.11-rc1. Lots of different driver subsystems updated here: rework for the hyperv subsystem to handle new platforms better, mei and w1 and extcon driver updates, as well as a number of other "minor" driver updates. All of these have been in linux-next for a while with no reported issues" * tag 'char-misc-4.11-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc: (169 commits) goldfish: Sanitize the broken interrupt handler x86/platform/goldfish: Prevent unconditional loading vmbus: replace modulus operation with subtraction vmbus: constify parameters where possible vmbus: expose hv_begin/end_read vmbus: remove conditional locking of vmbus_write vmbus: add direct isr callback mode vmbus: change to per channel tasklet vmbus: put related per-cpu variable together vmbus: callback is in softirq not workqueue binder: Add support for file-descriptor arrays binder: Add support for scatter-gather binder: Add extra size to allocator binder: Refactor binder_transact() binder: Support multiple /dev instances binder: Deal with contexts in debugfs binder: Support multiple context managers binder: Split flat_binder_object auxdisplay: ht16k33: remove private workqueue auxdisplay: ht16k33: rework input device initialization ...
Diffstat (limited to 'drivers/misc/mei/main.c')
-rw-r--r--drivers/misc/mei/main.c48
1 files changed, 26 insertions, 22 deletions
diff --git a/drivers/misc/mei/main.c b/drivers/misc/mei/main.c
index e1bf54481fd6..9d0b7050c79a 100644
--- a/drivers/misc/mei/main.c
+++ b/drivers/misc/mei/main.c
@@ -182,32 +182,36 @@ static ssize_t mei_read(struct file *file, char __user *ubuf,
182 goto out; 182 goto out;
183 } 183 }
184 184
185 if (rets == -EBUSY &&
186 !mei_cl_enqueue_ctrl_wr_cb(cl, length, MEI_FOP_READ, file)) {
187 rets = -ENOMEM;
188 goto out;
189 }
190 185
191 do { 186again:
192 mutex_unlock(&dev->device_lock); 187 mutex_unlock(&dev->device_lock);
193 188 if (wait_event_interruptible(cl->rx_wait,
194 if (wait_event_interruptible(cl->rx_wait, 189 !list_empty(&cl->rd_completed) ||
195 (!list_empty(&cl->rd_completed)) || 190 !mei_cl_is_connected(cl))) {
196 (!mei_cl_is_connected(cl)))) { 191 if (signal_pending(current))
192 return -EINTR;
193 return -ERESTARTSYS;
194 }
195 mutex_lock(&dev->device_lock);
197 196
198 if (signal_pending(current)) 197 if (!mei_cl_is_connected(cl)) {
199 return -EINTR; 198 rets = -ENODEV;
200 return -ERESTARTSYS; 199 goto out;
201 } 200 }
202 201
203 mutex_lock(&dev->device_lock); 202 cb = mei_cl_read_cb(cl, file);
204 if (!mei_cl_is_connected(cl)) { 203 if (!cb) {
205 rets = -ENODEV; 204 /*
206 goto out; 205 * For amthif all the waiters are woken up,
207 } 206 * but only fp with matching cb->fp get the cb,
207 * the others have to return to wait on read.
208 */
209 if (cl == &dev->iamthif_cl)
210 goto again;
208 211
209 cb = mei_cl_read_cb(cl, file); 212 rets = 0;
210 } while (!cb); 213 goto out;
214 }
211 215
212copy_buffer: 216copy_buffer:
213 /* now copy the data to user space */ 217 /* now copy the data to user space */