From e2d19ad097705759f616989606ca97b8480aff8e Mon Sep 17 00:00:00 2001 From: Jon Hunter Date: Fri, 26 Jul 2024 16:41:52 +0100 Subject: [PATCH] gpu: nvgpu: 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 NVGPU driver as necessary to fix this. Bug 4749580 Signed-off-by: Jon Hunter Change-Id: I37f30bb7a23cc0ee413cf3db7a19816b51228818 Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/3183046 (cherry picked from commit 099cff3f1b21b9c51e88438dbca1bbda2668727c) Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/3185777 GVS: buildbot_gerritrpt Reviewed-by: Sagar Kamble --- drivers/gpu/nvgpu/os/linux/module.c | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/nvgpu/os/linux/module.c b/drivers/gpu/nvgpu/os/linux/module.c index 19584362e..7522c01e7 100644 --- a/drivers/gpu/nvgpu/os/linux/module.c +++ b/drivers/gpu/nvgpu/os/linux/module.c @@ -1,10 +1,14 @@ // SPDX-License-Identifier: GPL-2.0-only -// SPDX-FileCopyrightText: Copyright (c) 2011-2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +// SPDX-FileCopyrightText: Copyright (c) 2011-2024 NVIDIA CORPORATION & AFFILIATES. All rights reserved. /* * GK20A Graphics */ +#if defined(CONFIG_NVIDIA_CONFTEST) +#include +#endif + #include #include #include @@ -2073,9 +2077,21 @@ static int __exit gk20a_remove(struct platform_device *pdev) return err; } +#if defined(NV_PLATFORM_DRIVER_STRUCT_REMOVE_RETURNS_VOID) /* Linux v6.11 */ +static inline void __exit gk20a_remove_wrapper(struct platform_device *pdev) +{ + gk20a_remove(pdev); +} +#else +static inline int __exit gk20a_remove_wrapper(struct platform_device *pdev) +{ + return gk20a_remove(pdev); +} +#endif + static struct platform_driver gk20a_driver = { .probe = gk20a_probe, - .remove = __exit_p(gk20a_remove), + .remove = __exit_p(gk20a_remove_wrapper), .shutdown = gk20a_pm_shutdown, .driver = { .owner = THIS_MODULE,