diff options
author | Tomas Winkler <tomas.winkler@intel.com> | 2015-03-26 18:27:59 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2015-04-03 10:18:56 -0400 |
commit | 6a84d63d22a0ac79ab422b69ef2b4d75002c5641 (patch) | |
tree | 0272d21b8d66df5759a2c8e0f0d0a18f90ec812a /drivers/misc | |
parent | f3de9b635d93a3d268adda428e1df94091506a42 (diff) |
mei: replace check for connection instead of transitioning
The function mei_cl_is_transitioning is just opposite
of mei_cl_is_connected. What we actually wanted to
check is if we lost connection so we can discard
the check for transition and check for 'not connected'
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/misc')
-rw-r--r-- | drivers/misc/mei/bus.c | 4 | ||||
-rw-r--r-- | drivers/misc/mei/client.h | 14 | ||||
-rw-r--r-- | drivers/misc/mei/main.c | 4 |
3 files changed, 12 insertions, 10 deletions
diff --git a/drivers/misc/mei/bus.c b/drivers/misc/mei/bus.c index b724a67696fc..4cf38c39878a 100644 --- a/drivers/misc/mei/bus.c +++ b/drivers/misc/mei/bus.c | |||
@@ -302,7 +302,7 @@ ssize_t __mei_cl_recv(struct mei_cl *cl, u8 *buf, size_t length) | |||
302 | 302 | ||
303 | if (wait_event_interruptible(cl->rx_wait, | 303 | if (wait_event_interruptible(cl->rx_wait, |
304 | (!list_empty(&cl->rd_completed)) || | 304 | (!list_empty(&cl->rd_completed)) || |
305 | mei_cl_is_transitioning(cl))) { | 305 | (!mei_cl_is_connected(cl)))) { |
306 | 306 | ||
307 | if (signal_pending(current)) | 307 | if (signal_pending(current)) |
308 | return -EINTR; | 308 | return -EINTR; |
@@ -311,7 +311,7 @@ ssize_t __mei_cl_recv(struct mei_cl *cl, u8 *buf, size_t length) | |||
311 | 311 | ||
312 | mutex_lock(&dev->device_lock); | 312 | mutex_lock(&dev->device_lock); |
313 | 313 | ||
314 | if (mei_cl_is_transitioning(cl)) { | 314 | if (!mei_cl_is_connected(cl)) { |
315 | rets = -EBUSY; | 315 | rets = -EBUSY; |
316 | goto out; | 316 | goto out; |
317 | } | 317 | } |
diff --git a/drivers/misc/mei/client.h b/drivers/misc/mei/client.h index 7800d1bd8ba1..0a39e5d45171 100644 --- a/drivers/misc/mei/client.h +++ b/drivers/misc/mei/client.h | |||
@@ -90,16 +90,18 @@ int mei_cl_flow_ctrl_reduce(struct mei_cl *cl); | |||
90 | /* | 90 | /* |
91 | * MEI input output function prototype | 91 | * MEI input output function prototype |
92 | */ | 92 | */ |
93 | |||
94 | /** | ||
95 | * mei_cl_is_connected - host client is connected | ||
96 | * | ||
97 | * @cl: host clinet | ||
98 | * | ||
99 | * Return: true if the host clinet is connected | ||
100 | */ | ||
93 | static inline bool mei_cl_is_connected(struct mei_cl *cl) | 101 | static inline bool mei_cl_is_connected(struct mei_cl *cl) |
94 | { | 102 | { |
95 | return cl->state == MEI_FILE_CONNECTED; | 103 | return cl->state == MEI_FILE_CONNECTED; |
96 | } | 104 | } |
97 | static inline bool mei_cl_is_transitioning(struct mei_cl *cl) | ||
98 | { | ||
99 | return MEI_FILE_INITIALIZING == cl->state || | ||
100 | MEI_FILE_DISCONNECTED == cl->state || | ||
101 | MEI_FILE_DISCONNECTING == cl->state; | ||
102 | } | ||
103 | 105 | ||
104 | bool mei_cl_is_other_connecting(struct mei_cl *cl); | 106 | bool mei_cl_is_other_connecting(struct mei_cl *cl); |
105 | int mei_cl_disconnect(struct mei_cl *cl); | 107 | int mei_cl_disconnect(struct mei_cl *cl); |
diff --git a/drivers/misc/mei/main.c b/drivers/misc/mei/main.c index 29fa88b6fa17..7f77f39c24a7 100644 --- a/drivers/misc/mei/main.c +++ b/drivers/misc/mei/main.c | |||
@@ -203,7 +203,7 @@ static ssize_t mei_read(struct file *file, char __user *ubuf, | |||
203 | 203 | ||
204 | if (wait_event_interruptible(cl->rx_wait, | 204 | if (wait_event_interruptible(cl->rx_wait, |
205 | (!list_empty(&cl->rd_completed)) || | 205 | (!list_empty(&cl->rd_completed)) || |
206 | mei_cl_is_transitioning(cl))) { | 206 | (!mei_cl_is_connected(cl)))) { |
207 | 207 | ||
208 | if (signal_pending(current)) | 208 | if (signal_pending(current)) |
209 | return -EINTR; | 209 | return -EINTR; |
@@ -211,7 +211,7 @@ static ssize_t mei_read(struct file *file, char __user *ubuf, | |||
211 | } | 211 | } |
212 | 212 | ||
213 | mutex_lock(&dev->device_lock); | 213 | mutex_lock(&dev->device_lock); |
214 | if (mei_cl_is_transitioning(cl)) { | 214 | if (!mei_cl_is_connected(cl)) { |
215 | rets = -EBUSY; | 215 | rets = -EBUSY; |
216 | goto out; | 216 | goto out; |
217 | } | 217 | } |