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:
Jon Hunter
2023-10-02 10:56:59 +01:00
committed by mobile promotions
parent 86dafc35bb
commit ce678a37b1
21 changed files with 100 additions and 33 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/bitmap.h>
#include <linux/cdev.h>
#include <linux/dcache.h>
@@ -239,7 +241,7 @@ static int __init tegra_camchar_init(struct tegra_ivc_driver *drv)
}
tegra_camchar_major_number = MAJOR(start);
#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 4, 0)
#if defined(NV_CLASS_CREATE_HAS_NO_OWNER_ARG) /* Linux v6.4 */
tegra_camchar_class = class_create("camchar_class");
#else
tegra_camchar_class = class_create(THIS_MODULE, "camchar_class");

View File

@@ -1,6 +1,8 @@
// SPDX-License-Identifier: GPL-2.0
// Copyright (c) 2021-2023, NVIDIA CORPORATION. All rights reserved.
#include <nvidia/conftest.h>
#include <linux/module.h>
#include <linux/fs.h>
#include <linux/types.h>
@@ -11,7 +13,6 @@
#include <linux/kdev_t.h>
#include <linux/mailbox_client.h>
#include <linux/sched/signal.h>
#include <linux/version.h>
#include <uapi/linux/tegra-fsicom.h>
#include <linux/pm.h>
@@ -298,7 +299,7 @@ static int fsicom_register_device(void)
return result;
}
device_file_major_number = result;
#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 4, 0)
#if defined(NV_CLASS_CREATE_HAS_NO_OWNER_ARG) /* Linux v6.4 */
dev_class = class_create("fsicom_client");
#else
dev_class = class_create(THIS_MODULE, "fsicom_client");