platform: tegra: rtcpu: Use conftest

Instead of relying on kernel version to determine if the 'remove'
callback for the 'bus_type' structure return an integer or void, add a
compile time test to the conftest.sh script to determine this at compile
time for the kernel being used. This is beneficial for working with 3rd
party Linux kernels that may have back-ported upstream changes into
their kernel and so the kernel version checks do not work.

Bug 4119327

Change-Id: I5457300619f5fb3b6afe61742bc6fce4cbefcd5d
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2985719
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
Jon Hunter
2023-09-26 10:58:40 +01:00
committed by mobile promotions
parent 634e0c9734
commit 02d724565b
3 changed files with 27 additions and 5 deletions

View File

@@ -1,6 +1,8 @@
// SPDX-License-Identifier: GPL-2.0
// Copyright (c) 2022-2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
#include <nvidia/conftest.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/of.h>
@@ -388,10 +390,10 @@ static int tegra_ivc_bus_probe(struct device *dev)
return ret;
}
#if (KERNEL_VERSION(5, 15, 0) <= LINUX_VERSION_CODE)
static void tegra_ivc_bus_remove(struct device *dev)
#else
#if defined(NV_BUS_TYPE_STRUCT_REMOVE_HAS_INT_RETURN_TYPE) /* Linux v5.15 */
static int tegra_ivc_bus_remove(struct device *dev)
#else
static void tegra_ivc_bus_remove(struct device *dev)
#endif
{
if (dev->type == &tegra_ivc_channel_type) {
@@ -408,7 +410,7 @@ static int tegra_ivc_bus_remove(struct device *dev)
}
#if (KERNEL_VERSION(5, 15, 0) > LINUX_VERSION_CODE)
#if defined(NV_BUS_TYPE_STRUCT_REMOVE_HAS_INT_RETURN_TYPE) /* Linux v5.15 */
return 0;
#endif
}