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

@@ -89,6 +89,7 @@ endef
#
NV_CONFTEST_FUNCTION_COMPILE_TESTS += bus_type_struct_remove_has_int_return_type
NV_CONFTEST_FUNCTION_COMPILE_TESTS += class_create_has_no_owner_arg
NV_CONFTEST_FUNCTION_COMPILE_TESTS += class_struct_devnode_has_const_dev_arg
NV_CONFTEST_FUNCTION_COMPILE_TESTS += define_semaphore_has_number_arg
NV_CONFTEST_FUNCTION_COMPILE_TESTS += devm_thermal_of_zone_register

View File

@@ -6312,6 +6312,24 @@ compile_test() {
compile_check_conftest "$CODE" "NV_BUS_TYPE_STRUCT_REMOVE_HAS_INT_RETURN_TYPE" "" "types"
;;
class_create_has_no_owner_arg)
#
# Determine if the class_create() function has the 'owner' argument.
#
# Commit 1aaba11da9aa ("driver core: class: remove module * from
# class_create()") removed the owner argument for the class_create
# function in Linux v6.4.
#
CODE="
#include <linux/device.h>
#include <linux/device/class.h>
struct class *conftest_class_create_has_no_owner_arg(const char *name) {
return class_create(name);
}"
compile_check_conftest "$CODE" "NV_CLASS_CREATE_HAS_NO_OWNER_ARG" "" "types"
;;
class_struct_devnode_has_const_dev_arg)
#
# Determine if the 'class' structure devnode function pointer