devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
To: Shradha Todi <shradha.t@samsung.com>,
	lpieralisi@kernel.org, kw@linux.com, robh@kernel.org,
	bhelgaas@google.com, krzysztof.kozlowski+dt@linaro.org,
	alim.akhtar@samsung.com, jingoohan1@gmail.com,
	Sergey.Semin@baikalelectronics.ru, lukas.bulwahn@gmail.com,
	hongxing.zhu@nxp.com, tglx@linutronix.de,
	m.szyprowski@samsung.com, jh80.chung@samsung.co,
	pankaj.dubey@samsung.com
Cc: linux-pci@vger.kernel.org, devicetree@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	linux-samsung-soc@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 15/16] PCI: samsung: Add structure to hold resource operations
Date: Thu, 16 Feb 2023 12:11:49 +0100	[thread overview]
Message-ID: <a0c79665-adb9-a846-5a84-d85e0684c25f@linaro.org> (raw)
In-Reply-To: <20230214121333.1837-16-shradha.t@samsung.com>

On 14/02/2023 13:13, Shradha Todi wrote:
> Some resources might differ based on platforms and we

Please wrap commit message according to Linux coding style / submission
process (neither too early nor over the limit):
https://elixir.bootlin.com/linux/v5.18-rc4/source/Documentation/process/submitting-patches.rst#L586

Wrapping looks a bit short...

> need platform specific functions to initialize or alter
> them. For better code reusibility, making a separate

typo, I think it is: re-usability

> res_ops which will hold all such function pointers or
> other resource specific data.

Are you saying that interrupts differ in different devices?

> 
> This patch includes adding function pointer for IRQ

Do not use "This commit/patch".
https://elixir.bootlin.com/linux/v5.17.1/source/Documentation/process/submitting-patches.rst#L95

