mei: bus: move driver api functions at the start of the file
authorAlexander Usyskin <alexander.usyskin@intel.com>
Sun, 7 Feb 2016 21:35:32 +0000 (23:35 +0200)
committerSasha Levin <sasha.levin@oracle.com>
Mon, 18 Apr 2016 12:50:35 +0000 (08:50 -0400)
[ Upstream commit 6238299774377b12c3e24507b100b2687eb5ea32 ]

To make the file more organize move mei client driver api
to the start of the file and add Kdoc.

There are no functional changes in this patch.

Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
drivers/misc/mei/bus.c

index 4cf38c3..883ba74 100644 (file)
@@ -238,6 +238,11 @@ static ssize_t ___mei_cl_send(struct mei_cl *cl, u8 *buf, size_t length,
        dev = cl->dev;
 
        mutex_lock(&dev->device_lock);
+       if (dev->dev_state != MEI_DEV_ENABLED) {
+               rets = -ENODEV;
+               goto out;
+       }
+
        if (!mei_cl_is_connected(cl)) {
                rets = -ENODEV;
                goto out;
@@ -287,6 +292,10 @@ ssize_t __mei_cl_recv(struct mei_cl *cl, u8 *buf, size_t length)
        dev = cl->dev;
 
        mutex_lock(&dev->device_lock);
+       if (dev->dev_state != MEI_DEV_ENABLED) {
+               rets = -ENODEV;
+               goto out;
+       }
 
        cb = mei_cl_read_cb(cl, NULL);
        if (cb)