mei: use local cl variables in wd and amthif
authorTomas Winkler <tomas.winkler@intel.com>
Thu, 2 Oct 2014 10:39:32 +0000 (13:39 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 3 Nov 2014 23:52:48 +0000 (15:52 -0800)
Use local cl variable instead of dev->iamthif_cl and dev->wd_cl
as the first step to use dynamic allocation of these clients
as their are not supported on all platforms

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/wd.c

index 0b5a3156917cb307953dd183a6241dda0dfc6c46..79f53941779d1f321d96ac6b6727cb13e4d5ded0 100644 (file)
@@ -262,6 +262,7 @@ out:
 static int mei_amthif_send_cmd(struct mei_device *dev, struct mei_cl_cb *cb)
 {
        struct mei_msg_hdr mei_hdr;
+       struct mei_cl *cl;
        int ret;
 
        if (!dev || !cb)
@@ -277,8 +278,9 @@ static int mei_amthif_send_cmd(struct mei_device *dev, struct mei_cl_cb *cb)
        dev->iamthif_msg_buf_size = cb->request_buffer.size;
        memcpy(dev->iamthif_msg_buf, cb->request_buffer.data,
               cb->request_buffer.size);
+       cl = &dev->iamthif_cl;
 
-       ret = mei_cl_flow_ctrl_creds(&dev->iamthif_cl);
+       ret = mei_cl_flow_ctrl_creds(cl);
        if (ret < 0)
                return ret;
 
@@ -292,8 +294,8 @@ static int mei_amthif_send_cmd(struct mei_device *dev, struct mei_cl_cb *cb)
                        mei_hdr.msg_complete = 1;
                }
 
-               mei_hdr.host_addr = dev->iamthif_cl.host_client_id;
-               mei_hdr.me_addr = dev->iamthif_cl.me_client_id;
+               mei_hdr.host_addr = cl->host_client_id;
+               mei_hdr.me_addr = cl->me_client_id;
                mei_hdr.reserved = 0;
                mei_hdr.internal = 0;
                dev->iamthif_msg_buf_index += mei_hdr.length;
@@ -302,7 +304,7 @@ static int mei_amthif_send_cmd(struct mei_device *dev, struct mei_cl_cb *cb)
                        return ret;
 
                if (mei_hdr.msg_complete) {
-                       if (mei_cl_flow_ctrl_reduce(&dev->iamthif_cl))
+                       if (mei_cl_flow_ctrl_reduce(cl))
                                return -EIO;
                        dev->iamthif_flow_control_pending = true;
                        dev->iamthif_state = MEI_IAMTHIF_FLOW_CONTROL;
index b836dfffceb517c6f010bad5aa42bd1dde6b8883..b1d892cea94da2f0733670392429fa09bb1a58ed 100644 (file)
@@ -270,15 +270,18 @@ static int mei_wd_ops_stop(struct watchdog_device *wd_dev)
 static int mei_wd_ops_ping(struct watchdog_device *wd_dev)
 {
        struct mei_device *dev;
+       struct mei_cl *cl;
        int ret;
 
        dev = watchdog_get_drvdata(wd_dev);
        if (!dev)
                return -ENODEV;
 
+       cl = &dev->wd_cl;
+
        mutex_lock(&dev->device_lock);
 
-       if (dev->wd_cl.state != MEI_FILE_CONNECTED) {
+       if (cl->state != MEI_FILE_CONNECTED) {
                dev_err(dev->dev, "wd: not connected.\n");
                ret = -ENODEV;
                goto end;
@@ -286,12 +289,12 @@ static int mei_wd_ops_ping(struct watchdog_device *wd_dev)
 
        dev->wd_state = MEI_WD_RUNNING;
 
-       ret = mei_cl_flow_ctrl_creds(&dev->wd_cl);
+       ret = mei_cl_flow_ctrl_creds(cl);
        if (ret < 0)
                goto end;
+
        /* Check if we can send the ping to HW*/
        if (ret && mei_hbuf_acquire(dev)) {
-
                dev_dbg(dev->dev, "wd: sending ping\n");
 
                ret = mei_wd_send(dev);