All of lore.kernel.org
 help / color / mirror / Atom feed
* [char-misc-next 1/2] mei: add mei_irq_compl_handler function
@ 2013-03-17  9:41 Tomas Winkler
  2013-03-17  9:41 ` [char-misc-next 2/2] mei: drop RECOVERING_FROM_RESET device state Tomas Winkler
  0 siblings, 1 reply; 5+ messages in thread
From: Tomas Winkler @ 2013-03-17  9:41 UTC (permalink / raw)
  To: gregkh; +Cc: arnd, linux-kernel, Tomas Winkler

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>
---
 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(-)

diff --git a/drivers/misc/mei/hw-me.c b/drivers/misc/mei/hw-me.c
index 0db071f..7c2b14d 100644
--- a/drivers/misc/mei/hw-me.c
+++ b/drivers/misc/mei/hw-me.c
@@ -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 = {
diff --git a/drivers/misc/mei/interrupt.c b/drivers/misc/mei/interrupt.c
index 14c70b8..73fbce3 100644
--- a/drivers/misc/mei/interrupt.c
+++ b/drivers/misc/mei/interrupt.c
@@ -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
diff --git a/drivers/misc/mei/mei_dev.h b/drivers/misc/mei/mei_dev.h
index c17bced..d6fd3d6 100644
--- a/drivers/misc/mei/mei_dev.h
+++ b/drivers/misc/mei/mei_dev.h
@@ -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
-- 
1.8.1.3


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [char-misc-next 2/2] mei: drop RECOVERING_FROM_RESET device state
  2013-03-17  9:41 [char-misc-next 1/2] mei: add mei_irq_compl_handler function Tomas Winkler
@ 2013-03-17  9:41 ` Tomas Winkler
  2013-03-25 20:21   ` Greg KH
  0 siblings, 1 reply; 5+ messages in thread
From: Tomas Winkler @ 2013-03-17  9:41 UTC (permalink / raw)
  To: gregkh; +Cc: arnd, linux-kernel, Tomas Winkler

ECOVERING_FROM_RESET device state is never set
we can remove it

Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
---
 drivers/misc/mei/init.c    | 4 ----
 drivers/misc/mei/mei_dev.h | 1 -
 2 files changed, 5 deletions(-)

diff --git a/drivers/misc/mei/init.c b/drivers/misc/mei/init.c
index 1ab1fb1..09a9980 100644
--- a/drivers/misc/mei/init.c
+++ b/drivers/misc/mei/init.c
@@ -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 &&
diff --git a/drivers/misc/mei/mei_dev.h b/drivers/misc/mei/mei_dev.h
index d6fd3d6..091f50af 100644
--- a/drivers/misc/mei/mei_dev.h
+++ b/drivers/misc/mei/mei_dev.h
@@ -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
 };
-- 
1.8.1.3


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [char-misc-next 2/2] mei: drop RECOVERING_FROM_RESET device state
  2013-03-17  9:41 ` [char-misc-next 2/2] mei: drop RECOVERING_FROM_RESET device state Tomas Winkler
@ 2013-03-25 20:21   ` Greg KH
  2013-03-26 22:47     ` Winkler, Tomas
  0 siblings, 1 reply; 5+ messages in thread
From: Greg KH @ 2013-03-25 20:21 UTC (permalink / raw)
  To: Tomas Winkler; +Cc: arnd, linux-kernel

On Sun, Mar 17, 2013 at 11:41:21AM +0200, Tomas Winkler wrote:
> ECOVERING_FROM_RESET device 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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* RE: [char-misc-next 2/2] mei: drop RECOVERING_FROM_RESET device state
  2013-03-25 20:21   ` Greg KH
@ 2013-03-26 22:47     ` Winkler, Tomas
  2013-03-26 23:00       ` Greg KH
  0 siblings, 1 reply; 5+ messages in thread
From: Winkler, Tomas @ 2013-03-26 22:47 UTC (permalink / raw)
  To: Greg KH; +Cc: arnd, linux-kernel

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset="utf-8", Size: 1066 bytes --]

> 
> On Sun, Mar 17, 2013 at 11:41:21AM +0200, Tomas Winkler wrote:
> > ECOVERING_FROM_RESET device 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.

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Ç+‰·Ÿ®‰­†+%ŠËÿ±éݶ\x17¥Šwÿº{.nÇ+‰·¥Š{±þG«éÿŠ{ayº\x1dʇڙë,j\a­¢f£¢·hšïêÿ‘êçz_è®\x03(­éšŽŠÝ¢j"ú\x1a¶^[m§ÿÿ¾\a«þG«éÿ¢¸?™¨è­Ú&£ø§~á¶iO•æ¬z·švØ^\x14\x04\x1a¶^[m§ÿÿÃ\fÿ¶ìÿ¢¸?–I¥

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [char-misc-next 2/2] mei: drop RECOVERING_FROM_RESET device state
  2013-03-26 22:47     ` Winkler, Tomas
@ 2013-03-26 23:00       ` Greg KH
  0 siblings, 0 replies; 5+ messages in thread
From: Greg KH @ 2013-03-26 23:00 UTC (permalink / raw)
  To: Winkler, Tomas; +Cc: arnd, linux-kernel

On Tue, Mar 26, 2013 at 10:47:31PM +0000, Winkler, Tomas wrote:
> > 
> > On Sun, Mar 17, 2013 at 11:41:21AM +0200, Tomas Winkler wrote:
> > > ECOVERING_FROM_RESET device 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.
> 
> 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.

> 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

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2013-03-26 23:00 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-03-17  9:41 [char-misc-next 1/2] mei: add mei_irq_compl_handler function Tomas Winkler
2013-03-17  9:41 ` [char-misc-next 2/2] mei: drop RECOVERING_FROM_RESET device state Tomas Winkler
2013-03-25 20:21   ` Greg KH
2013-03-26 22:47     ` Winkler, Tomas
2013-03-26 23:00       ` Greg KH

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.