> initialization which will help to move common operations for
> host init into the probe sequence.
> 
> Suggested-by: Pankaj Dubey <pankaj.dubey@samsung.com>
> Signed-off-by: Shradha Todi <shradha.t@samsung.com>
> ---
>  drivers/pci/controller/dwc/pci-samsung.c | 26 ++++++++++++++++--------
>  1 file changed, 17 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/pci/controller/dwc/pci-samsung.c b/drivers/pci/controller/dwc/pci-samsung.c
> index 47ca2a6a545d..01882f2d06c7 100644
> --- a/drivers/pci/controller/dwc/pci-samsung.c
> +++ b/drivers/pci/controller/dwc/pci-samsung.c
> @@ -55,6 +55,7 @@ struct samsung_pcie_pdata {
>  	struct pci_ops				*pci_ops;
>  	const struct dw_pcie_ops		*dwc_ops;
>  	const struct dw_pcie_host_ops		*host_ops;
> +	const struct samsung_res_ops		*res_ops;
>  };
>  
>  /*
> @@ -77,6 +78,10 @@ struct samsung_pcie {
>  	struct regulator_bulk_data	supplies[2];
>  };
>  
> +struct samsung_res_ops {
> +	int (*irq_init)(struct samsung_pcie *sp, struct platform_device *pdev);
> +};
> +
>  static int samsung_pcie_init_clk_resources(struct samsung_pcie *sp)
>  {
>  	struct device *dev = sp->pci.dev;
> @@ -276,7 +281,7 @@ static const struct dw_pcie_host_ops exynos_pcie_host_ops = {
>  	.host_init = exynos_pcie_host_init,
>  };
>  
> -static int exynos_add_pcie_port(struct samsung_pcie *sp,
> +static int exynos_irq_init(struct samsung_pcie *sp,
>  				       struct platform_device *pdev)
>  {
>  	struct dw_pcie *pci = &sp->pci;
> @@ -295,15 +300,8 @@ static int exynos_add_pcie_port(struct samsung_pcie *sp,
>  		return ret;
>  	}
>  
> -	pp->ops = &exynos_pcie_host_ops;
>  	pp->msi_irq[0] = -ENODEV;
>  
> -	ret = dw_pcie_host_init(pp);
> -	if (ret) {
> -		dev_err(dev, "failed to initialize host\n");
> -		return ret;
> -	}
> -
>  	return 0;
>  }
>  
> @@ -314,6 +312,10 @@ static const struct dw_pcie_ops exynos_dw_pcie_ops = {
>  	.start_link = exynos_pcie_start_link,
>  };
>  
> +static const struct samsung_res_ops exynos_res_ops_data = {
> +	.irq_init		= exynos_irq_init,
> +};
> +
>  static int samsung_pcie_probe(struct platform_device *pdev)
>  {
>  	struct device *dev = &pdev->dev;
> @@ -357,7 +359,12 @@ static int samsung_pcie_probe(struct platform_device *pdev)
>  
>  	platform_set_drvdata(pdev, sp);
>  
> -	ret = exynos_add_pcie_port(sp, pdev);
> +	if (pdata->res_ops->irq_init)
> +		pdata->res_ops->irq_init(sp, pdev);

Check return value and handle errors.

> +
> +	sp->pci.pp.ops = pdata->host_ops;
> +
> +	ret = dw_pcie_host_init(&sp->pci.pp);
>  	if (ret < 0)
>  		goto fail_probe;
>  
> @@ -428,6 +435,7 @@ static const struct samsung_pcie_pdata exynos_5433_pcie_rc_pdata = {
>  	.dwc_ops		= &exynos_dw_pcie_ops,
>  	.pci_ops		= &exynos_pci_ops,
>  	.host_ops		= &exynos_pcie_host_ops,
> +	.res_ops		= &exynos_res_ops_data,
>  };
>  
>  static const struct of_device_id samsung_pcie_of_match[] = {

Best regards,
Krzysztof


  reply	other threads:[~2023-02-16 11:11 UTC|newest]

Thread overview: 48+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20230214121348epcas5p48a3b2b225f616d748cc20622d01edb97@epcas5p4.samsung.com>
2023-02-14 12:13 ` [PATCH 00/16] Refactor Exynos PCIe driver to make it generic Shradha Todi
     [not found]   ` <CGME20230214121404epcas5p3bfa6af0151b7f319d418f7c0dbed7c5a@epcas5p3.samsung.com>
2023-02-14 12:13     ` [PATCH 01/16] dt-bindings: PCI: Rename Exynos PCIe binding to Samsung PCIe Shradha Todi
2023-02-16 10:54       ` Krzysztof Kozlowski
2023-02-18  1:54         ` Han Jingoo
2023-03-02 12:54         ` Shradha Todi
2023-03-03 10:12           ` Krzysztof Kozlowski
     [not found]   ` <CGME20230214121411epcas5p25efd5d4242c512f21165df0c2e81b8bc@epcas5p2.samsung.com>
2023-02-14 12:13     ` [PATCH 02/16] PCI: exynos: Rename Exynos PCIe driver " Shradha Todi
2023-02-16 10:55       ` Krzysztof Kozlowski
2023-02-16 10:59         ` Krzysztof Kozlowski
2023-03-02 12:57           ` Shradha Todi
2023-03-03 10:35             ` Krzysztof Kozlowski
     [not found]   ` <CGME20230214121416epcas5p4de066199144cba18858e68f6d0ccb1c0@epcas5p4.samsung.com>
2023-02-14 12:13     ` [PATCH 03/16] PCI: samsung: Change macro names to exynos specific Shradha Todi
2023-02-16 10:58       ` Krzysztof Kozlowski
     [not found]   ` <CGME20230214121420epcas5p3a4419059969adfb45b379f7e7741968c@epcas5p3.samsung.com>
2023-02-14 12:13     ` [PATCH 04/16] PCI: samsung: Use clock bulk API to get clocks Shradha Todi
2023-02-16 11:02       ` Krzysztof Kozlowski
2023-03-02 12:59         ` Shradha Todi
     [not found]   ` <CGME20230214121424epcas5p38e74b52a2d94a32b82a093c7e0a12499@epcas5p3.samsung.com>
2023-02-14 12:13     ` [PATCH 05/16] dt-bindings: PCI: Rename the term elbi to appl Shradha Todi
2023-02-14 16:12       ` Rob Herring
2023-03-02 12:47         ` Shradha Todi
2023-02-14 19:15       ` Rob Herring
2023-02-16 11:04         ` Krzysztof Kozlowski
     [not found]   ` <CGME20230214121428epcas5p3d91e877e62a78008d2b0d6066efea059@epcas5p3.samsung.com>
2023-02-14 12:13     ` [PATCH 06/16] arm64: dts: exynos: " Shradha Todi
2023-02-16 11:03       ` Krzysztof Kozlowski
2023-03-02 13:07         ` Shradha Todi
2023-03-03 10:37           ` Krzysztof Kozlowski
     [not found]   ` <CGME20230214121432epcas5p27248b4dafdec64b0172c69f7909d7a64@epcas5p2.samsung.com>
2023-02-14 12:13     ` [PATCH 07/16] PCI: samsung: " Shradha Todi
     [not found]   ` <CGME20230214121436epcas5p1641de02220bea5edb23bc875b6311270@epcas5p1.samsung.com>
2023-02-14 12:13     ` [PATCH 08/16] PCI: samsung: Rename exynos_pcie to samsung_pcie Shradha Todi
2023-02-16 11:07       ` Krzysztof Kozlowski
2023-03-02 12:32         ` Pankaj Dubey
2023-03-03 10:06           ` Krzysztof Kozlowski
     [not found]   ` <CGME20230214121440epcas5p46db82a141c3e2664cff4b290b49c3938@epcas5p4.samsung.com>
2023-02-14 12:13     ` [PATCH 09/16] PCI: samsung: Make common appl readl/writel functions Shradha Todi
2023-02-16 11:07       ` Krzysztof Kozlowski
2023-03-02 12:33         ` Pankaj Dubey
     [not found]   ` <CGME20230214121444epcas5p16c5f7665fc9dee78cd427d976114e4f1@epcas5p1.samsung.com>
2023-02-14 12:13     ` [PATCH 10/16] dt-bindings: PCI: Add phy-names as required property Shradha Todi
2023-02-14 16:12       ` Rob Herring
2023-03-02 12:48         ` Shradha Todi
2023-02-14 19:17       ` Rob Herring
2023-03-02 12:51         ` Shradha Todi
     [not found]   ` <CGME20230214121448epcas5p48e626bd21819a37308b6277f7b29286c@epcas5p4.samsung.com>
2023-02-14 12:13     ` [PATCH 11/16] arm64: dts: exynos: Add phy-names as DT property Shradha Todi
     [not found]   ` <CGME20230214121451epcas5p148118502c76299b2a6f389881fa296cc@epcas5p1.samsung.com>
2023-02-14 12:13     ` [PATCH 12/16] PCI: samsung: Get PHY using non-DT version Shradha Todi
     [not found]   ` <CGME20230214121456epcas5p36603c8d717588699d1b5575229d19114@epcas5p3.samsung.com>
2023-02-14 12:13     ` [PATCH 13/16] PCI: samsung: Rename common functions to samsung Shradha Todi
2023-02-16 11:09       ` Krzysztof Kozlowski
     [not found]   ` <CGME20230214121503epcas5p291dce2b37ec4cdabcfecbf8fbdfcca51@epcas5p2.samsung.com>
2023-02-14 12:13     ` [PATCH 15/16] PCI: samsung: Add structure to hold resource operations Shradha Todi
2023-02-16 11:11       ` Krzysztof Kozlowski [this message]
2023-03-02 13:10         ` Shradha Todi
     [not found]   ` <CGME20230214121507epcas5p1590024fc32dfcf562efce93cf5f07221@epcas5p1.samsung.com>
2023-02-14 12:13     ` [PATCH 16/16] PCI: samsung: Make handling of regulators generic Shradha Todi
2023-02-16 10:57   ` [PATCH 00/16] Refactor Exynos PCIe driver to make it generic Krzysztof Kozlowski
2023-03-03 12:38   ` Serge Semin

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=a0c79665-adb9-a846-5a84-d85e0684c25f@linaro.org \
    --to=krzysztof.kozlowski@linaro.org \
    --cc=Sergey.Semin@baikalelectronics.ru \
    --cc=alim.akhtar@samsung.com \
    --cc=bhelgaas@google.com \
    --cc=devicetree@vger.kernel.org \
    --cc=hongxing.zhu@nxp.com \
    --cc=jh80.chung@samsung.co \
    --cc=jingoohan1@gmail.com \
    --cc=krzysztof.kozlowski+dt@linaro.org \
    --cc=kw@linux.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=linux-samsung-soc@vger.kernel.org \
    --cc=lpieralisi@kernel.org \
    --cc=lukas.bulwahn@gmail.com \
    --cc=m.szyprowski@samsung.com \
    --cc=pankaj.dubey@samsung.com \
    --cc=robh@kernel.org \
    --cc=shradha.t@samsung.com \
    --cc=tglx@linutronix.de \
    /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;
as well as URLs for NNTP newsgroup(s).