From 87799bf0466ad50e2a88c0eee5946bcde97e9b1b Mon Sep 17 00:00:00 2001 From: Jon Hunter Date: Mon, 21 Oct 2024 13:13:16 +0100 Subject: [PATCH] PCI: tegra264: Fix build for Linux v6.11 In Linux v6.11, the 'platform_driver' structure 'remove' callback was updated to return void instead of 'int'. Update the Tegra264 PCI drivers as necessary to ensure that they can be built for Linux v6.11+ kernels. Bug 4749580 Bug 4911768 Change-Id: I9081f7cb61e9020ec8c1462a3c1b21118d7025bc Signed-off-by: Jon Hunter Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3233981 Reviewed-by: Brad Griffis Reviewed-by: Laxman Dewangan GVS: buildbot_gerritrpt --- .../controller/private-soc/pcie-tegra264-ep.c | 19 +++++++++++++---- .../controller/private-soc/pcie-tegra264.c | 21 +++++++++++++++---- 2 files changed, 32 insertions(+), 8 deletions(-) diff --git a/drivers/pci/controller/private-soc/pcie-tegra264-ep.c b/drivers/pci/controller/private-soc/pcie-tegra264-ep.c index 739e38dc..2c51fcae 100644 --- a/drivers/pci/controller/private-soc/pcie-tegra264-ep.c +++ b/drivers/pci/controller/private-soc/pcie-tegra264-ep.c @@ -1,9 +1,8 @@ -// SPDX-License-Identifier: GPL-2.0+ +// SPDX-License-Identifier: GPL-2.0-only +// SPDX-FileCopyrightText: Copyright (c) 2024, NVIDIA CORPORATION. All rights reserved. /* * PCIe EP controller driver for Tegra264 SoC * - * Copyright (c) 2024, NVIDIA CORPORATION. All rights reserved. - * * Author: Manikanta Maddireddy */ @@ -802,9 +801,21 @@ static const struct dev_pm_ops tegra264_pcie_ep_dev_pm_ops = { }; #endif +#if defined(NV_PLATFORM_DRIVER_STRUCT_REMOVE_RETURNS_VOID) /* Linux v6.11 */ +static void tegra264_pcie_ep_remove_wrapper(struct platform_device *pdev) +{ + tegra264_pcie_ep_remove(pdev); +} +#else +static int tegra264_pcie_ep_remove_wrapper(struct platform_device *pdev) +{ + return tegra264_pcie_ep_remove(pdev); +} +#endif + static struct platform_driver tegra264_pcie_ep_driver = { .probe = tegra264_pcie_ep_probe, - .remove = tegra264_pcie_ep_remove, + .remove = tegra264_pcie_ep_remove_wrapper, .driver = { .name = "tegra264-pcie-ep", .of_match_table = tegra264_pcie_ep_of_match, diff --git a/drivers/pci/controller/private-soc/pcie-tegra264.c b/drivers/pci/controller/private-soc/pcie-tegra264.c index db72ed5e..a2d04e97 100644 --- a/drivers/pci/controller/private-soc/pcie-tegra264.c +++ b/drivers/pci/controller/private-soc/pcie-tegra264.c @@ -1,12 +1,13 @@ -// SPDX-License-Identifier: GPL-2.0+ +// SPDX-License-Identifier: GPL-2.0-only +// SPDX-FileCopyrightText: Copyright (c) 2022-2024, NVIDIA CORPORATION. All rights reserved. /* * PCIe host controller driver for Tegra264 SoC * - * Copyright (c) 2022-2024, NVIDIA CORPORATION. All rights reserved. - * * Author: Manikanta Maddireddy */ +#include + #include #include #include @@ -324,9 +325,21 @@ static const struct of_device_id tegra264_pcie_of_match[] = { {}, }; +#if defined(NV_PLATFORM_DRIVER_STRUCT_REMOVE_RETURNS_VOID) /* Linux v6.11 */ +static void tegra264_pcie_remove_wrapper(struct platform_device *pdev) +{ + tegra264_pcie_remove(pdev); +} +#else +static int tegra264_pcie_remove_wrapper(struct platform_device *pdev) +{ + return tegra264_pcie_remove(pdev); +} +#endif + static struct platform_driver tegra264_pcie_driver = { .probe = tegra264_pcie_probe, - .remove = tegra264_pcie_remove, + .remove = tegra264_pcie_remove_wrapper, .driver = { .name = "tegra264-pcie", .pm = &tegra264_pcie_pm_ops,