mei: add mei_irq_compl_handler function
Subsystems (2)
PATCH 1/2 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
--- drivers/misc/mei/hw-me.c | 18 +----------------- drivers/misc/mei/interrupt.c | 39 ++++++++++++++++++++++++++++++++------- drivers/misc/mei/mei_dev.h | 3 +-- 3 files changed, 34 insertions(+), 26 deletions(-)
drivers/misc/mei/hw-me.c +1 -17
@@ -466,8 +466,6 @@ irqreturn_t mei_me_irq_thread_handler(int irq, void *dev_id) {struct mei_device *dev = (struct mei_device *) dev_id;struct mei_cl_cb complete_list; -struct mei_cl_cb *cb_pos =NULL , *cb_next =NULL ; -struct mei_cl *cl;s32 slots;int rets;bool bus_message_received;
@@ -538,23 +536,9 @@ end:wake_up_interruptible (&dev->wait_recvd_msg); bus_message_received = false; } -if (list_empty (&complete_list.list)) -return IRQ_HANDLED ; +mei_irq_compl_handler (dev, &complete_list); -list_for_each_entry_safe (cb_pos, cb_next, &complete_list.list, list) { - cl = cb_pos->cl; -list_del (&cb_pos->list); -if (cl) { -if (cl != &dev->iamthif_cl) { -dev_dbg (&dev->pdev->dev,"completing call back.\n" ); -mei_irq_complete_handler (cl, cb_pos); - cb_pos =NULL ; - }else if (cl == &dev->iamthif_cl) { -mei_amthif_complete (dev, cb_pos); - } - } - }return IRQ_HANDLED ; }static const struct mei_hw_ops mei_me_hw_ops = {
drivers/misc/mei/interrupt.c +32 -7
@@ -30,21 +30,21 @@/** -* mei_complete_handler - processes completed operation. +* mei_cl_complete_handler - processes completed operation for a client * * @cl: private data of the file object. -* @cb_pos: callback block. +* @cb: callback block. */ -void mei_irq_complete_handler (struct mei_cl *cl,struct mei_cl_cb *cb_pos) +static void mei_cl_complete_handler (struct mei_cl *cl,struct mei_cl_cb *cb) { -if (cb_pos->fop_type ==MEI_FOP_WRITE ) { -mei_io_cb_free (cb_pos); - cb_pos =NULL ; +if (cb->fop_type ==MEI_FOP_WRITE ) { +mei_io_cb_free (cb); + cb =NULL ; cl->writing_state =MEI_WRITE_COMPLETE ;if (waitqueue_active (&cl->tx_wait))wake_up_interruptible (&cl->tx_wait); - }else if (cb_pos->fop_type ==MEI_FOP_READ && + }else if (cb->fop_type ==MEI_FOP_READ &&MEI_READING == cl->reading_state) { cl->reading_state =MEI_READ_COMPLETE ;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) }/** +* mei_irq_compl_handler - dispatch complete handelers +* for the completed callbacks +* +* @dev - mei device +* @compl_list - list of completed cbs +*/ +void mei_irq_compl_handler (struct mei_device *dev,struct mei_cl_cb *compl_list) +{ +struct mei_cl_cb *cb, *next; +struct mei_cl *cl; + +list_for_each_entry_safe (cb, next, &compl_list->list, list) { + cl = cb->cl; +list_del (&cb->list); +if (!cl) +continue ; + +dev_dbg (&dev->pdev->dev,"completing call back.\n" ); +if (cl == &dev->iamthif_cl) +mei_amthif_complete (dev, cb); +else +mei_cl_complete_handler (cl, cb); + } +} +/** * _mei_irq_thread_state_ok - checks if mei header matches file private data * * @cl: private data of the file object
drivers/misc/mei/mei_dev.h +1 -2
@@ -406,8 +406,7 @@ int mei_irq_read_handler(struct mei_device *dev, struct mei_cl_cb *cmpl_list, s32 *slots);int mei_irq_write_handler (struct mei_device *dev,struct mei_cl_cb *cmpl_list); - -void mei_irq_complete_handler (struct mei_cl *cl,struct mei_cl_cb *cb_pos); +void mei_irq_compl_handler (struct mei_device *dev,struct mei_cl_cb *cmpl_list);/* * AMTHIF - AMT Host Interface Functions
Signature · 1 line
1.8.1.3
PATCH 2/2 mei: drop RECOVERING_FROM_RESET device state
ECOVERING_FROM_RESET device state is never set
we can remove it
--- drivers/misc/mei/init.c | 4 ---- drivers/misc/mei/mei_dev.h | 1 - 2 files changed, 5 deletions(-)
drivers/misc/mei/init.c +0 -4
@@ -34,7 +34,6 @@ const char *mei_dev_state_str(int state)MEI_DEV_STATE (ENABLED );MEI_DEV_STATE (RESETING );MEI_DEV_STATE (DISABLED ); -MEI_DEV_STATE (RECOVERING_FROM_RESET );MEI_DEV_STATE (POWER_DOWN );MEI_DEV_STATE (POWER_UP );default :
@@ -139,9 +138,6 @@ void mei_reset(struct mei_device *dev, int interrupts_enabled) {bool unexpected; -if (dev->dev_state ==MEI_DEV_RECOVERING_FROM_RESET ) -return ; - unexpected = (dev->dev_state != MEI_DEV_INITIALIZING && dev->dev_state != MEI_DEV_DISABLED && dev->dev_state != MEI_DEV_POWER_DOWN &&
drivers/misc/mei/mei_dev.h +0 -1
@@ -97,7 +97,6 @@ enum mei_dev_state {MEI_DEV_ENABLED ,MEI_DEV_RESETING ,MEI_DEV_DISABLED , -MEI_DEV_RECOVERING_FROM_RESET ,MEI_DEV_POWER_DOWN , MEI_DEV_POWER_UP };
Signature · 1 line
1.8.1.3
Greg KH
maintainerRe: [char-misc-next 2/2] mei: drop RECOVERING_FROM_RESET device state
Quoted 2 lines · Tomas Winkler
ECOVERING_FROM_RESETdevice state is never set
we can remove it
Really? I now get the following build error with this patch applied:
drivers/misc/mei/pci-me.c: In function ‘mei_pci_suspend’:drivers/misc/mei/pci-me.c:323:24: error: ‘MEI_DEV_RECOVERING_FROM_RESET’ undeclared (first use in this function) drivers/misc/mei/pci-me.c:323:24: note: each undeclared identifier is reported only once for each function it appears in
Please be more careful.
greg k-h
RE: [char-misc-next 2/2] mei: drop RECOVERING_FROM_RESET device state
Quoted 6 lines · Tomas Winkler
Quoted 1 line
ECOVERING_FROM_RESETdevice state is never set we can remove itReally? I now get the following build error with this patch applied:
Quoted 8 lines
drivers/misc/mei/pci-me.c: In function ‘mei_pci_suspend’:drivers/misc/mei/pci-me.c:323:24: error:
‘MEI_DEV_RECOVERING_FROM_RESET’ undeclared (first use in this function)drivers/misc/mei/pci-me.c:323:24: note: each undeclared identifier is reported only once for each function it appears inPlease be more careful.
This patch has to be applied above patch https://lkml.org/lkml/2013/3/10/101 that is queued for 3.9. Somehow I've assumed it will go into 3.9-rc4.
Anyhow we need to wait with this and everything else I have queued till it is merged back to char-misc-next. Maybe you have some suggestions how to handle such conflicts in the future.
Thanks
Tomas ���{.n�+�������+%�����ݶ��w��{.n�+����{��G�����{ay�ʇڙ�,j��f���h��������z_�(�階�ݢj"���m������G������?����&���~��iO��z��v�^�m����������?�I�
Greg KH
maintainerRe: [char-misc-next 2/2] mei: drop RECOVERING_FROM_RESET device state
Quoted 13 lines · Tomas
Quoted 13 lines · Tomas Winkler
Quoted 1 line
ECOVERING_FROM_RESETdevice state is never set we can remove itReally? I now get the following build error with this patch applied:
drivers/misc/mei/pci-me.c: In function ‘mei_pci_suspend’:drivers/misc/mei/pci-me.c:323:24: error:
‘MEI_DEV_RECOVERING_FROM_RESET’ undeclared (first use in this function)drivers/misc/mei/pci-me.c:323:24: note: each undeclared identifier is reported only once for each function it appears in
Quoted 4 lines
Quoted 1 line
Please be more careful.
This patch has to be applied above patch https://lkml.org/lkml/2013/3/10/101 that is queued for 3.9. Somehow I've assumed it will go into 3.9-rc4.
Yes, I hope to get it there.
Quoted 2 lines
Anyhow we need to wait with this and everything else I have queued till it is merged back to char-misc-next. Maybe you have some suggestions how to handle such conflicts in the future.
Let me know about such conflicts so I don't blame you for them :)
I'll pull in the char-misc.linus branch into my .next branch now, so that should solve this problem, right? If so, please resend this patch so I can apply it.
thanks,
greg k-h