Export gen_pci_init() API to create ECAM and initialized ECAM OPs
from PCIe driver which don't have way to populate driver_data as
just ECAM ops.
Signed-off-by: Mayank Rana <quic_mrana@quicinc.com>
---
drivers/pci/controller/pci-host-common.c | 3 ++-
include/linux/pci-ecam.h | 2 ++
2 files changed, 4 insertions(+), 1 deletion(-)
diff --git a/drivers/pci/controller/pci-host-common.c b/drivers/pci/controller/pci-host-common.c
index cf5f59a745b3..b9460a4c5b7e 100644
--- a/drivers/pci/controller/pci-host-common.c
+++ b/drivers/pci/controller/pci-host-common.c
@@ -20,7 +20,7 @@ static void gen_pci_unmap_cfg(void *ptr)
pci_ecam_free((struct pci_config_window *)ptr);
}
-static struct pci_config_window *gen_pci_init(struct device *dev,
+struct pci_config_window *gen_pci_init(struct device *dev,
struct pci_host_bridge *bridge, const struct pci_ecam_ops *ops)
{
int err;
@@ -48,6 +48,7 @@ static struct pci_config_window *gen_pci_init(struct device *dev,
return cfg;
}
+EXPORT_SYMBOL_GPL(gen_pci_init);
int pci_host_common_probe(struct platform_device *pdev)
{
diff --git a/include/linux/pci-ecam.h b/include/linux/pci-ecam.h
index 3a4860bd2758..386c08349169 100644
--- a/include/linux/pci-ecam.h
+++ b/include/linux/pci-ecam.h
@@ -94,5 +94,7 @@ extern const struct pci_ecam_ops loongson_pci_ecam_ops; /* Loongson PCIe */
/* for DT-based PCI controllers that support ECAM */
int pci_host_common_probe(struct platform_device *pdev);
void pci_host_common_remove(struct platform_device *pdev);
+struct pci_config_window *gen_pci_init(struct device *dev,
+ struct pci_host_bridge *bridge, const struct pci_ecam_ops *ops);
#endif
#endif
--
2.25.1
On Wed, Nov 06, 2024 at 02:13:39PM -0800, Mayank Rana wrote:
> Export gen_pci_init() API to create ECAM and initialized ECAM OPs
> from PCIe driver which don't have way to populate driver_data as
> just ECAM ops.
>
> Signed-off-by: Mayank Rana <quic_mrana@quicinc.com>
> ---
> drivers/pci/controller/pci-host-common.c | 3 ++-
> include/linux/pci-ecam.h | 2 ++
> 2 files changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/pci/controller/pci-host-common.c b/drivers/pci/controller/pci-host-common.c
> index cf5f59a745b3..b9460a4c5b7e 100644
> --- a/drivers/pci/controller/pci-host-common.c
> +++ b/drivers/pci/controller/pci-host-common.c
> @@ -20,7 +20,7 @@ static void gen_pci_unmap_cfg(void *ptr)
> pci_ecam_free((struct pci_config_window *)ptr);
> }
>
> -static struct pci_config_window *gen_pci_init(struct device *dev,
> +struct pci_config_window *gen_pci_init(struct device *dev,
Please rename the API to something like 'pci_host_common_init()'.
'gen_pci_init()' is fine within the driver, but doesn't look good when exported
outside.
- Mani
> struct pci_host_bridge *bridge, const struct pci_ecam_ops *ops)
> {
> int err;
> @@ -48,6 +48,7 @@ static struct pci_config_window *gen_pci_init(struct device *dev,
>
> return cfg;
> }
> +EXPORT_SYMBOL_GPL(gen_pci_init);
>
> int pci_host_common_probe(struct platform_device *pdev)
> {
> diff --git a/include/linux/pci-ecam.h b/include/linux/pci-ecam.h
> index 3a4860bd2758..386c08349169 100644
> --- a/include/linux/pci-ecam.h
> +++ b/include/linux/pci-ecam.h
> @@ -94,5 +94,7 @@ extern const struct pci_ecam_ops loongson_pci_ecam_ops; /* Loongson PCIe */
> /* for DT-based PCI controllers that support ECAM */
> int pci_host_common_probe(struct platform_device *pdev);
> void pci_host_common_remove(struct platform_device *pdev);
> +struct pci_config_window *gen_pci_init(struct device *dev,
> + struct pci_host_bridge *bridge, const struct pci_ecam_ops *ops);
> #endif
> #endif
> --
> 2.25.1
>
--
மணிவண்ணன் சதாசிவம்
On 11/15/2024 1:17 AM, Manivannan Sadhasivam wrote:
> On Wed, Nov 06, 2024 at 02:13:39PM -0800, Mayank Rana wrote:
>> Export gen_pci_init() API to create ECAM and initialized ECAM OPs
>> from PCIe driver which don't have way to populate driver_data as
>> just ECAM ops.
>>
>> Signed-off-by: Mayank Rana <quic_mrana@quicinc.com>
>> ---
>> drivers/pci/controller/pci-host-common.c | 3 ++-
>> include/linux/pci-ecam.h | 2 ++
>> 2 files changed, 4 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/pci/controller/pci-host-common.c b/drivers/pci/controller/pci-host-common.c
>> index cf5f59a745b3..b9460a4c5b7e 100644
>> --- a/drivers/pci/controller/pci-host-common.c
>> +++ b/drivers/pci/controller/pci-host-common.c
>> @@ -20,7 +20,7 @@ static void gen_pci_unmap_cfg(void *ptr)
>> pci_ecam_free((struct pci_config_window *)ptr);
>> }
>>
>> -static struct pci_config_window *gen_pci_init(struct device *dev,
>> +struct pci_config_window *gen_pci_init(struct device *dev,
>
> Please rename the API to something like 'pci_host_common_init()'.
> 'gen_pci_init()' is fine within the driver, but doesn't look good when exported
> outside.
ACK
> - Mani
>
>> struct pci_host_bridge *bridge, const struct pci_ecam_ops *ops)
>> {
>> int err;
>> @@ -48,6 +48,7 @@ static struct pci_config_window *gen_pci_init(struct device *dev,
>>
>> return cfg;
>> }
>> +EXPORT_SYMBOL_GPL(gen_pci_init);
>>
>> int pci_host_common_probe(struct platform_device *pdev)
>> {
>> diff --git a/include/linux/pci-ecam.h b/include/linux/pci-ecam.h
>> index 3a4860bd2758..386c08349169 100644
>> --- a/include/linux/pci-ecam.h
>> +++ b/include/linux/pci-ecam.h
>> @@ -94,5 +94,7 @@ extern const struct pci_ecam_ops loongson_pci_ecam_ops; /* Loongson PCIe */
>> /* for DT-based PCI controllers that support ECAM */
>> int pci_host_common_probe(struct platform_device *pdev);
>> void pci_host_common_remove(struct platform_device *pdev);
>> +struct pci_config_window *gen_pci_init(struct device *dev,
>> + struct pci_host_bridge *bridge, const struct pci_ecam_ops *ops);
>> #endif
>> #endif
>> --
>> 2.25.1
>>
>
© 2016 - 2026 Red Hat, Inc.