summaryrefslogtreecommitdiffstats
path: root/drivers/misc
diff options
context:
space:
mode:
authorAlexander Usyskin <alexander.usyskin@intel.com>2016-06-16 10:58:57 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2016-08-30 08:36:39 -0400
commit97d549b4d5fca22ebde0798cb8c16c19b4ae837a (patch)
tree33cd7b6b480b3362eea22dc1e84e7caf6fe77ea6 /drivers/misc
parenta03c608f25fbe2eb5f2862a4dab1791948496215 (diff)
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: Alexander Usyskin <alexander.usyskin@intel.com> Signed-off-by: Tomas Winkler <tomas.winkler@intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/misc')
-rw-r--r--drivers/misc/mei/amthif.c13
-rw-r--r--drivers/misc/mei/interrupt.c1
-rw-r--r--drivers/misc/mei/main.c1
-rw-r--r--drivers/misc/mei/mei_dev.h5
4 files changed, 10 insertions, 10 deletions
diff --git a/drivers/misc/mei/amthif.c b/drivers/misc/mei/amthif.c
index 3cf54ca051ea..e346af17d9f4 100644
--- a/drivers/misc/mei/amthif.c
+++ b/drivers/misc/mei/amthif.c
@@ -204,7 +204,7 @@ static int mei_amthif_read_start(struct mei_cl *cl, const struct file *file)
204 list_add_tail(&cb->list, &dev->ctrl_wr_list.list); 204 list_add_tail(&cb->list, &dev->ctrl_wr_list.list);
205 205
206 dev->iamthif_state = MEI_IAMTHIF_READING; 206 dev->iamthif_state = MEI_IAMTHIF_READING;
207 dev->iamthif_fp = cb->fp; 207 cl->fp = cb->fp;
208 208
209 return 0; 209 return 0;
210} 210}
@@ -230,13 +230,13 @@ int mei_amthif_run_next_cmd(struct mei_device *dev)
230 typeof(*cb), list); 230 typeof(*cb), list);
231 if (!cb) { 231 if (!cb) {
232 dev->iamthif_state = MEI_IAMTHIF_IDLE; 232 dev->iamthif_state = MEI_IAMTHIF_IDLE;
233 dev->iamthif_fp = NULL; 233 cl->fp = NULL;
234 return 0; 234 return 0;
235 } 235 }
236 236
237 list_del_init(&cb->list); 237 list_del_init(&cb->list);
238 dev->iamthif_state = MEI_IAMTHIF_WRITING; 238 dev->iamthif_state = MEI_IAMTHIF_WRITING;
239 dev->iamthif_fp = cb->fp; 239 cl->fp = cb->fp;
240 240
241 ret = mei_cl_write(cl, cb, false); 241 ret = mei_cl_write(cl, cb, false);
242 if (ret < 0) 242 if (ret < 0)
@@ -375,7 +375,7 @@ void mei_amthif_complete(struct mei_cl *cl, struct mei_cl_cb *cb)
375 return; 375 return;
376 } 376 }
377 dev->iamthif_state = MEI_IAMTHIF_IDLE; 377 dev->iamthif_state = MEI_IAMTHIF_IDLE;
378 dev->iamthif_fp = NULL; 378 cl->fp = NULL;
379 if (!dev->iamthif_canceled) { 379 if (!dev->iamthif_canceled) {
380 /* 380 /*
381 * in case of error enqueue the write cb to complete 381 * 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*/ 453*/
454int mei_amthif_release(struct mei_device *dev, struct file *file) 454int mei_amthif_release(struct mei_device *dev, struct file *file)
455{ 455{
456 struct mei_cl *cl = file->private_data;
457
456 if (dev->iamthif_open_count > 0) 458 if (dev->iamthif_open_count > 0)
457 dev->iamthif_open_count--; 459 dev->iamthif_open_count--;
458 460
459 if (dev->iamthif_fp == file && 461 if (cl->fp == file && dev->iamthif_state != MEI_IAMTHIF_IDLE) {
460 dev->iamthif_state != MEI_IAMTHIF_IDLE) {
461 462
462 dev_dbg(dev->dev, "amthif canceled iamthif state %d\n", 463 dev_dbg(dev->dev, "amthif canceled iamthif state %d\n",
463 dev->iamthif_state); 464 dev->iamthif_state);
diff --git a/drivers/misc/mei/interrupt.c b/drivers/misc/mei/interrupt.c
index 412229e7bb7c..8b5e4b4c4c15 100644
--- a/drivers/misc/mei/interrupt.c
+++ b/drivers/misc/mei/interrupt.c
@@ -516,7 +516,6 @@ void mei_timer(struct work_struct *work)
516 dev_err(dev->dev, "timer: amthif hanged.\n"); 516 dev_err(dev->dev, "timer: amthif hanged.\n");
517 mei_reset(dev); 517 mei_reset(dev);
518 518
519 dev->iamthif_fp = NULL;
520 mei_amthif_run_next_cmd(dev); 519 mei_amthif_run_next_cmd(dev);
521 } 520 }
522 } 521 }
diff --git a/drivers/misc/mei/main.c b/drivers/misc/mei/main.c
index d62e89c80beb..d7ef5edf044a 100644
--- a/drivers/misc/mei/main.c
+++ b/drivers/misc/mei/main.c
@@ -71,6 +71,7 @@ static int mei_open(struct inode *inode, struct file *file)
71 goto err_unlock; 71 goto err_unlock;
72 } 72 }
73 73
74 cl->fp = file;
74 file->private_data = cl; 75 file->private_data = cl;
75 76
76 mutex_unlock(&dev->device_lock); 77 mutex_unlock(&dev->device_lock);
diff --git a/drivers/misc/mei/mei_dev.h b/drivers/misc/mei/mei_dev.h
index d7b68063ace1..aaefbc87c2fc 100644
--- a/drivers/misc/mei/mei_dev.h
+++ b/drivers/misc/mei/mei_dev.h
@@ -200,6 +200,7 @@ struct mei_cl_cb {
200 * @ev_async: event async notification 200 * @ev_async: event async notification
201 * @status: connection status 201 * @status: connection status
202 * @me_cl: fw client connected 202 * @me_cl: fw client connected
203 * @fp: file associated with client
203 * @host_client_id: host id 204 * @host_client_id: host id
204 * @mei_flow_ctrl_creds: transmit flow credentials 205 * @mei_flow_ctrl_creds: transmit flow credentials
205 * @timer_count: watchdog timer for operation completion 206 * @timer_count: watchdog timer for operation completion
@@ -223,6 +224,7 @@ struct mei_cl {
223 struct fasync_struct *ev_async; 224 struct fasync_struct *ev_async;
224 int status; 225 int status;
225 struct mei_me_client *me_cl; 226 struct mei_me_client *me_cl;
227 const struct file *fp;
226 u8 host_client_id; 228 u8 host_client_id;
227 u8 mei_flow_ctrl_creds; 229 u8 mei_flow_ctrl_creds;
228 u8 timer_count; 230 u8 timer_count;
@@ -398,7 +400,6 @@ const char *mei_pg_state_str(enum mei_pg_state state);
398 * @override_fixed_address: force allow fixed address behavior 400 * @override_fixed_address: force allow fixed address behavior
399 * 401 *
400 * @amthif_cmd_list : amthif list for cmd waiting 402 * @amthif_cmd_list : amthif list for cmd waiting
401 * @iamthif_fp : file for current amthif operation
402 * @iamthif_cl : amthif host client 403 * @iamthif_cl : amthif host client
403 * @iamthif_open_count : number of opened amthif connections 404 * @iamthif_open_count : number of opened amthif connections
404 * @iamthif_stall_timer : timer to detect amthif hang 405 * @iamthif_stall_timer : timer to detect amthif hang
@@ -481,8 +482,6 @@ struct mei_device {
481 482
482 /* amthif list for cmd waiting */ 483 /* amthif list for cmd waiting */
483 struct mei_cl_cb amthif_cmd_list; 484 struct mei_cl_cb amthif_cmd_list;
484 /* driver managed amthif list for reading completed amthif cmd data */
485 const struct file *iamthif_fp;
486 struct mei_cl iamthif_cl; 485 struct mei_cl iamthif_cl;
487 long iamthif_open_count; 486 long iamthif_open_count;
488 u32 iamthif_stall_timer; 487 u32 iamthif_stall_timer;