mei: set connecting state just upon connection request is sent to the fw
authorAlexander Usyskin <alexander.usyskin@intel.com>
Sun, 27 Apr 2014 12:42:21 +0000 (15:42 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 3 May 2014 23:21:56 +0000 (19:21 -0400)
Adding power gating introduced new waiting state for client also during
connection attempt, a connection request can be queued for later either due
device is power gated or due to other on going connection.
We setting client connection state before start of full connect procedure so
in both cased the client state will be MEI_FILE_CONNECTING
which create interlock between the two connection attempts, both
detecting that another connection is in progress.

The interlock is resolved by moving client to connecting state
only upon connection request transmission, so the  first
cb in queue can be processed.

Signed-off-by: Alexander Usyskin <alexander.usyskin@intel.com>
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/misc/mei/amthif.c
drivers/misc/mei/bus.c
drivers/misc/mei/client.c
drivers/misc/mei/main.c
drivers/misc/mei/wd.c

index b8deb345548057b86d2bac1cfe4e478fecc07d21..0d6234db00fa126330a664007e4093aac14a6190 100644 (file)
@@ -111,8 +111,6 @@ int mei_amthif_host_init(struct mei_device *dev)
                return ret;
        }
 
-       cl->state = MEI_FILE_CONNECTING;
-
        ret = mei_cl_connect(cl, NULL);
 
        dev->iamthif_state = MEI_IAMTHIF_IDLE;
index d5b9ed4452ef5d7b7feed24b4772d2269fd542ed..0e993ef28b94ff23272b0a3d2f57e87f73da6c3b 100644 (file)
@@ -427,8 +427,6 @@ int mei_cl_enable_device(struct mei_cl_device *device)
 
        mutex_lock(&dev->device_lock);
 
-       cl->state = MEI_FILE_CONNECTING;
-
        err = mei_cl_connect(cl, NULL);
        if (err < 0) {
                mutex_unlock(&dev->device_lock);
index 3349f626aa88eae8d4037a5051a32e1f19c9589a..59d20c599b16570aad2e0b9da61718fab05816b4 100644 (file)
@@ -597,6 +597,7 @@ int mei_cl_connect(struct mei_cl *cl, struct file *file)
 
        /* run hbuf acquire last so we don't have to undo */
        if (!mei_cl_is_other_connecting(cl) && mei_hbuf_acquire(dev)) {
+               cl->state = MEI_FILE_CONNECTING;
                if (mei_hbm_cl_connect_req(dev, cl)) {
                        rets = -ENODEV;
                        goto out;
index 147413145c97d8a4af71e6a5b555a99cbc23c959..66f0a1a0645143b6b37d143b8fbfc43ce7a7d9a7 100644 (file)
@@ -467,7 +467,6 @@ static int mei_ioctl_connect_client(struct file *file,
        }
 
        cl->me_client_id = dev->me_clients[i].client_id;
-       cl->state = MEI_FILE_CONNECTING;
 
        dev_dbg(&dev->pdev->dev, "Connect to FW Client ID = %d\n",
                        cl->me_client_id);
index ebf1cbc198fd342d85541ae713f045867c52eaaa..a84a664dfccb281746e0932a004905bb459074d6 100644 (file)
@@ -84,8 +84,6 @@ int mei_wd_host_init(struct mei_device *dev)
                return ret;
        }
 
-       cl->state = MEI_FILE_CONNECTING;
-
        ret = mei_cl_connect(cl, NULL);
 
        if (ret) {