mirror of
git://nv-tegra.nvidia.com/linux-nv-oot.git
synced 2025-12-22 09:11:26 +03:00
drivers: Add conftest test for class_create
In Linux v6.4, the module pointer argument is removed from the class_create() function. Add a test to the conftest script that checks if this argument for the class_create() function has been removed and use the definition created by conftest to select which version of the function is used. Bug 4183168 Bug 4221847 Change-Id: I440e4b318001886cd0319bb3499ba33178475e8c Signed-off-by: Jon Hunter <jonathanh@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2989020 Tested-by: mobile promotions <svcmobile_promotions@nvidia.com> Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
committed by
mobile promotions
parent
86dafc35bb
commit
ce678a37b1
@@ -1,8 +1,10 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0-only */
|
||||
/*
|
||||
* Copyright (c) 2022, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
|
||||
* Copyright (c) 2022-2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
|
||||
*/
|
||||
|
||||
#include <nvidia/conftest.h>
|
||||
|
||||
#include <soc/tegra/virt/hv-ivc.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/init.h>
|
||||
@@ -489,7 +491,7 @@ static int __init setup_ivc(void)
|
||||
return result;
|
||||
}
|
||||
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 4, 0)
|
||||
#if defined(NV_CLASS_CREATE_HAS_NO_OWNER_ARG) /* Linux v6.4 */
|
||||
ivc_class = class_create("ivc");
|
||||
#else
|
||||
ivc_class = class_create(THIS_MODULE, "ivc");
|
||||
|
||||
@@ -3,6 +3,8 @@
|
||||
* Copyright (c) 2022-2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
|
||||
*/
|
||||
|
||||
#include <nvidia/conftest.h>
|
||||
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/init.h>
|
||||
#include <linux/types.h>
|
||||
@@ -421,7 +423,11 @@ static int tegra_hv_setup(struct tegra_hv_data *hvd)
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
#if defined(NV_CLASS_CREATE_HAS_NO_OWNER_ARG) /* Linux v6.4 */
|
||||
hvd->hv_class = class_create("tegra_hv");
|
||||
#else
|
||||
hvd->hv_class = class_create(THIS_MODULE, "tegra_hv");
|
||||
#endif
|
||||
if (IS_ERR(hvd->hv_class)) {
|
||||
ERR("class_create() failed\n");
|
||||
return PTR_ERR(hvd->hv_class);
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0-only */
|
||||
/*
|
||||
* Copyright (c) 2022, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
|
||||
* Copyright (c) 2022-2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
|
||||
*/
|
||||
|
||||
#include <nvidia/conftest.h>
|
||||
|
||||
#include <linux/module.h>
|
||||
#include <linux/errno.h>
|
||||
#include <linux/of.h>
|
||||
@@ -1065,7 +1068,7 @@ static int tegra_hv_pm_ctl_probe(struct platform_device *pdev)
|
||||
return ret;
|
||||
}
|
||||
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 4, 0)
|
||||
#if defined(NV_CLASS_CREATE_HAS_NO_OWNER_ARG) /* Linux v6.4 */
|
||||
data->class = class_create(DRV_NAME);
|
||||
#else
|
||||
data->class = class_create(THIS_MODULE, DRV_NAME);
|
||||
|
||||
@@ -3,6 +3,8 @@
|
||||
|
||||
#define pr_fmt(fmt) "%s:%s(): " fmt, KBUILD_MODNAME, __func__
|
||||
|
||||
#include <nvidia/conftest.h>
|
||||
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/kdev_t.h>
|
||||
@@ -368,7 +370,7 @@ static int tegra_hv_vcpu_yield_probe(struct platform_device *pdev)
|
||||
}
|
||||
|
||||
major = MAJOR(vcpu_yield_pdev->vcpu_yield_dev);
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 4, 0)
|
||||
#if defined(NV_CLASS_CREATE_HAS_NO_OWNER_ARG) /* Linux v6.4 */
|
||||
vcpu_yield_class =
|
||||
class_create("tegra_hv_vcpu_yield");
|
||||
#else
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0-only */
|
||||
/*
|
||||
* Copyright (c) 2022, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
|
||||
* Copyright (c) 2022-2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
|
||||
*/
|
||||
|
||||
#include <nvidia/conftest.h>
|
||||
|
||||
#include <linux/compiler.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/init.h>
|
||||
@@ -15,7 +17,6 @@
|
||||
#include <soc/tegra/fuse.h>
|
||||
#include <soc/tegra/virt/hv-ivc.h>
|
||||
#include <uapi/linux/nvhvivc_mempool_ioctl.h>
|
||||
#include <linux/version.h>
|
||||
|
||||
#include <linux/uaccess.h>
|
||||
|
||||
@@ -305,7 +306,7 @@ static int __init setup_ivc_mempool(void)
|
||||
}
|
||||
|
||||
/* register ivc_user class with sysfs */
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 4, 0)
|
||||
#if defined(NV_CLASS_CREATE_HAS_NO_OWNER_ARG) /* Linux v6.4 */
|
||||
ivc_mempool_class = class_create("tegra_uivc_mpool");
|
||||
#else
|
||||
ivc_mempool_class = class_create(THIS_MODULE, "tegra_uivc_mpool");
|
||||
|
||||
Reference in New Issue
Block a user