Hi Ilpo,None of these bullets are true lists so please write them as normal
The [v9 3/6]patch I plan to submit is as follows, please review it.
From 6da415d130e76b57ecf401f14bf0b66f20407839 Mon Sep 17 00:00:00 2001
From: Hans Zhang<18255117159@xxxxxxx>
Date: Fri, 4 Apr 2025 00:20:29 +0800
Subject: [v9 3/6] PCI: Refactor capability search into common macros
- Capability search is done both in PCI core and some controller drivers.
- PCI core's cap search func requires PCI device and bus structs exist.
- Controller drivers cannot use PCI core's cap search func as they
need to find capabilities before they instantiated the PCI device & bus
structs.
- Move capability search into a macro so it can be reused where normal
PCI config space accessors cannot yet be used due to lack of the
instantiated PCI dev.
- Instead, give the config space reading function as an argument to the
new macro.
- Convert PCI core to use the new macro.
English paragraphs. Also please extend some of shortened words lke "cap"
--> "Capability", "PCI dev" -> PCI Device (for terms, the capitalization
of the first letter, you should follow what the PCI specs use).
The macros now implement, parameterized by the config access method. The
PCI core functions are converted to utilize these macros with the standard
pci_bus_read_config accessors. Controller drivers can later use the same
macros with their early access mechanisms while maintaining the existing
protection against infinite loops through preserved TTL checks.
The ttl parameter was originally an additional safeguard to prevent
infinite loops in corrupted config space. However, the
PCI_FIND_NEXT_CAP_TTL macro already enforces a TTL limit internally.
Removing redundant ttl handling simplifies the interface while maintaining
the safety guarantee. This aligns with the macro's design intent of
encapsulating TTL management.
Signed-off-by: Hans Zhang<18255117159@xxxxxxx>
---
drivers/pci/pci.c | 70 +++++---------------------------------
drivers/pci/pci.h | 86 +++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 95 insertions(+), 61 deletions(-)