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

mei: add file pointer to the host client structure

Store the file associated with a client in the host client structure,
this enables dropping the special amthif client file pointer from struct
mei_device, and this is also a preparation for changing the way rx
packet allocation for fixed_address clients
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 a03c608f
...@@ -204,7 +204,7 @@ static int mei_amthif_read_start(struct mei_cl *cl, const struct file *file) ...@@ -204,7 +204,7 @@ static int mei_amthif_read_start(struct mei_cl *cl, const struct file *file)
list_add_tail(&cb->list, &dev->ctrl_wr_list.list); list_add_tail(&cb->list, &dev->ctrl_wr_list.list);
dev->iamthif_state = MEI_IAMTHIF_READING; dev->iamthif_state = MEI_IAMTHIF_READING;
dev->iamthif_fp = cb->fp; cl->fp = cb->fp;
return 0; return 0;
} }
...@@ -230,13 +230,13 @@ int mei_amthif_run_next_cmd(struct mei_device *dev) ...@@ -230,13 +230,13 @@ int mei_amthif_run_next_cmd(struct mei_device *dev)
typeof(*cb), list); typeof(*cb), list);
if (!cb) { if (!cb) {
dev->iamthif_state = MEI_IAMTHIF_IDLE; dev->iamthif_state = MEI_IAMTHIF_IDLE;
dev->iamthif_fp = NULL; cl->fp = NULL;
return 0; return 0;
} }
list_del_init(&cb->list); list_del_init(&cb->list);
dev->iamthif_state = MEI_IAMTHIF_WRITING; dev->iamthif_state = MEI_IAMTHIF_WRITING;
dev->iamthif_fp = cb->fp; cl->fp = cb->fp;
ret = mei_cl_write(cl, cb, false); ret = mei_cl_write(cl, cb, false);
if (ret < 0) if (ret < 0)
...@@ -375,7 +375,7 @@ void mei_amthif_complete(struct mei_cl *cl, struct mei_cl_cb *cb) ...@@ -375,7 +375,7 @@ void mei_amthif_complete(struct mei_cl *cl, struct mei_cl_cb *cb)
return; return;
} }
dev->iamthif_state = MEI_IAMTHIF_IDLE; dev->iamthif_state = MEI_IAMTHIF_IDLE;
dev->iamthif_fp = NULL; cl->fp = NULL;
if (!dev->iamthif_canceled) { if (!dev->iamthif_canceled) {
/* /*
* in case of error enqueue the write cb to complete * in case of error enqueue the write cb to complete
...@@ -453,11 +453,12 @@ static void mei_clear_lists(struct mei_device *dev, const struct file *file) ...@@ -453,11 +453,12 @@ static void mei_clear_lists(struct mei_device *dev, const struct file *file)
*/ */
int mei_amthif_release(struct mei_device *dev, struct file *file) int mei_amthif_release(struct mei_device *dev, struct file *file)
{ {
struct mei_cl *cl = file->private_data;
if (dev->iamthif_open_count > 0) if (dev->iamthif_open_count > 0)
dev->iamthif_open_count--; dev->iamthif_open_count--;
if (dev->iamthif_fp == file && if (cl->fp == file && dev->iamthif_state != MEI_IAMTHIF_IDLE) {
dev->iamthif_state != MEI_IAMTHIF_IDLE) {
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);
......
...@@ -516,7 +516,6 @@ void mei_timer(struct work_struct *work) ...@@ -516,7 +516,6 @@ void mei_timer(struct work_struct *work)
dev_err(dev->dev, "timer: amthif hanged.\n"); dev_err(dev->dev, "timer: amthif hanged.\n");
mei_reset(dev); mei_reset(dev);
dev->iamthif_fp = NULL;
mei_amthif_run_next_cmd(dev); mei_amthif_run_next_cmd(dev);
} }
} }
......
...@@ -71,6 +71,7 @@ static int mei_open(struct inode *inode, struct file *file) ...@@ -71,6 +71,7 @@ static int mei_open(struct inode *inode, struct file *file)
goto err_unlock; goto err_unlock;
} }
cl->fp = file;
file->private_data = cl; file->private_data = cl;
mutex_unlock(&dev->device_lock); mutex_unlock(&dev->device_lock);
......
...@@ -200,6 +200,7 @@ struct mei_cl_cb { ...@@ -200,6 +200,7 @@ struct mei_cl_cb {
* @ev_async: event async notification * @ev_async: event async notification
* @status: connection status * @status: connection status
* @me_cl: fw client connected * @me_cl: fw client connected
* @fp: file associated with client
* @host_client_id: host id * @host_client_id: host id
* @mei_flow_ctrl_creds: transmit flow credentials * @mei_flow_ctrl_creds: transmit flow credentials
* @timer_count: watchdog timer for operation completion * @timer_count: watchdog timer for operation completion
...@@ -223,6 +224,7 @@ struct mei_cl { ...@@ -223,6 +224,7 @@ struct mei_cl {
struct fasync_struct *ev_async; struct fasync_struct *ev_async;
int status; int status;
struct mei_me_client *me_cl; struct mei_me_client *me_cl;
const struct file *fp;
u8 host_client_id; u8 host_client_id;
u8 mei_flow_ctrl_creds; u8 mei_flow_ctrl_creds;
u8 timer_count; u8 timer_count;
...@@ -398,7 +400,6 @@ const char *mei_pg_state_str(enum mei_pg_state state); ...@@ -398,7 +400,6 @@ const char *mei_pg_state_str(enum mei_pg_state state);
* @override_fixed_address: force allow fixed address behavior * @override_fixed_address: force allow fixed address behavior
* *
* @amthif_cmd_list : amthif list for cmd waiting * @amthif_cmd_list : amthif list for cmd waiting
* @iamthif_fp : file for current amthif operation
* @iamthif_cl : amthif host client * @iamthif_cl : amthif host client
* @iamthif_open_count : number of opened amthif connections * @iamthif_open_count : number of opened amthif connections
* @iamthif_stall_timer : timer to detect amthif hang * @iamthif_stall_timer : timer to detect amthif hang
...@@ -481,8 +482,6 @@ struct mei_device { ...@@ -481,8 +482,6 @@ struct mei_device {
/* amthif list for cmd waiting */ /* amthif list for cmd waiting */
struct mei_cl_cb amthif_cmd_list; struct mei_cl_cb amthif_cmd_list;
/* driver managed amthif list for reading completed amthif cmd data */
const struct file *iamthif_fp;
struct mei_cl iamthif_cl; struct mei_cl iamthif_cl;
long iamthif_open_count; long iamthif_open_count;
u32 iamthif_stall_timer; u32 iamthif_stall_timer;
......
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