From 66afcf9c4015a57294b4b740cc9a5abebcc235e8 Mon Sep 17 00:00:00 2001 From: Jon Hunter Date: Fri, 3 Jan 2025 12:47:10 +0000 Subject: [PATCH] misc: tegra-cec: 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 Tegra CEC driver as necessary to fix this. Bug 4749580 Change-Id: I3cd34f41e519240ff48378e79bb654cf78767085 Signed-off-by: Jon Hunter Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3276923 Reviewed-by: Prafull Suryawanshi GVS: buildbot_gerritrpt --- drivers/misc/tegra-cec/tegra_cec.c | 24 +++++++++++++++++++----- drivers/misc/tegra-cec/tegra_cec.h | 1 - 2 files changed, 19 insertions(+), 6 deletions(-) diff --git a/drivers/misc/tegra-cec/tegra_cec.c b/drivers/misc/tegra-cec/tegra_cec.c index e903b54d..bcb361b0 100644 --- a/drivers/misc/tegra-cec/tegra_cec.c +++ b/drivers/misc/tegra-cec/tegra_cec.c @@ -1,5 +1,7 @@ // SPDX-License-Identifier: GPL-2.0-only -// SPDX-FileCopyrightText: Copyright (c) 2019-2024 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +// SPDX-FileCopyrightText: Copyright (c) 2019-2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. + +#include #include #include @@ -749,14 +751,12 @@ cec_error: return ret; } -static int tegra_cec_remove(struct platform_device *pdev) +static void tegra_cec_remove(struct platform_device *pdev) { struct tegra_cec *cec = platform_get_drvdata(pdev); misc_deregister(&cec->misc_dev); cancel_work_sync(&cec->work); - - return 0; } #ifdef CONFIG_PM @@ -803,6 +803,20 @@ static struct of_device_id tegra_cec_of_match[] = { {}, }; +#if defined(NV_PLATFORM_DRIVER_STRUCT_REMOVE_RETURNS_VOID) /* Linux v6.11 */ +static void tegra_cec_remove_wrapper(struct platform_device *pdev) +{ + tegra_cec_remove(pdev); +} +#else +static int tegra_cec_remove_wrapper(struct platform_device *pdev) +{ + tegra_cec_remove(pdev); + + return 0; +} +#endif + static struct platform_driver tegra_cec_driver = { .driver = { .name = TEGRA_CEC_NAME, @@ -811,7 +825,7 @@ static struct platform_driver tegra_cec_driver = { .of_match_table = of_match_ptr(tegra_cec_of_match), }, .probe = tegra_cec_probe, - .remove = tegra_cec_remove, + .remove = tegra_cec_remove_wrapper, #ifdef CONFIG_PM .suspend = tegra_cec_suspend, diff --git a/drivers/misc/tegra-cec/tegra_cec.h b/drivers/misc/tegra-cec/tegra_cec.h index dcb70fbc..1cc1aeb0 100644 --- a/drivers/misc/tegra-cec/tegra_cec.h +++ b/drivers/misc/tegra-cec/tegra_cec.h @@ -37,7 +37,6 @@ struct tegra_cec { u8 tx_buf_cnt; struct reset_control *reset; }; -static int tegra_cec_remove(struct platform_device *pdev); #define TEGRA_CEC_LADDR_BROADCAST 0xF #define TEGRA_CEC_LADDR_MASK 0xF