Linux PCI subsystem development
 help / color / mirror / Atom feed
From: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
To: Hans Zhang <18255117159@163.com>
Cc: lpieralisi@kernel.org, kw@linux.com, robh@kernel.org,
	bhelgaas@google.com, jingoohan1@gmail.com,
	thomas.richard@bootlin.com, linux-pci@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [v4 1/4] PCI: Introduce generic capability search functions
Date: Fri, 21 Mar 2025 18:30:10 +0530	[thread overview]
Message-ID: <20250321130010.s6svrtqlpdkgxmir@thinkpad> (raw)
In-Reply-To: <20250321101710.371480-2-18255117159@163.com>

On Fri, Mar 21, 2025 at 06:17:07PM +0800, Hans Zhang wrote:
> Existing controller drivers (e.g., DWC, custom out-of-tree drivers)
> duplicate logic for scanning PCI capability lists. This creates
> maintenance burdens and risks inconsistencies.
> 
> To resolve this:
> 
> 1. Add pci_generic_find_capability() and pci_generic_find_ext_capability()
> in drivers/pci/pci.c, accepting controller-specific read functions
> and device data as parameters.
> 

I'd reword pci_generic* as pci_host_bridge* to reflect the fact that these APIs
are meant for host bridges.

> 2. Refactor dwc_pcie_find_capability() and similar functions to utilize
> these new generic interfaces.
> 

This is not part of this patch. So should be dropped.

> 3. Update out-of-tree drivers to leverage the common implementation,
> eliminating code duplication.
> 

This also.

> This approach:
> - Centralizes critical PCI capability scanning logic
> - Allows flexible adaptation to varied hardware access methods
> - Reduces future maintenance overhead
> - Aligns with kernel code reuse best practices
> 
> Tested with DWC PCIe controller and CDNS PCIe drivers.
> 

This tested info is also not required since the DWC and CDNS changes are not
part of this patch.

- Mani

-- 
மணிவண்ணன் சதாசிவம்

  parent reply	other threads:[~2025-03-21 13:00 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-21 10:17 [v4 0/4] Introduce generic capability search functions Hans Zhang
2025-03-21 10:17 ` [v4 1/4] PCI: " Hans Zhang
2025-03-21 12:46   ` kernel test robot
2025-03-21 13:00   ` Manivannan Sadhasivam [this message]
2025-03-21 13:57     ` Hans Zhang
2025-03-21 10:17 ` [v4 2/4] PCI: dwc: Replace dw_pcie_find_capability() and dw_pcie_find_ext_capability() Hans Zhang
2025-03-21 13:05   ` Manivannan Sadhasivam
2025-03-21 13:58     ` Hans Zhang
2025-03-21 10:17 ` [v4 3/4] PCI: cadence: Add configuration space capability search API Hans Zhang
2025-03-21 13:06   ` Manivannan Sadhasivam
2025-03-21 13:58     ` Hans Zhang
2025-03-21 10:17 ` [v4 4/4] PCI: cadence: Use cdns_pcie_find_*capability to find capability offset instead of hardcore Hans Zhang
2025-03-21 13:18   ` Manivannan Sadhasivam
2025-03-21 13:59     ` Hans Zhang

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=20250321130010.s6svrtqlpdkgxmir@thinkpad \
    --to=manivannan.sadhasivam@linaro.org \
    --cc=18255117159@163.com \
    --cc=bhelgaas@google.com \
    --cc=jingoohan1@gmail.com \
    --cc=kw@linux.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=lpieralisi@kernel.org \
    --cc=robh@kernel.org \
    --cc=thomas.richard@bootlin.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox