gpu: nvgpu: Use conftest test for class_create

A test has already been added to the conftest script for checking if the
class_create() function has a module pointer argument or not. So use
the definition generated by conftest to select which version of the
function to use.

Bug 4221847
Bug 4276500

Change-Id: If4b4445b2dfb2ec6556ca8c4ef9931e6b8833357
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/3015846
(cherry picked from commit cf745fa6d89a277dc8fb72454b9a7d26454e8b8d)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/3017318
(cherry picked from commit 41e6fae71e)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/3017439
Reviewed-by: Amulya Yarlagadda <ayarlagadda@nvidia.com>
This commit is contained in:
Jon Hunter
2023-11-14 13:37:53 +00:00
committed by Amulya Yarlagadda
parent ff43f7414f
commit 324152c5e9

View File

@@ -438,10 +438,10 @@ static struct nvgpu_class *nvgpu_create_class(struct gk20a *g, const char *class
return NULL; return NULL;
} }
#if (LINUX_VERSION_CODE < KERNEL_VERSION(6, 4, 0)) #if defined(NV_CLASS_CREATE_HAS_NO_OWNER_ARG) /* Linux v6.4 */
class->class = class_create(THIS_MODULE, class_name);
#else
class->class = class_create(class_name); class->class = class_create(class_name);
#else
class->class = class_create(THIS_MODULE, class_name);
#endif #endif
if (IS_ERR(class->class)) { if (IS_ERR(class->class)) {
nvgpu_err(g, "failed to create class"); nvgpu_err(g, "failed to create class");