All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH char-misc-next] mei: bus: speed up firmware version retrieval
@ 2026-12-02  7:36 Alexander Usyskin
  0 siblings, 0 replies; only message in thread
From: Alexander Usyskin @ 2026-12-02  7:36 UTC (permalink / raw)
  To: Arnd Bergmann, Greg Kroah-Hartman
  Cc: Menachem Adin, linux-kernel, Alexander Usyskin

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>


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2026-12-02  7:37 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-12-02  7:36 [PATCH char-misc-next] mei: bus: speed up firmware version retrieval Alexander Usyskin

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.