All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alexander Usyskin <alexander.usyskin@intel.com>
To: Arnd Bergmann <arnd@arndb.de>,
	 Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Menachem Adin <menachem.adin@intel.com>,
	linux-kernel@vger.kernel.org,
	 Alexander Usyskin <alexander.usyskin@intel.com>
Subject: [PATCH char-misc-next] mei: bus: speed up firmware version retrieval
Date: Wed, 02 Dec 2026 09:36:47 +0200	[thread overview]
Message-ID: <20261202-optimize_version-v1-1-05881df84011@intel.com> (raw)

Firmware clients are added to the head of the client list. During the
initial scan, this causes static clients (which have lower client IDs)
to end up at the tail of the list.

When querying the firmware version, it is preferable to use a lightweight
static client. Iterate over the firmware client list in reverse when
populating the bus so that static clients are processed first.

Additionally, add a check during static client version retrieval to avoid
a redundant second read if a static client arrives after a dynamic one.

Signed-off-by: Alexander Usyskin <alexander.usyskin@intel.com>
---
 drivers/misc/mei/bus-fixup.c | 3 +++
 drivers/misc/mei/bus.c       | 2 +-
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/misc/mei/bus-fixup.c b/drivers/misc/mei/bus-fixup.c
index bea7a47d216e..f25de4535b61 100644
--- a/drivers/misc/mei/bus-fixup.c
+++ b/drivers/misc/mei/bus-fixup.c
@@ -282,6 +282,9 @@ static void mei_gsc_mkhi_fix_ver(struct mei_cl_device *cldev)
 		goto out;
 	}
 
+	if (cldev->bus->fw_ver_received)
+		goto out;
+
 	ret = mei_fwver(cldev);
 	if (ret < 0)
 		dev_info(&cldev->dev, "FW version command failed %d\n",
diff --git a/drivers/misc/mei/bus.c b/drivers/misc/mei/bus.c
index cfb87ab8667f..a739e467fa33 100644
--- a/drivers/misc/mei/bus.c
+++ b/drivers/misc/mei/bus.c
@@ -1552,7 +1552,7 @@ static void mei_cl_bus_rescan(struct mei_device *bus)
 	mutex_lock(&bus->cl_bus_lock);
 
 	down_read(&bus->me_clients_rwsem);
-	list_for_each_entry(me_cl, &bus->me_clients, list)
+	list_for_each_entry_reverse(me_cl, &bus->me_clients, list)
 		mei_cl_bus_dev_init(bus, me_cl);
 	up_read(&bus->me_clients_rwsem);
 

---
base-commit: 6628e7d4c6b25c8d18f1345e3a20d21829aae7e4
change-id: 20261130-optimize_version-a6ca925051bf

Best regards,
-- 
Alexander Usyskin <alexander.usyskin@intel.com>


                 reply	other threads:[~2026-12-02  7:37 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20261202-optimize_version-v1-1-05881df84011@intel.com \
    --to=alexander.usyskin@intel.com \
    --cc=arnd@arndb.de \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=menachem.adin@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.