From 285e2996655b7bbfb5eb83076a7d7e6f03e2f5c2 Mon Sep 17 00:00:00 2001 From: Alexander Usyskin Date: Mon, 17 Feb 2014 15:13:20 +0200 Subject: mei: hbm: revamp client connect and disconnection status 1. Return -ENOTTY on client connect if the requested client was not found on the enumeration list or the client was internally disabled, in the later case FW will return NOT_FOUND. 2. Return -EBUSY if the client cannot be connected because of resource contention 3. Change response status enum to have MEI_CL_ prefix 4. Add function to translate response status to a string for more readable logging Signed-off-by: Alexander Usyskin Signed-off-by: Tomas Winkler Signed-off-by: Greg Kroah-Hartman --- drivers/misc/mei/client.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'drivers/misc/mei/client.c') diff --git a/drivers/misc/mei/client.c b/drivers/misc/mei/client.c index 9ac72f1ea6b9..8afba0534779 100644 --- a/drivers/misc/mei/client.c +++ b/drivers/misc/mei/client.c @@ -521,18 +521,19 @@ int mei_cl_connect(struct mei_cl *cl, struct file *file) } mutex_unlock(&dev->device_lock); - rets = wait_event_timeout(dev->wait_recvd_msg, - (cl->state == MEI_FILE_CONNECTED || - cl->state == MEI_FILE_DISCONNECTED), - mei_secs_to_jiffies(MEI_CL_CONNECT_TIMEOUT)); + wait_event_timeout(dev->wait_recvd_msg, + (cl->state == MEI_FILE_CONNECTED || + cl->state == MEI_FILE_DISCONNECTED), + mei_secs_to_jiffies(MEI_CL_CONNECT_TIMEOUT)); mutex_lock(&dev->device_lock); if (cl->state != MEI_FILE_CONNECTED) { - rets = -EFAULT; + /* something went really wrong */ + if (!cl->status) + cl->status = -EFAULT; mei_io_list_flush(&dev->ctrl_rd_list, cl); mei_io_list_flush(&dev->ctrl_wr_list, cl); - goto out; } rets = cl->status; -- cgit v1.2.3