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

@@ -1,6 +1,8 @@
// SPDX-License-Identifier: GPL-2.0-only
// Copyright (c) 2022-2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
#include <nvidia/conftest.h>
#define pr_fmt(fmt) "nvscic2c-pcie: epf: " fmt
#include <linux/init.h>
@@ -169,7 +171,7 @@ allocate_outbound_area(struct pci_epf *epf, size_t win_size,
return ret;
}
#if !defined(NV_PCIE_DMA_EPF_CORE_DEINIT_NOT_AVAILABLE)
#if defined(NV_PCI_EPC_EVENT_OPS_STRUCT_HAS_CORE_DEINIT) /* Nvidia Internal */
static void
clear_inbound_translation(struct pci_epf *epf)
{
@@ -492,7 +494,7 @@ deinit_work(struct work_struct *work)
* @DRV_MODE_EPC would have already gone then by the time
* struct pci_epc_event_ops.core_deinit is called.
*/
#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
nvscic2c_pcie_epf_core_deinit(struct pci_epf *epf)
{
@@ -733,7 +735,7 @@ get_driverdata(const struct pci_epf_device_id *id,
static const struct pci_epc_event_ops nvscic2c_event_ops = {
.core_init = nvscic2c_pcie_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 = nvscic2c_pcie_epf_core_deinit,
#endif
};