aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/misc/mei
diff options
context:
space:
mode:
authorTomas Winkler <tomas.winkler@intel.com>2013-03-17 05:41:20 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-03-25 16:20:49 -0400
commit4c6e22b8a93ef038b70661e590de250a09417af7 (patch)
tree44afa2fb57478254e67123fdee466289aeac480c /drivers/misc/mei
parentf57f27bc6ed7106276004dd224aaeeb160a5b4b8 (diff)
mei: add mei_irq_compl_handler function
similar to read/write add also irq completion handler that is called for the irq thread rename missnamed mei_irq_complete_handler to mei_cl_complete_handler as it operates on a single client Signed-off-by: Tomas Winkler <tomas.winkler@intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/misc/mei')
-rw-r--r--drivers/misc/mei/hw-me.c18
-rw-r--r--drivers/misc/mei/interrupt.c39
-rw-r--r--drivers/misc/mei/mei_dev.h3
3 files changed, 34 insertions, 26 deletions
diff --git a/drivers/misc/mei/hw-me.c b/drivers/misc/mei/hw-me.c
index df9b43d81eea..11a2a6538c0b 100644
--- a/drivers/misc/mei/hw-me.c
+++ b/drivers/misc/mei/hw-me.c
@@ -456,8 +456,6 @@ irqreturn_t mei_me_irq_thread_handler(int irq, void *dev_id)
456{ 456{
457 struct mei_device *dev = (struct mei_device *) dev_id; 457 struct mei_device *dev = (struct mei_device *) dev_id;
458 struct mei_cl_cb complete_list; 458 struct mei_cl_cb complete_list;
459 struct mei_cl_cb *cb_pos = NULL, *cb_next = NULL;
460 struct mei_cl *cl;
461 s32 slots; 459 s32 slots;
462 int rets; 460 int rets;
463 bool bus_message_received; 461 bool bus_message_received;
@@ -527,23 +525,9 @@ end:
527 wake_up_interruptible(&dev->wait_recvd_msg); 525 wake_up_interruptible(&dev->wait_recvd_msg);
528 bus_message_received = false; 526 bus_message_received = false;
529 } 527 }
530 if (list_empty(&complete_list.list))
531 return IRQ_HANDLED;
532 528
529 mei_irq_compl_handler(dev, &complete_list);
533 530
534 list_for_each_entry_safe(cb_pos, cb_next, &complete_list.list, list) {
535 cl = cb_pos->cl;
536 list_del(&cb_pos->list);
537 if (cl) {
538 if (cl != &dev->iamthif_cl) {
539 dev_dbg(&dev->pdev->dev, "completing call back.\n");
540 mei_irq_complete_handler(cl, cb_pos);
541 cb_pos = NULL;
542 } else if (cl == &dev->iamthif_cl) {
543 mei_amthif_complete(dev, cb_pos);
544 }
545 }
546 }
547 return IRQ_HANDLED; 531 return IRQ_HANDLED;
548} 532}
549static const struct mei_hw_ops mei_me_hw_ops = { 533static const struct mei_hw_ops mei_me_hw_ops = {
diff --git a/drivers/misc/mei/interrupt.c b/drivers/misc/mei/interrupt.c
index 14c70b8815d8..73fbce3e7746 100644
--- a/drivers/misc/mei/interrupt.c
+++ b/drivers/misc/mei/interrupt.c
@@ -30,21 +30,21 @@
30 30
31 31
32/** 32/**
33 * mei_complete_handler - processes completed operation. 33 * mei_cl_complete_handler - processes completed operation for a client
34 * 34 *
35 * @cl: private data of the file object. 35 * @cl: private data of the file object.
36 * @cb_pos: callback block. 36 * @cb: callback block.
37 */ 37 */
38void mei_irq_complete_handler(struct mei_cl *cl, struct mei_cl_cb *cb_pos) 38static void mei_cl_complete_handler(struct mei_cl *cl, struct mei_cl_cb *cb)
39{ 39{
40 if (cb_pos->fop_type == MEI_FOP_WRITE) { 40 if (cb->fop_type == MEI_FOP_WRITE) {
41 mei_io_cb_free(cb_pos); 41 mei_io_cb_free(cb);
42 cb_pos = NULL; 42 cb = NULL;
43 cl->writing_state = MEI_WRITE_COMPLETE; 43 cl->writing_state = MEI_WRITE_COMPLETE;
44 if (waitqueue_active(&cl->tx_wait)) 44 if (waitqueue_active(&cl->tx_wait))
45 wake_up_interruptible(&cl->tx_wait); 45 wake_up_interruptible(&cl->tx_wait);
46 46
47 } else if (cb_pos->fop_type == MEI_FOP_READ && 47 } else if (cb->fop_type == MEI_FOP_READ &&
48 MEI_READING == cl->reading_state) { 48 MEI_READING == cl->reading_state) {
49 cl->reading_state = MEI_READ_COMPLETE; 49 cl->reading_state = MEI_READ_COMPLETE;
50 if (waitqueue_active(&cl->rx_wait)) 50 if (waitqueue_active(&cl->rx_wait))
@@ -54,6 +54,31 @@ void mei_irq_complete_handler(struct mei_cl *cl, struct mei_cl_cb *cb_pos)
54} 54}
55 55
56/** 56/**
57 * mei_irq_compl_handler - dispatch complete handelers
58 * for the completed callbacks
59 *
60 * @dev - mei device
61 * @compl_list - list of completed cbs
62 */
63void mei_irq_compl_handler(struct mei_device *dev, struct mei_cl_cb *compl_list)
64{
65 struct mei_cl_cb *cb, *next;
66 struct mei_cl *cl;
67
68 list_for_each_entry_safe(cb, next, &compl_list->list, list) {
69 cl = cb->cl;
70 list_del(&cb->list);
71 if (!cl)
72 continue;
73
74 dev_dbg(&dev->pdev->dev, "completing call back.\n");
75 if (cl == &dev->iamthif_cl)
76 mei_amthif_complete(dev, cb);
77 else
78 mei_cl_complete_handler(cl, cb);
79 }
80}
81/**
57 * _mei_irq_thread_state_ok - checks if mei header matches file private data 82 * _mei_irq_thread_state_ok - checks if mei header matches file private data
58 * 83 *
59 * @cl: private data of the file object 84 * @cl: private data of the file object
diff --git a/drivers/misc/mei/mei_dev.h b/drivers/misc/mei/mei_dev.h
index 5c30857e91d5..1a4b50ca4b3b 100644
--- a/drivers/misc/mei/mei_dev.h
+++ b/drivers/misc/mei/mei_dev.h
@@ -405,8 +405,7 @@ int mei_irq_read_handler(struct mei_device *dev,
405 struct mei_cl_cb *cmpl_list, s32 *slots); 405 struct mei_cl_cb *cmpl_list, s32 *slots);
406 406
407int mei_irq_write_handler(struct mei_device *dev, struct mei_cl_cb *cmpl_list); 407int mei_irq_write_handler(struct mei_device *dev, struct mei_cl_cb *cmpl_list);
408 408void mei_irq_compl_handler(struct mei_device *dev, struct mei_cl_cb *cmpl_list);
409void mei_irq_complete_handler(struct mei_cl *cl, struct mei_cl_cb *cb_pos);
410 409
411/* 410/*
412 * AMTHIF - AMT Host Interface Functions 411 * AMTHIF - AMT Host Interface Functions