All of lore.kernel.org
 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>,
	Vitaly Lubart <vitaly.lubart@intel.com>,
	linux-kernel@vger.kernel.org,
	Tomas Winkler <tomas.winkler@intel.com>
Subject: [char-misc-next 4/4] mei: do not overwrite state on hw start
Date: Tue, 15 Feb 2022 10:04:38 +0200	[thread overview]
Message-ID: <20220215080438.264876-4-tomas.winkler@intel.com> (raw)
In-Reply-To: <20220215080438.264876-1-tomas.winkler@intel.com>

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

During the hardware start sequence, do not overwrite the driver state
and do not proceed with the initialization sequence if the state
was changed while the driver was waiting for the start interrupt.

This can happen if the driver's removal/stop procedure was triggered
from the parent level while the driver is waiting for the start
interrupt. This may lead to stray the reset work or the timer
after driver were removed.

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

diff --git a/drivers/misc/mei/init.c b/drivers/misc/mei/init.c
index f79076c67256..eb052005ca86 100644
--- a/drivers/misc/mei/init.c
+++ b/drivers/misc/mei/init.c
@@ -161,6 +161,11 @@ int mei_reset(struct mei_device *dev)
 		return ret;
 	}
 
+	if (dev->dev_state != MEI_DEV_RESETTING) {
+		dev_dbg(dev->dev, "wrong state = %d on link start\n", dev->dev_state);
+		return 0;
+	}
+
 	dev_dbg(dev->dev, "link is established start sending messages.\n");
 
 	mei_set_devstate(dev, MEI_DEV_INIT_CLIENTS);
-- 
2.34.1


  parent reply	other threads:[~2022-02-15  8:05 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-15  8:04 [char-misc 1/4] mei: me: disable driver on the ign firmware Tomas Winkler
2022-02-15  8:04 ` [char-misc-next 2/4] mei: me: avoid link reset on shutdown Tomas Winkler
2022-02-15  8:04 ` [char-misc-next 3/4] mei: me: fix reset policy on read error in interrupt Tomas Winkler
2022-02-15  8:04 ` Tomas Winkler [this message]
2022-02-15 10:24 ` [char-misc 1/4] mei: me: disable driver on the ign firmware Greg Kroah-Hartman
2022-02-15 13:56   ` Winkler, Tomas

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=20220215080438.264876-4-tomas.winkler@intel.com \
    --to=tomas.winkler@intel.com \
    --cc=alexander.usyskin@intel.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=vitaly.lubart@intel.com \
    /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 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.