pci: endpoint: Update drivers for Linux v6.11

For Linux v6.11, the 'pci_epc_event_ops' structure 'core_init' callback
was renamed to 'epc_init' and a new 'epc_deinit' callback was added.

Update the PCI endpoint drivers for Linux v6.11 by:

 1. Adding tests to conftest to detect the presence of 'epc_init' and
    'epc_deinit'.
 2. Update the drivers as necessary to use the appropriate callback
    depending upon what is present in the kernel.

Bug 4749580

Change-Id: Ife7e2d5d18332bf84f22142c9727dc1ece913c49
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3186686
(cherry picked from commit b0ff4f1358)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3219305
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
Reviewed-by: Brad Griffis <bgriffis@nvidia.com>
This commit is contained in:
Jon Hunter
2024-08-01 19:17:10 +01:00
committed by mobile promotions
parent 15ca4ff659
commit 93ba193a32
5 changed files with 85 additions and 7 deletions

View File

@@ -7554,6 +7554,39 @@ compile_test() {
compile_check_conftest "$CODE" "NV_PCI_EPC_EVENT_OPS_STRUCT_HAS_CORE_DEINIT" "" "types"
;;
pci_epc_event_ops_struct_has_epc_deinit)
#
# Determine if the pci_epc_event_ops struct has the epc_deinit function.
#
# Commit 473b2cf9c4d1 ("PCI: endpoint: Introduce 'epc_deinit' event and
# notify the EPF drivers) added 'epc_deinit' callback in Linux v6.11.
#
CODE="
#include <linux/pci-epf.h>
int conftest_pci_epc_event_ops_struct_has_epc_deinit(void) {
return offsetof(struct pci_epc_event_ops, epc_deinit);
}"
compile_check_conftest "$CODE" "NV_PCI_EPC_EVENT_OPS_STRUCT_HAS_EPC_DEINIT" "" "types"
;;
pci_epc_event_ops_struct_has_epc_init)
#
# Determine if the pci_epc_event_ops struct has the epc_init function.
#
# Commit 4edd7dc82bd6 ("PCI: endpoint: Rename core_init() callback in
# 'struct pci_epc_event_ops' to epc_init()") renamed core_init()
# in Linux v6.11.
#
CODE="
#include <linux/pci-epf.h>
int conftest_pci_epc_event_ops_struct_has_epc_init(void) {
return offsetof(struct pci_epc_event_ops, epc_init);
}"
compile_check_conftest "$CODE" "NV_PCI_EPC_EVENT_OPS_STRUCT_HAS_EPC_INIT" "" "types"
;;
platform_driver_struct_remove_returns_void)
#
# Determine if the 'platform_driver' structure 'remove' function