mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Tomas Winkler <tomas.winkler@intel.com>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Alexander Usyskin <alexander.usyskin@intel.com>,
	linux-kernel@vger.kernel.org,
	Tomas Winkler <tomas.winkler@intel.com>
Subject: [char-misc-next 3/6 RESEND] mei: prevent queuing new flow control credit.
Date: Thu,  7 Jan 2016 14:46:36 +0200	[thread overview]
Message-ID: <1452170799-16960-4-git-send-email-tomas.winkler@intel.com> (raw)
In-Reply-To: <1452170799-16960-1-git-send-email-tomas.winkler@intel.com>

From: Alexander Usyskin <alexander.usyskin@intel.com>

The MEI  FW can receive only one flow control for read.
Currently the driver only checks if a flow control credit was already
sent and read is pending in the rd_pending queue, but it also has to
check if flow control credit already queued in the write control queue
to prevent sending more than one flow control credits.

Signed-off-by: Alexander Usyskin <alexander.usyskin@intel.com>
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
---
 drivers/misc/mei/client.c | 21 ++++++++++++++++++++-
 1 file changed, 20 insertions(+), 1 deletion(-)

diff --git a/drivers/misc/mei/client.c b/drivers/misc/mei/client.c
index a6c87c713193..72e32615acd9 100644
--- a/drivers/misc/mei/client.c
+++ b/drivers/misc/mei/client.c
@@ -1422,6 +1422,25 @@ out:
 }
 
 /**
+ * mei_cl_is_read_fc_cb - check if read cb is waiting for flow control
+ *                        for given host client
+ *
+ * @cl: host client
+ *
+ * Return: true, if found at least one cb.
+ */
+static bool mei_cl_is_read_fc_cb(struct mei_cl *cl)
+{
+	struct mei_device *dev = cl->dev;
+	struct mei_cl_cb *cb;
+
+	list_for_each_entry(cb, &dev->ctrl_wr_list.list, list)
+		if (cb->fop_type == MEI_FOP_READ && cb->cl == cl)
+			return true;
+	return false;
+}
+
+/**
  * mei_cl_read_start - the start read client message function.
  *
  * @cl: host client
@@ -1445,7 +1464,7 @@ int mei_cl_read_start(struct mei_cl *cl, size_t length, struct file *fp)
 		return -ENODEV;
 
 	/* HW currently supports only one pending read */
-	if (!list_empty(&cl->rd_pending))
+	if (!list_empty(&cl->rd_pending) || mei_cl_is_read_fc_cb(cl))
 		return -EBUSY;
 
 	if (!mei_me_cl_is_active(cl->me_cl)) {
-- 
2.4.3


  parent reply	other threads:[~2016-01-07 12:50 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-07 12:46 [char-misc-next RESEND 0/6] mei updates Tomas Winkler
2016-01-07 12:46 ` [char-misc-next 1/6 RESEND] mei: bus: remove redundant uuid string in debug messages Tomas Winkler
2016-01-07 12:46 ` [char-misc-next 2/6 RESEND] mei: trace pci configuration space io Tomas Winkler
2016-01-07 12:46 ` Tomas Winkler [this message]
2016-01-07 12:46 ` [char-misc-next 4/6 RESEND] mei: always copy the read buffer if data is ready Tomas Winkler
2016-01-07 12:46 ` [char-misc-next 5/6 RESEND] mei: fix fasync return value on error Tomas Winkler
2016-01-07 12:46 ` [char-misc-next 6/6 RESEND] mei: drop nfc leftovers from the mei driver Tomas Winkler
2016-01-07 17:31 ` [char-misc-next RESEND 0/6] mei updates Greg Kroah-Hartman
2016-01-07 22:56   ` Winkler, Tomas
2016-01-07 23:08     ` Greg Kroah-Hartman
2016-01-07 23:32       ` Winkler, Tomas
2016-01-08  1:02         ` Greg Kroah-Hartman
2016-01-09  4:59           ` Sudip Mukherjee
2016-01-09  5:10             ` Greg Kroah-Hartman
2016-01-09  5:27               ` Sudip Mukherjee
2016-01-27 21:22         ` Winkler, Tomas
2016-01-27 21:27           ` 'Greg Kroah-Hartman'
2016-01-27 21:33             ` Winkler, Tomas
2016-02-07  6:09 ` Greg Kroah-Hartman
2016-02-07  9:17   ` Winkler, Tomas
2016-02-07 17:33     ` Greg Kroah-Hartman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1452170799-16960-4-git-send-email-tomas.winkler@intel.com \
    --to=tomas.winkler@intel.com \
    --cc=alexander.usyskin@intel.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®