[U-Boot] [PATCH 3/5] pci: tegra: make tegra_pcie_port_reset weak function with explicit index

Stephen Warren swarren at wwwdotorg.org
Fri Aug 4 16:33:33 UTC 2017

On 08/04/2017 10:10 AM, Marcel Ziswiler wrote:
> From: Marcel Ziswiler <marcel.ziswiler at toradex.com>
> Make tegra_pcie_port_reset() a weak function with an explicit index
> parameter. This allows overriding the PCIe port reset functionality
> from board specific code as e.g. required for Apalis TK1.

I think this change should be implemented differently.

Does the patch description mean that:

a) This change allows the board code to know which port is being reset.

If so, simply have the board-specific implementation access port->index 
since it's already being passed port, and all callers are passing 
port->index as the index parameter. If the type isn't available, then 
you can add a tegra_pcie_port_index_of_port() function to retrieve it 
through the opaque type.


b) That by changing the function signature code is able to choose 
between calling the board-specific reset override function and the PCIe 
driver low-level reset function?

If so, let's just have two different function names, have all callers 
call the board-specific function only, and have the board-specific 
function call the driver function. There can be a weak default 
board-specific implementation that simply calls the driver function.

More information about the U-Boot mailing list