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 02/12] mei: add file pointer to the host client structure
Date: Fri, 22 Jul 2016 15:56:19 +0300	[thread overview]
Message-ID: <1469192189-29042-3-git-send-email-tomas.winkler@intel.com> (raw)
In-Reply-To: <1469192189-29042-1-git-send-email-tomas.winkler@intel.com>

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

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>
---
 drivers/misc/mei/amthif.c    | 13 +++++++------
 drivers/misc/mei/interrupt.c |  1 -
 drivers/misc/mei/main.c      |  1 +
 drivers/misc/mei/mei_dev.h   |  5 ++---
 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)
 	list_add_tail(&cb->list, &dev->ctrl_wr_list.list);
 
 	dev->iamthif_state = MEI_IAMTHIF_READING;
-	dev->iamthif_fp = cb->fp;
+	cl->fp = cb->fp;
 
 	return 0;
 }
@@ -230,13 +230,13 @@ int mei_amthif_run_next_cmd(struct mei_device *dev)
 					typeof(*cb), list);
 	if (!cb) {
 		dev->iamthif_state = MEI_IAMTHIF_IDLE;
-		dev->iamthif_fp = NULL;
+		cl->fp = NULL;
 		return 0;
 	}
 
 	list_del_init(&cb->list);
 	dev->iamthif_state = MEI_IAMTHIF_WRITING;
-	dev->iamthif_fp = cb->fp;
+	cl->fp = cb->fp;
 
 	ret = mei_cl_write(cl, cb, false);
 	if (ret < 0)
@@ -375,7 +375,7 @@ void mei_amthif_complete(struct mei_cl *cl, struct mei_cl_cb *cb)
 			return;
 		}
 		dev->iamthif_state = MEI_IAMTHIF_IDLE;
-		dev->iamthif_fp = NULL;
+		cl->fp = NULL;
 		if (!dev->iamthif_canceled) {
 			/*
 			 * 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)
 */
 int mei_amthif_release(struct mei_device *dev, struct file *file)
 {
+	struct mei_cl *cl = file->private_data;
+
 	if (dev->iamthif_open_count > 0)
 		dev->iamthif_open_count--;
 
-	if (dev->iamthif_fp == file &&
-	    dev->iamthif_state != MEI_IAMTHIF_IDLE) {
+	if (cl->fp == file && dev->iamthif_state != MEI_IAMTHIF_IDLE) {
 
 		dev_dbg(dev->dev, "amthif canceled iamthif state %d\n",
 		    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)
 			dev_err(dev->dev, "timer: amthif  hanged.\n");
 			mei_reset(dev);
 
-			dev->iamthif_fp = NULL;
 			mei_amthif_run_next_cmd(dev);
 		}
 	}
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)
 		goto err_unlock;
 	}
 
+	cl->fp = file;
 	file->private_data = cl;
 
 	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 {
  * @ev_async: event async notification
  * @status: connection status
  * @me_cl: fw client connected
+ * @fp: file associated with client
  * @host_client_id: host id
  * @mei_flow_ctrl_creds: transmit flow credentials
  * @timer_count:  watchdog timer for operation completion
@@ -223,6 +224,7 @@ struct mei_cl {
 	struct fasync_struct *ev_async;
 	int status;
 	struct mei_me_client *me_cl;
+	const struct file *fp;
 	u8 host_client_id;
 	u8 mei_flow_ctrl_creds;
 	u8 timer_count;
@@ -398,7 +400,6 @@ const char *mei_pg_state_str(enum mei_pg_state state);
  * @override_fixed_address: force allow fixed address behavior
  *
  * @amthif_cmd_list : amthif list for cmd waiting
- * @iamthif_fp : file for current amthif operation
  * @iamthif_cl  : amthif host client
  * @iamthif_open_count : number of opened amthif connections
  * @iamthif_stall_timer : timer to detect amthif hang
@@ -481,8 +482,6 @@ struct mei_device {
 
 	/* amthif list for cmd waiting */
 	struct mei_cl_cb amthif_cmd_list;
-	/* driver managed amthif list for reading completed amthif cmd data */
-	const struct file *iamthif_fp;
 	struct mei_cl iamthif_cl;
 	long iamthif_open_count;
 	u32 iamthif_stall_timer;
-- 
2.7.4

  parent reply	other threads:[~2016-07-22 12:57 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-22 12:56 [char-misc-next 00/12] mei: rx enhancements Tomas Winkler
2016-07-22 12:56 ` [char-misc-next 01/12] mei: move read cb to complete queue if not connected Tomas Winkler
2016-07-22 12:56 ` Tomas Winkler [this message]
2016-07-22 12:56 ` [char-misc-next 03/12] mei: add read callback on demand for fixed_address clients Tomas Winkler
2016-07-22 12:56 ` [char-misc-next 04/12] mei: amthif: drop mei_clear_lists function Tomas Winkler
2016-07-22 12:56 ` [char-misc-next 05/12] mei: drop redundant krealloc and checks in irq read Tomas Winkler
2016-07-22 12:56 ` [char-misc-next 06/12] mei: prepare read cb for fixed address clients on the receive path only Tomas Winkler
2016-07-22 12:56 ` [char-misc-next 07/12] mei: rx flow control counter Tomas Winkler
2016-07-22 12:56 ` [char-misc-next 08/12] mei: use consistent naming for TX control flow credits Tomas Winkler
2016-07-22 12:56 ` [char-misc-next 09/12] mei: add wrapper for queuing control commands Tomas Winkler
2016-07-22 12:56 ` [char-misc-next 10/12] mei: enqueue consecutive reads Tomas Winkler
2016-07-22 12:56 ` [char-misc-next 11/12] mei: amthif: drop mei_amthif_read Tomas Winkler
2016-07-22 12:56 ` [char-misc-next 12/12] mei: drop unused file transaction states Tomas Winkler
2016-07-24 22:52 ` [char-misc-next 00/12] mei: rx enhancements Winkler, Tomas
2016-07-24 23:28   ` Greg Kroah-Hartman
2016-07-25 21:49     ` Winkler, Tomas
2016-08-29 21:27       ` Winkler, Tomas
2016-08-30  6:11         ` '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=1469192189-29042-3-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®