Commit 4b8960b4 authored by Tomas Winkler's avatar Tomas Winkler Committed by Greg Kroah-Hartman

mei: rename enum mei_cb_major_types to enum mei_cb_file_ops

1. Rename mei_cb_major_types to more understandable mei_cb_file_ops
2. Rename member struct mei_cl_cb of this type to simple 'fop_type'
3. Add kernel doc for the type
Signed-off-by: default avatarTomas Winkler <tomas.winkler@intel.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent db3ed431
...@@ -347,7 +347,7 @@ int mei_amthif_write(struct mei_device *dev, struct mei_cl_cb *cb) ...@@ -347,7 +347,7 @@ int mei_amthif_write(struct mei_device *dev, struct mei_cl_cb *cb)
if (ret) if (ret)
return ret; return ret;
cb->major_file_operations = MEI_IOCTL; cb->fop_type = MEI_FOP_IOCTL;
if (!list_empty(&dev->amthif_cmd_list.list) || if (!list_empty(&dev->amthif_cmd_list.list) ||
dev->iamthif_state != MEI_IAMTHIF_IDLE) { dev->iamthif_state != MEI_IAMTHIF_IDLE) {
......
...@@ -597,7 +597,7 @@ int mei_disconnect_host_client(struct mei_device *dev, struct mei_cl *cl) ...@@ -597,7 +597,7 @@ int mei_disconnect_host_client(struct mei_device *dev, struct mei_cl *cl)
if (!cb) if (!cb)
return -ENOMEM; return -ENOMEM;
cb->major_file_operations = MEI_CLOSE; cb->fop_type = MEI_FOP_CLOSE;
if (dev->mei_host_buffer_is_empty) { if (dev->mei_host_buffer_is_empty) {
dev->mei_host_buffer_is_empty = false; dev->mei_host_buffer_is_empty = false;
if (mei_disconnect(dev, cl)) { if (mei_disconnect(dev, cl)) {
......
...@@ -57,14 +57,14 @@ irqreturn_t mei_interrupt_quick_handler(int irq, void *dev_id) ...@@ -57,14 +57,14 @@ irqreturn_t mei_interrupt_quick_handler(int irq, void *dev_id)
*/ */
static void _mei_cmpl(struct mei_cl *cl, struct mei_cl_cb *cb_pos) static void _mei_cmpl(struct mei_cl *cl, struct mei_cl_cb *cb_pos)
{ {
if (cb_pos->major_file_operations == MEI_WRITE) { if (cb_pos->fop_type == MEI_FOP_WRITE) {
mei_io_cb_free(cb_pos); mei_io_cb_free(cb_pos);
cb_pos = NULL; cb_pos = NULL;
cl->writing_state = MEI_WRITE_COMPLETE; cl->writing_state = MEI_WRITE_COMPLETE;
if (waitqueue_active(&cl->tx_wait)) if (waitqueue_active(&cl->tx_wait))
wake_up_interruptible(&cl->tx_wait); wake_up_interruptible(&cl->tx_wait);
} else if (cb_pos->major_file_operations == MEI_READ && } else if (cb_pos->fop_type == MEI_FOP_READ &&
MEI_READING == cl->reading_state) { MEI_READING == cl->reading_state) {
cl->reading_state = MEI_READ_COMPLETE; cl->reading_state = MEI_READ_COMPLETE;
if (waitqueue_active(&cl->rx_wait)) if (waitqueue_active(&cl->rx_wait))
...@@ -268,7 +268,7 @@ static void mei_client_connect_response(struct mei_device *dev, ...@@ -268,7 +268,7 @@ static void mei_client_connect_response(struct mei_device *dev,
list_del(&pos->list); list_del(&pos->list);
return; return;
} }
if (MEI_IOCTL == pos->major_file_operations) { if (pos->fop_type == MEI_FOP_IOCTL) {
if (is_treat_specially_client(cl, rs)) { if (is_treat_specially_client(cl, rs)) {
list_del(&pos->list); list_del(&pos->list);
cl->status = 0; cl->status = 0;
...@@ -988,8 +988,8 @@ static int mei_irq_thread_write_handler(struct mei_cl_cb *cmpl_list, ...@@ -988,8 +988,8 @@ static int mei_irq_thread_write_handler(struct mei_cl_cb *cmpl_list,
cl->status = 0; cl->status = 0;
list_del(&pos->list); list_del(&pos->list);
if (MEI_WRITING == cl->writing_state && if (MEI_WRITING == cl->writing_state &&
(pos->major_file_operations == MEI_WRITE) && pos->fop_type == MEI_FOP_WRITE &&
(cl != &dev->iamthif_cl)) { cl != &dev->iamthif_cl) {
dev_dbg(&dev->pdev->dev, "MEI WRITE COMPLETE\n"); dev_dbg(&dev->pdev->dev, "MEI WRITE COMPLETE\n");
cl->writing_state = MEI_WRITE_COMPLETE; cl->writing_state = MEI_WRITE_COMPLETE;
list_add_tail(&pos->list, &cmpl_list->list); list_add_tail(&pos->list, &cmpl_list->list);
...@@ -1044,22 +1044,22 @@ static int mei_irq_thread_write_handler(struct mei_cl_cb *cmpl_list, ...@@ -1044,22 +1044,22 @@ static int mei_irq_thread_write_handler(struct mei_cl_cb *cmpl_list,
list_del(&pos->list); list_del(&pos->list);
return -ENODEV; return -ENODEV;
} }
switch (pos->major_file_operations) { switch (pos->fop_type) {
case MEI_CLOSE: case MEI_FOP_CLOSE:
/* send disconnect message */ /* send disconnect message */
ret = _mei_irq_thread_close(dev, slots, pos, cl, cmpl_list); ret = _mei_irq_thread_close(dev, slots, pos, cl, cmpl_list);
if (ret) if (ret)
return ret; return ret;
break; break;
case MEI_READ: case MEI_FOP_READ:
/* send flow control message */ /* send flow control message */
ret = _mei_irq_thread_read(dev, slots, pos, cl, cmpl_list); ret = _mei_irq_thread_read(dev, slots, pos, cl, cmpl_list);
if (ret) if (ret)
return ret; return ret;
break; break;
case MEI_IOCTL: case MEI_FOP_IOCTL:
/* connect message */ /* connect message */
if (mei_other_client_is_connecting(dev, cl)) if (mei_other_client_is_connecting(dev, cl))
continue; continue;
......
...@@ -193,7 +193,7 @@ int mei_ioctl_connect_client(struct file *file, ...@@ -193,7 +193,7 @@ int mei_ioctl_connect_client(struct file *file,
goto end; goto end;
} }
cb->major_file_operations = MEI_IOCTL; cb->fop_type = MEI_FOP_IOCTL;
if (dev->dev_state != MEI_DEV_ENABLED) { if (dev->dev_state != MEI_DEV_ENABLED) {
rets = -ENODEV; rets = -ENODEV;
...@@ -360,7 +360,7 @@ int mei_start_read(struct mei_device *dev, struct mei_cl *cl) ...@@ -360,7 +360,7 @@ int mei_start_read(struct mei_device *dev, struct mei_cl *cl)
if (rets) if (rets)
goto err; goto err;
cb->major_file_operations = MEI_READ; cb->fop_type = MEI_FOP_READ;
cl->read_cb = cb; cl->read_cb = cb;
if (dev->mei_host_buffer_is_empty) { if (dev->mei_host_buffer_is_empty) {
dev->mei_host_buffer_is_empty = false; dev->mei_host_buffer_is_empty = false;
......
...@@ -626,7 +626,7 @@ static ssize_t mei_write(struct file *file, const char __user *ubuf, ...@@ -626,7 +626,7 @@ static ssize_t mei_write(struct file *file, const char __user *ubuf,
return length; return length;
} }
write_cb->major_file_operations = MEI_WRITE; write_cb->fop_type = MEI_FOP_WRITE;
dev_dbg(&dev->pdev->dev, "host client = %d, ME client = %d\n", dev_dbg(&dev->pdev->dev, "host client = %d, ME client = %d\n",
cl->host_client_id, cl->me_client_id); cl->host_client_id, cl->me_client_id);
......
...@@ -125,13 +125,20 @@ enum mei_wd_states { ...@@ -125,13 +125,20 @@ enum mei_wd_states {
MEI_WD_STOPPING, MEI_WD_STOPPING,
}; };
/* MEI CB */ /**
enum mei_cb_major_types { * enum mei_cb_file_ops - file operation associated with the callback
MEI_READ = 0, * @MEI_FOP_READ - read
MEI_WRITE, * @MEI_FOP_WRITE - write
MEI_IOCTL, * @MEI_FOP_IOCTL - ioctl
MEI_OPEN, * @MEI_FOP_OPEN - open
MEI_CLOSE * @MEI_FOP_CLOSE - close
*/
enum mei_cb_file_ops {
MEI_FOP_READ = 0,
MEI_FOP_WRITE,
MEI_FOP_IOCTL,
MEI_FOP_OPEN,
MEI_FOP_CLOSE
}; };
/* /*
...@@ -145,15 +152,16 @@ struct mei_message_data { ...@@ -145,15 +152,16 @@ struct mei_message_data {
struct mei_cl; struct mei_cl;
/* /**
* struct mei_cl_cb - file operation callback structure * struct mei_cl_cb - file operation callback structure
* *
* @cl - file client who is running this operation * @cl - file client who is running this operation
* @fop_type - file operation type
*/ */
struct mei_cl_cb { struct mei_cl_cb {
struct list_head list; struct list_head list;
struct mei_cl *cl; struct mei_cl *cl;
enum mei_cb_major_types major_file_operations; enum mei_cb_file_ops fop_type;
struct mei_message_data request_buffer; struct mei_message_data request_buffer;
struct mei_message_data response_buffer; struct mei_message_data response_buffer;
unsigned long buf_idx; unsigned long buf_idx;
......
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