From a2602b88b8a3ce2ecaf154090c4a7082a717a766 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 GVS: buildbot_gerritrpt (cherry picked from commit 66afcf9c4015a57294b4b740cc9a5abebcc235e8) Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3282569 Reviewed-by: svcacv Tested-by: Prafull Suryawanshi Reviewed-by: Prafull Suryawanshi --- 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 685b3407..588f9d66 100644 --- a/drivers/misc/tegra-cec/tegra_cec.c +++ b/drivers/misc/tegra-cec/tegra_cec.c @@ -1,6 +1,8 @@ // SPDX-License-Identifier: GPL-2.0-only // SPDX-FileCopyrightText: Copyright (c) 2012-2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +#include + #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, @@ -823,4 +837,4 @@ module_platform_driver(tegra_cec_driver); MODULE_DESCRIPTION("Tegra CEC Driver"); MODULE_LICENSE("GPL v2"); -MODULE_AUTHOR("Prafull Suryawanshi "); \ No newline at end of file +MODULE_AUTHOR("Prafull Suryawanshi "); diff --git a/drivers/misc/tegra-cec/tegra_cec.h b/drivers/misc/tegra-cec/tegra_cec.h index 9a6ad409..c46708c8 100644 --- a/drivers/misc/tegra-cec/tegra_cec.h +++ b/drivers/misc/tegra-cec/tegra_cec.h @@ -39,7 +39,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