From f9f8b37e745a5305ab81a6861454a77170b981a5 Mon Sep 17 00:00:00 2001 From: Laxman Dewangan Date: Tue, 5 Dec 2023 17:51:12 +0000 Subject: [PATCH] pci: Use conftest to find if pci_disable_pcie_error_reporting() present Use conftest to find if API pci_disable_pcie_error_reporting() is present. This API is dropped from Linux 6.5 with change commit 69b264df8a41282 ("PCI/AER: Drop unused pci_disable_pcie_error_reporting()") Bug 4346767 Change-Id: Idcaf36e4215a874c70f7457a46fd875f1349b121 Signed-off-by: Laxman Dewangan Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3028741 Reviewed-by: Shardar Mohammed GVS: Gerrit_Virtual_Submit --- Makefile | 3 --- drivers/misc/nvscic2c-pcie/epc/module.c | 4 +++- scripts/conftest/Makefile | 1 + scripts/conftest/conftest.sh | 17 +++++++++++++++++ 4 files changed, 21 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index 84c4463a..8c7e05b1 100644 --- a/Makefile +++ b/Makefile @@ -52,9 +52,6 @@ subdir-ccflags-y += -DNV_V4L2_ASYNC_NF_SUBDEVICE_INIT_RENAME # Deprecate PCIED Error reporting pci_enable_pcie_error_reporting subdir-ccflags-y += -DNV_DROP_PCIE_ERROR_REPORTING -# Drop the API for pcie_disable_pcie_error_reporting -subdir-ccflags-y += -DNV_PCIE_DIABLE_PCIE_ERROR_REPORTING_DROP - # PCIE EPF driver probe has additional argument as ID subdir-ccflags-y += -DNV_PCIE_EFP_DRIVER_PROBE_HAS_ID_ARG diff --git a/drivers/misc/nvscic2c-pcie/epc/module.c b/drivers/misc/nvscic2c-pcie/epc/module.c index bd273f25..cd6ffb64 100644 --- a/drivers/misc/nvscic2c-pcie/epc/module.c +++ b/drivers/misc/nvscic2c-pcie/epc/module.c @@ -1,6 +1,8 @@ // SPDX-License-Identifier: GPL-2.0-only // Copyright (c) 2022-2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved. +#include + #define pr_fmt(fmt) "nvscic2c-pcie: epc: " fmt #include @@ -290,7 +292,7 @@ deinit: pci_release_region(pdev, 0); pci_clear_master(pdev); -#if !defined(NV_PCIE_DIABLE_PCIE_ERROR_REPORTING_DROP) +#if defined(NV_PCI_DISABLE_PCIE_ERROR_REPORTING_PRESENT) /* Linux 6.5 */ pci_disable_pcie_error_reporting(pdev); #endif pci_disable_device(pdev); diff --git a/scripts/conftest/Makefile b/scripts/conftest/Makefile index 8d785358..7cf1c43d 100644 --- a/scripts/conftest/Makefile +++ b/scripts/conftest/Makefile @@ -127,6 +127,7 @@ NV_CONFTEST_FUNCTION_COMPILE_TESTS += netif_napi_add_weight NV_CONFTEST_FUNCTION_COMPILE_TESTS += pde_data NV_CONFTEST_FUNCTION_COMPILE_TESTS += pwm_ops_struct_has_owner NV_CONFTEST_FUNCTION_COMPILE_TESTS += pci_epc_event_ops_struct_has_core_deinit +NV_CONFTEST_FUNCTION_COMPILE_TESTS += pci_disable_pcie_error_reporting NV_CONFTEST_FUNCTION_COMPILE_TESTS += register_shrinker_has_fmt_arg NV_CONFTEST_FUNCTION_COMPILE_TESTS += shrinker_alloc NV_CONFTEST_FUNCTION_COMPILE_TESTS += snd_soc_card_jack_new_has_no_snd_soc_jack_pins diff --git a/scripts/conftest/conftest.sh b/scripts/conftest/conftest.sh index 76b91358..c22cb6f4 100755 --- a/scripts/conftest/conftest.sh +++ b/scripts/conftest/conftest.sh @@ -7033,6 +7033,23 @@ compile_test() { compile_check_conftest "$CODE" "NV_PCI_EPC_EVENT_OPS_STRUCT_HAS_CORE_DEINIT" "" "types" ;; + pci_disable_pcie_error_reporting) + # + # Determine if the pci_disable_pcie_error_reporting() API available or not. + # + # API pci_disable_pcie_error_reporting() is dropped from Linux 6.5 + # with commit 69b264df8a4128 ("PCI/AER: Drop unused + # pci_disable_pcie_error_reporting()") + # + CODE=" + #include + void conftest_pci_disable_pcie_error_reporting(void) { + pci_disable_pcie_error_reporting(); + }" + + compile_check_conftest "$CODE" "NV_PCI_DISABLE_PCIE_ERROR_REPORTING_PRESENT" "" "functions" + ;; + register_shrinker_has_fmt_arg) # # Determine if the 'register_shrinker' function