Re: [PATCH] PCI: pcie-rcar: Cache PHY init function pointer

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, Apr 26, 2020 at 02:31:47PM +0200, marek.vasut@xxxxxxxxx wrote:
> From: Marek Vasut <marek.vasut+renesas@xxxxxxxxx>
> 
> The PHY initialization function pointer does not change during the
> lifetime of the driver instance, it is therefore sufficient to get
> the pointer in .probe(), cache it in driver private data, and just
> call the function through the cached pointer in .resume().
> 
> Signed-off-by: Marek Vasut <marek.vasut+renesas@xxxxxxxxx>
> Cc: Bjorn Helgaas <bhelgaas@xxxxxxxxxx>
> Cc: Lorenzo Pieralisi <lorenzo.pieralisi@xxxxxxx>
> Cc: Geert Uytterhoeven <geert+renesas@xxxxxxxxx>
> Cc: Wolfram Sang <wsa@xxxxxxxxxxxxx>
> Cc: linux-renesas-soc@xxxxxxxxxxxxxxx
> ---
> NOTE: Based on git://git.kernel.org/pub/scm/linux/kernel/git/lpieralisi/pci.git
>       branch pci/rcar
> NOTE: The driver tag is now 'pcie-rcar' to distinguish it from pci-rcar-gen2.c
> ---
>  drivers/pci/controller/pcie-rcar.c | 10 ++++------
>  1 file changed, 4 insertions(+), 6 deletions(-)

Squashed in https://patchwork.kernel.org/patch/11438665

Do you want me to rename the $SUBJECT (and the branch name while at it)
in the patches in my pci/rcar branch ("PCI: pcie-rcar: ...") to start
the commit subject tag renaming from this cycle (and in the interim you
send a rename for the drivers files ?)

Lorenzo

> diff --git a/drivers/pci/controller/pcie-rcar.c b/drivers/pci/controller/pcie-rcar.c
> index 1a0e74cad9bb..59e55f56e386 100644
> --- a/drivers/pci/controller/pcie-rcar.c
> +++ b/drivers/pci/controller/pcie-rcar.c
> @@ -153,6 +153,7 @@ struct rcar_pcie {
>  	int			root_bus_nr;
>  	struct clk		*bus_clk;
>  	struct			rcar_msi msi;
> +	int			(*phy_init_fn)(struct rcar_pcie *pcie);
>  };
>  
>  static void rcar_pci_write_reg(struct rcar_pcie *pcie, u32 val,
> @@ -1147,7 +1148,6 @@ static int rcar_pcie_probe(struct platform_device *pdev)
>  	struct rcar_pcie *pcie;
>  	u32 data;
>  	int err;
> -	int (*phy_init_fn)(struct rcar_pcie *);
>  	struct pci_host_bridge *bridge;
>  
>  	bridge = pci_alloc_host_bridge(sizeof(*pcie));
> @@ -1187,8 +1187,8 @@ static int rcar_pcie_probe(struct platform_device *pdev)
>  	if (err)
>  		goto err_clk_disable;
>  
> -	phy_init_fn = of_device_get_match_data(dev);
> -	err = phy_init_fn(pcie);
> +	pcie->phy_init_fn = of_device_get_match_data(dev);
> +	err = pcie->phy_init_fn(pcie);
>  	if (err) {
>  		dev_err(dev, "failed to init PCIe PHY\n");
>  		goto err_clk_disable;
> @@ -1253,7 +1253,6 @@ static int rcar_pcie_probe(struct platform_device *pdev)
>  static int __maybe_unused rcar_pcie_resume(struct device *dev)
>  {
>  	struct rcar_pcie *pcie = dev_get_drvdata(dev);
> -	int (*hw_init_fn)(struct rcar_pcie *);
>  	unsigned int data;
>  	int err;
>  
> @@ -1262,8 +1261,7 @@ static int __maybe_unused rcar_pcie_resume(struct device *dev)
>  		return 0;
>  
>  	/* Failure to get a link might just be that no cards are inserted */
> -	hw_init_fn = of_device_get_match_data(dev);
> -	err = hw_init_fn(pcie);
> +	err = pcie->phy_init_fn(pcie);
>  	if (err) {
>  		dev_info(dev, "PCIe link down\n");
>  		return 0;
> -- 
> 2.25.1
> 



[Index of Archives]     [Linux Samsung SOC]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]

  Powered by Linux