mei: rename to mei_host_buffer_is_empty to hbuf_is_ready
authorTomas Winkler <tomas.winkler@intel.com>
Wed, 6 Feb 2013 12:06:43 +0000 (14:06 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 6 Feb 2013 19:24:33 +0000 (11:24 -0800)
we rename the mei_host_buffer_is_empty to keep naming
convention of hbuf and also make the query more generic
to be correct also for other under laying hardware

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/client.c
drivers/misc/mei/hw-me.c
drivers/misc/mei/main.c
drivers/misc/mei/mei_dev.h
drivers/misc/mei/wd.c

index a7c4838500838c16b58ec30b05ba5a7af92cb32d..c86d7e3839a43b995fc8f8fb456a688a0d1b2cd3 100644 (file)
@@ -297,9 +297,9 @@ static int mei_amthif_send_cmd(struct mei_device *dev, struct mei_cl_cb *cb)
        if (ret < 0)
                return ret;
 
-       if (ret && dev->mei_host_buffer_is_empty) {
+       if (ret && dev->hbuf_is_ready) {
                ret = 0;
-               dev->mei_host_buffer_is_empty = false;
+               dev->hbuf_is_ready = false;
                if (cb->request_buffer.size > mei_hbuf_max_len(dev)) {
                        mei_hdr.length = mei_hbuf_max_len(dev);
                        mei_hdr.msg_complete = 0;
@@ -330,7 +330,7 @@ static int mei_amthif_send_cmd(struct mei_device *dev, struct mei_cl_cb *cb)
                        list_add_tail(&cb->list, &dev->write_list.list);
                }
        } else {
-               if (!(dev->mei_host_buffer_is_empty))
+               if (!dev->hbuf_is_ready)
                        dev_dbg(&dev->pdev->dev, "host buffer is not empty");
 
                dev_dbg(&dev->pdev->dev, "No flow control credentials, so add iamthif cb to write list.\n");
@@ -583,7 +583,7 @@ int mei_amthif_irq_read(struct mei_device *dev, s32 *slots)
        dev->iamthif_msg_buf_index = 0;
        dev->iamthif_msg_buf_size = 0;
        dev->iamthif_stall_timer = MEI_IAMTHIF_STALL_TIMER;
-       dev->mei_host_buffer_is_empty = mei_hbuf_is_ready(dev);
+       dev->hbuf_is_ready = mei_hbuf_is_ready(dev);
        return 0;
 }
 
index a921001053ba296ce652ceda8afc3696b0479e09..e46663ee76de40f0f775c030770d24f3677f3cbe 100644 (file)
@@ -393,8 +393,8 @@ int mei_cl_disconnect(struct mei_cl *cl)
                return -ENOMEM;
 
        cb->fop_type = MEI_FOP_CLOSE;
-       if (dev->mei_host_buffer_is_empty) {
-               dev->mei_host_buffer_is_empty = false;
+       if (dev->hbuf_is_ready) {
+               dev->hbuf_is_ready = false;
                if (mei_hbm_cl_disconnect_req(dev, cl)) {
                        rets = -ENODEV;
                        dev_err(&dev->pdev->dev, "failed to disconnect.\n");
@@ -496,9 +496,8 @@ int mei_cl_connect(struct mei_cl *cl, struct file *file)
 
        cb->fop_type = MEI_FOP_IOCTL;
 
-       if (dev->mei_host_buffer_is_empty &&
-           !mei_cl_is_other_connecting(cl)) {
-               dev->mei_host_buffer_is_empty = false;
+       if (dev->hbuf_is_ready && !mei_cl_is_other_connecting(cl)) {
+               dev->hbuf_is_ready = false;
 
                if (mei_hbm_cl_connect_req(dev, cl)) {
                        rets = -ENODEV;
@@ -661,8 +660,8 @@ int mei_cl_read_start(struct mei_cl *cl)
 
        cb->fop_type = MEI_FOP_READ;
        cl->read_cb = cb;
-       if (dev->mei_host_buffer_is_empty) {
-               dev->mei_host_buffer_is_empty = false;
+       if (dev->hbuf_is_ready) {
+               dev->hbuf_is_ready = false;
                if (mei_hbm_cl_flow_control_req(dev, cl)) {
                        rets = -ENODEV;
                        goto err;
index 3bebf8d85ff9b024a2ef864562a78a0b88d15a80..45ea7185c003d5b5deee66ad1a274c23212ed77f 100644 (file)
@@ -486,7 +486,7 @@ irqreturn_t mei_me_irq_thread_handler(int irq, void *dev_id)
        rets = mei_irq_write_handler(dev, &complete_list);
 end:
        dev_dbg(&dev->pdev->dev, "end of bottom half function.\n");
-       dev->mei_host_buffer_is_empty = mei_hbuf_is_ready(dev);
+       dev->hbuf_is_ready = mei_hbuf_is_ready(dev);
 
        bus_message_received = false;
        if (dev->recvd_msg && waitqueue_active(&dev->wait_recvd_msg)) {
index 843ae2febc703451b908cdb7348f76e5b75f13ea..903f809b21f79302fedca41a843f6add85ebe12c 100644 (file)
@@ -454,14 +454,14 @@ static ssize_t mei_write(struct file *file, const char __user *ubuf,
        if (rets < 0)
                goto err;
 
-       if (rets == 0 || dev->mei_host_buffer_is_empty == false) {
+       if (rets == 0 || !dev->hbuf_is_ready) {
                write_cb->buf_idx = 0;
                mei_hdr.msg_complete = 0;
                cl->writing_state = MEI_WRITING;
                goto out;
        }
 
-       dev->mei_host_buffer_is_empty = false;
+       dev->hbuf_is_ready = false;
        if (length >  mei_hbuf_max_len(dev)) {
                mei_hdr.length = mei_hbuf_max_len(dev);
                mei_hdr.msg_complete = 0;
index 7d07cef7566492366bc6cad436fd3c5615aef045..cb80166161f0f82ad725e1073baf1bc607fcc6bf 100644 (file)
@@ -265,9 +265,13 @@ struct mei_hw_ops {
 
 /**
  * struct mei_device -  MEI private device struct
+
  * @mem_addr - mem mapped base register address
- * @hbuf_depth - depth of host(write) buffer
- * @wr_ext_msg - buffer for hbm control responses (set in read cycle)
+
+ * @hbuf_depth - depth of hardware host/write buffer is slots
+ * @hbuf_is_ready - query if the host host/write buffer is ready
+ * @wr_msg - the buffer for hbm control messages
+ * @wr_ext_msg - the buffer for hbm control responses (set in read cycle)
  */
 struct mei_device {
        struct pci_dev *pdev;   /* pointer to pci device struct */
@@ -294,7 +298,6 @@ struct mei_device {
        struct delayed_work timer_work; /* MEI timer delayed work (timeouts) */
        bool recvd_msg;
 
-       u8  hbuf_depth;
        /*
         * waiting queue for receive message from FW
         */
@@ -311,6 +314,10 @@ struct mei_device {
        unsigned char rd_msg_buf[MEI_RD_MSG_BUF_SIZE];  /* control messages */
        u32 rd_msg_hdr;
 
+       /* write buffer */
+       u8 hbuf_depth;
+       bool hbuf_is_ready;
+
        /* used for control messages */
        struct {
                struct mei_msg_hdr hdr;
@@ -330,7 +337,6 @@ struct mei_device {
        u8 me_clients_num;
        u8 me_client_presentation_num;
        u8 me_client_index;
-       bool mei_host_buffer_is_empty;
 
        struct mei_cl wd_cl;
        enum mei_wd_states wd_state;
index 77b3820380b06d759995e2dcf0a85fe0917c41f3..2413247fc39244f7511b53b31a98c670321ca5fd 100644 (file)
@@ -157,9 +157,9 @@ int mei_wd_stop(struct mei_device *dev)
        if (ret < 0)
                goto out;
 
-       if (ret && dev->mei_host_buffer_is_empty) {
+       if (ret && dev->hbuf_is_ready) {
                ret = 0;
-               dev->mei_host_buffer_is_empty = false;
+               dev->hbuf_is_ready = false;
 
                if (!mei_wd_send(dev)) {
                        ret = mei_cl_flow_ctrl_reduce(&dev->wd_cl);
@@ -282,10 +282,9 @@ static int mei_wd_ops_ping(struct watchdog_device *wd_dev)
        dev->wd_state = MEI_WD_RUNNING;
 
        /* Check if we can send the ping to HW*/
-       if (dev->mei_host_buffer_is_empty &&
-           mei_cl_flow_ctrl_creds(&dev->wd_cl) > 0) {
+       if (dev->hbuf_is_ready && mei_cl_flow_ctrl_creds(&dev->wd_cl) > 0) {
 
-               dev->mei_host_buffer_is_empty = false;
+               dev->hbuf_is_ready = false;
                dev_dbg(&dev->pdev->dev, "wd: sending ping\n");
 
                if (mei_wd_send(dev)) {