pci: Use conftest to find if pci_epc_event_ops struct has core_deinit

Use the conftest to find if the struct pci_epc_event_ops has
core_deinit as callback function. This callback is added
by Nvidia in core kernel.

Bug 4346767

Change-Id: I399197917ac7746ca367f55b9dc4e3a5bd79f073
Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3028740
Reviewed-by: Shardar Mohammed <smohammed@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
This commit is contained in:
Laxman Dewangan
2023-12-05 17:39:32 +00:00
committed by mobile promotions
parent a757343f2e
commit 1e9fc00bc2
5 changed files with 26 additions and 8 deletions

View File

@@ -5,6 +5,8 @@
* Copyright (C) 2021-2023 NVIDIA Corporation. All rights reserved.
*/
#include <nvidia/conftest.h>
#include <linux/crc32.h>
#include <linux/debugfs.h>
#include <linux/delay.h>
@@ -164,7 +166,7 @@ static int pcie_dma_epf_core_init(struct pci_epf *epf)
return 0;
}
#if !defined(NV_PCIE_DMA_EPF_CORE_DEINIT_NOT_AVAILABLE)
#if defined(NV_PCI_EPC_EVENT_OPS_STRUCT_HAS_CORE_DEINIT) /* Nvidia Internal */
static int pcie_dma_epf_core_deinit(struct pci_epf *epf)
{
struct pcie_epf_dma *epfnv = epf_get_drvdata(epf);
@@ -265,7 +267,7 @@ static const struct pci_epf_device_id pcie_dma_epf_ids[] = {
static const struct pci_epc_event_ops pci_epf_dma_test_event_ops = {
.core_init = pcie_dma_epf_core_init,
#if !defined(NV_PCIE_DMA_EPF_CORE_DEINIT_NOT_AVAILABLE)
#if defined(NV_PCI_EPC_EVENT_OPS_STRUCT_HAS_CORE_DEINIT) /* Nvidia Internal */
.core_deinit = pcie_dma_epf_core_deinit,
#endif
};