Commit ca455faf authored by Alexander Usyskin's avatar Alexander Usyskin Committed by Greg Kroah-Hartman

mei: amthif: drop READ_COMPLETE state

AMTHIF code now uses read completed queue to store replies from the FW.
It is possible to send the next request as soon as a read from the FW is
completed. With these changes we don't need the READ_COMPLETE state.
Signed-off-by: default avatarAlexander Usyskin <alexander.usyskin@intel.com>
Signed-off-by: default avatarTomas Winkler <tomas.winkler@intel.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 2f9cc12b
...@@ -299,8 +299,7 @@ int mei_amthif_write(struct mei_cl *cl, struct mei_cl_cb *cb) ...@@ -299,8 +299,7 @@ int mei_amthif_write(struct mei_cl *cl, struct mei_cl_cb *cb)
/* /*
* The previous request is still in processing, queue this one. * The previous request is still in processing, queue this one.
*/ */
if (dev->iamthif_state > MEI_IAMTHIF_IDLE && if (dev->iamthif_state != MEI_IAMTHIF_IDLE)
dev->iamthif_state < MEI_IAMTHIF_READ_COMPLETE)
return 0; return 0;
return mei_amthif_run_next_cmd(dev); return mei_amthif_run_next_cmd(dev);
...@@ -309,7 +308,6 @@ int mei_amthif_write(struct mei_cl *cl, struct mei_cl_cb *cb) ...@@ -309,7 +308,6 @@ int mei_amthif_write(struct mei_cl *cl, struct mei_cl_cb *cb)
/** /**
* mei_amthif_poll - the amthif poll function * mei_amthif_poll - the amthif poll function
* *
* @dev: the device structure
* @file: pointer to file structure * @file: pointer to file structure
* @wait: pointer to poll_table structure * @wait: pointer to poll_table structure
* *
...@@ -317,26 +315,19 @@ int mei_amthif_write(struct mei_cl *cl, struct mei_cl_cb *cb) ...@@ -317,26 +315,19 @@ int mei_amthif_write(struct mei_cl *cl, struct mei_cl_cb *cb)
* *
* Locking: called under "dev->device_lock" lock * Locking: called under "dev->device_lock" lock
*/ */
unsigned int mei_amthif_poll(struct file *file, poll_table *wait)
unsigned int mei_amthif_poll(struct mei_device *dev,
struct file *file, poll_table *wait)
{ {
struct mei_cl *cl = file->private_data;
struct mei_cl_cb *cb = mei_cl_read_cb(cl, file);
unsigned int mask = 0; unsigned int mask = 0;
poll_wait(file, &dev->iamthif_cl.rx_wait, wait); poll_wait(file, &cl->rx_wait, wait);
if (cb)
if (dev->iamthif_state == MEI_IAMTHIF_READ_COMPLETE &&
dev->iamthif_fp == file) {
mask |= POLLIN | POLLRDNORM; mask |= POLLIN | POLLRDNORM;
mei_amthif_run_next_cmd(dev);
}
return mask; return mask;
} }
/** /**
* mei_amthif_irq_write - write iamthif command in irq thread context. * mei_amthif_irq_write - write iamthif command in irq thread context.
* *
...@@ -393,7 +384,6 @@ int mei_amthif_irq_read_msg(struct mei_cl *cl, ...@@ -393,7 +384,6 @@ int mei_amthif_irq_read_msg(struct mei_cl *cl,
return 0; return 0;
dev_dbg(dev->dev, "completed amthif read.\n "); dev_dbg(dev->dev, "completed amthif read.\n ");
dev->iamthif_current_cb = NULL;
dev->iamthif_stall_timer = 0; dev->iamthif_stall_timer = 0;
return 0; return 0;
...@@ -425,14 +415,16 @@ void mei_amthif_complete(struct mei_cl *cl, struct mei_cl_cb *cb) ...@@ -425,14 +415,16 @@ void mei_amthif_complete(struct mei_cl *cl, struct mei_cl_cb *cb)
} }
if (!dev->iamthif_canceled) { if (!dev->iamthif_canceled) {
dev->iamthif_state = MEI_IAMTHIF_READ_COMPLETE;
dev->iamthif_stall_timer = 0;
list_add_tail(&cb->list, &cl->rd_completed); list_add_tail(&cb->list, &cl->rd_completed);
dev_dbg(dev->dev, "amthif read completed\n"); dev_dbg(dev->dev, "amthif read completed\n");
} else { } else {
mei_amthif_run_next_cmd(dev); mei_io_cb_free(cb);
} }
dev->iamthif_current_cb = NULL;
dev->iamthif_stall_timer = 0;
mei_amthif_run_next_cmd(dev);
dev_dbg(dev->dev, "completing amthif call back.\n"); dev_dbg(dev->dev, "completing amthif call back.\n");
wake_up_interruptible(&cl->rx_wait); wake_up_interruptible(&cl->rx_wait);
} }
...@@ -539,10 +531,6 @@ int mei_amthif_release(struct mei_device *dev, struct file *file) ...@@ -539,10 +531,6 @@ int mei_amthif_release(struct mei_device *dev, struct file *file)
dev_dbg(dev->dev, "amthif canceled iamthif state %d\n", dev_dbg(dev->dev, "amthif canceled iamthif state %d\n",
dev->iamthif_state); dev->iamthif_state);
dev->iamthif_canceled = true; dev->iamthif_canceled = true;
if (dev->iamthif_state == MEI_IAMTHIF_READ_COMPLETE) {
dev_dbg(dev->dev, "run next amthif iamthif cb\n");
mei_amthif_run_next_cmd(dev);
}
} }
if (mei_clear_lists(dev, file)) if (mei_clear_lists(dev, file))
......
...@@ -610,7 +610,7 @@ static unsigned int mei_poll(struct file *file, poll_table *wait) ...@@ -610,7 +610,7 @@ static unsigned int mei_poll(struct file *file, poll_table *wait)
} }
if (cl == &dev->iamthif_cl) { if (cl == &dev->iamthif_cl) {
mask = mei_amthif_poll(dev, file, wait); mask = mei_amthif_poll(file, wait);
goto out; goto out;
} }
......
...@@ -80,9 +80,7 @@ const char *mei_dev_state_str(int state); ...@@ -80,9 +80,7 @@ const char *mei_dev_state_str(int state);
enum iamthif_states { enum iamthif_states {
MEI_IAMTHIF_IDLE, MEI_IAMTHIF_IDLE,
MEI_IAMTHIF_WRITING, MEI_IAMTHIF_WRITING,
MEI_IAMTHIF_FLOW_CONTROL,
MEI_IAMTHIF_READING, MEI_IAMTHIF_READING,
MEI_IAMTHIF_READ_COMPLETE
}; };
enum mei_file_transaction_states { enum mei_file_transaction_states {
...@@ -572,8 +570,7 @@ int mei_amthif_host_init(struct mei_device *dev, struct mei_me_client *me_cl); ...@@ -572,8 +570,7 @@ int mei_amthif_host_init(struct mei_device *dev, struct mei_me_client *me_cl);
int mei_amthif_read(struct mei_device *dev, struct file *file, int mei_amthif_read(struct mei_device *dev, struct file *file,
char __user *ubuf, size_t length, loff_t *offset); char __user *ubuf, size_t length, loff_t *offset);
unsigned int mei_amthif_poll(struct mei_device *dev, unsigned int mei_amthif_poll(struct file *file, poll_table *wait);
struct file *file, poll_table *wait);
int mei_amthif_release(struct mei_device *dev, struct file *file); int mei_amthif_release(struct mei_device *dev, struct file *file);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment