On Wed, Jun 18, 2025 at 11:20:59PM +0800, Hans Zhang wrote:
Register bit manipulation in DesignWare PCIe controllers currently
uses repetitive read-modify-write sequences across multiple drivers.
This pattern leads to code duplication and increases maintenance
complexity as each driver implements similar logic with minor variations.
This series introduces dw_pcie_clear_and_set_dword() to centralize atomic
register modification. The helper performs read-clear-set-write operations
in a single function, replacing open-coded implementations. Subsequent
patches refactor individual drivers to use this helper, eliminating
redundant code and ensuring consistent bit handling.
The change reduces overall code size by ~350 lines while improving
maintainability. Each controller driver is updated in a separate
patch to preserve bisectability and simplify review.
Thanks for the cleanup! I spotted a typo in patch 13/13. Apart from that, I only
have one comment. You are initializing the temp variable like 'val' to 0 and
then ORing it with some fields. Here the initialization part is not necessary.
You could just write the first field directly instead of ORing with a 0
initialized variable.
Rest LGTM!
- Mani