linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Oren Weil <oren.jer.weil@intel.com>
To: gregkh@suse.de
Cc: devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org,
	linux-watchdog@vger.kernel.org, alan@linux.intel.com,
	wim@iguana.be, tomas.winkler@intel.com,
	Oren Weil <oren.jer.weil@intel.com>
Subject: [PATCH 01/12] staging: mei: removing dependency between WD and AMTHI init function.
Date: Wed, 31 Aug 2011 16:42:37 +0300	[thread overview]
Message-ID: <1314798168-15613-2-git-send-email-oren.jer.weil@intel.com> (raw)
In-Reply-To: <1314798168-15613-1-git-send-email-oren.jer.weil@intel.com>

AMTHI need to be initialized after WD Client was initialized, moving the AMTHI outside
of the WD initialization function.
in order to remove the coupling between the initialization of those clients.

AMTHI is getting initialized (getting connected to the FW feature/client) in two ways:
 1) if mei driver fails to send connect message to watchdog client (WD initialization), then
    immediately the AMTHI client getting initialized right after the watchdog initialization function.
 2) if Watchdog client success to send connect message to watchdog client, then only after
    the driver is getting the connect response message the AMTHI client is getting initialized

Signed-off-by: Oren Weil <oren.jer.weil@intel.com>
Acked-by: Tomas Winkler <tomas.winkler@intel.com>
---
 drivers/staging/mei/init.c      |    8 +++++++-
 drivers/staging/mei/interface.h |    2 +-
 drivers/staging/mei/wd.c        |   16 ++++++++++++----
 3 files changed, 20 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/mei/init.c b/drivers/staging/mei/init.c
index 0fa8216..69a57e7 100644
--- a/drivers/staging/mei/init.c
+++ b/drivers/staging/mei/init.c
@@ -521,7 +521,13 @@ void mei_host_client_properties(struct mei_device *dev)
 	bitmap_set(dev->host_clients_map, 0, 3);
 	dev->mei_state = MEI_ENABLED;
 
-	mei_wd_host_init(dev);
+	/* if wd initialization fails, initialization the AMTHI client,
+	 * otherwise the AMTHI client will be initialized after the WD client connect response
+	 * will be received
+	 */
+	if (mei_wd_host_init(dev))
+		mei_host_init_iamthif(dev);
+
 	return;
 }
 
diff --git a/drivers/staging/mei/interface.h b/drivers/staging/mei/interface.h
index d0bf5cf..7bcf096 100644
--- a/drivers/staging/mei/interface.h
+++ b/drivers/staging/mei/interface.h
@@ -48,7 +48,7 @@ int mei_flow_ctrl_creds(struct mei_device *dev, struct mei_cl *cl);
 
 int mei_wd_send(struct mei_device *dev);
 int mei_wd_stop(struct mei_device *dev, bool preserve);
-void mei_wd_host_init(struct mei_device *dev);
+bool mei_wd_host_init(struct mei_device *dev);
 void mei_wd_start_setup(struct mei_device *dev);
 
 int mei_flow_ctrl_reduce(struct mei_device *dev, struct mei_cl *cl);
diff --git a/drivers/staging/mei/wd.c b/drivers/staging/mei/wd.c
index 42f04ef..721487d 100644
--- a/drivers/staging/mei/wd.c
+++ b/drivers/staging/mei/wd.c
@@ -63,8 +63,10 @@ void mei_wd_start_setup(struct mei_device *dev)
  *
  * @dev: the device structure
  */
-void mei_wd_host_init(struct mei_device *dev)
+bool mei_wd_host_init(struct mei_device *dev)
 {
+	bool ret = false;
+
 	mei_cl_init(&dev->wd_cl, dev);
 
 	/* look for WD client and connect to it */
@@ -83,19 +85,25 @@ void mei_wd_host_init(struct mei_device *dev)
 				dev_dbg(&dev->pdev->dev, "Failed to connect to WD client\n");
 				dev->wd_cl.state = MEI_FILE_DISCONNECTED;
 				dev->wd_cl.host_client_id = 0;
-				mei_host_init_iamthif(dev) ;
+				ret = false;
+				goto end;
 			} else {
 				dev->wd_cl.timer_count = CONNECT_TIMEOUT;
 			}
 		} else {
 			dev_dbg(&dev->pdev->dev, "Failed to find WD client\n");
-			mei_host_init_iamthif(dev) ;
+			ret = false;
+			goto end;
 		}
 	} else {
 		dev->wd_bypass = true;
 		dev_dbg(&dev->pdev->dev, "WD requested to be disabled\n");
-		mei_host_init_iamthif(dev) ;
+		ret = false;
+		goto end;
 	}
+
+end:
+	return ret;
 }
 
 /**
-- 
1.7.4.1


  reply	other threads:[~2011-08-31 13:44 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-31 13:42 [PATCH 00/12] staging: mei: adding new watchdog core support Oren Weil
2011-08-31 13:42 ` Oren Weil [this message]
2011-08-31 13:42 ` [PATCH 02/12] staging: mei: fix register access function comments Oren Weil
2011-08-31 13:42 ` [PATCH 03/12] staging: mei: registering the MEI driver with the kernel watchdog core interface Oren Weil
2011-08-31 13:42 ` [PATCH 04/12] staging: mei: adding watchdog ops Oren Weil
2011-08-31 13:42 ` [PATCH 05/12] staging: mei: adding watchdog ping Oren Weil
2011-08-31 16:52   ` Dan Carpenter
2011-09-06 23:48     ` Greg KH
2011-08-31 13:42 ` [PATCH 06/12] staging: mei: adding set_timeout watchdog function Oren Weil
2011-08-31 13:42 ` [PATCH 07/12] staging: mei: renaming delayed work field and function to a meaningful name Oren Weil
2011-08-31 13:42 ` [PATCH 08/12] staging: mei: resuming timer regardless of the watchdog timeout value Oren Weil
2011-08-31 13:42 ` [PATCH 09/12] stagign: mei: client init code cleanup Oren Weil
2011-08-31 13:42 ` [PATCH 10/12] staging: mei: removing wd module parameters Oren Weil
2011-08-31 13:42 ` [PATCH 11/12] staging: mei: adding mei_wd_stop function comment Oren Weil
2011-08-31 13:42 ` [PATCH 12/12] staging: mei: adding watchdog core dependency to kconfig Oren Weil

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=1314798168-15613-2-git-send-email-oren.jer.weil@intel.com \
    --to=oren.jer.weil@intel.com \
    --cc=alan@linux.intel.com \
    --cc=devel@driverdev.osuosl.org \
    --cc=gregkh@suse.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-watchdog@vger.kernel.org \
    --cc=tomas.winkler@intel.com \
    --cc=wim@iguana.be \
    /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;
as well as URLs for NNTP newsgroup(s).