diff --git a/drivers/gpu/host1x-fence/dev.c b/drivers/gpu/host1x-fence/dev.c index c9c2655d..ddbc7713 100644 --- a/drivers/gpu/host1x-fence/dev.c +++ b/drivers/gpu/host1x-fence/dev.c @@ -5,6 +5,8 @@ * Copyright (c) 2022-2023, NVIDIA CORPORATION. All rights reserved. */ +#include + #include #include #include @@ -415,10 +417,10 @@ static const struct file_operations dev_file_fops = { .compat_ioctl = dev_file_ioctl, }; -#if (LINUX_VERSION_CODE < KERNEL_VERSION(6, 2, 0)) -static char *host1x_fence_devnode(struct device *dev, umode_t *mode) -#else +#if defined(NV_CLASS_STRUCT_DEVNODE_HAS_CONST_DEV_ARG) /* Linux v6.2 */ static char *host1x_fence_devnode(const struct device *dev, umode_t *mode) +#else +static char *host1x_fence_devnode(struct device *dev, umode_t *mode) #endif { *mode = 0666; diff --git a/drivers/gpu/host1x/cdma.c b/drivers/gpu/host1x/cdma.c index 256fc395..59a1e18b 100644 --- a/drivers/gpu/host1x/cdma.c +++ b/drivers/gpu/host1x/cdma.c @@ -5,6 +5,7 @@ * Copyright (c) 2010-2013, NVIDIA Corporation. */ +#include #include #include @@ -106,7 +107,7 @@ static int host1x_pushbuffer_init(struct push_buffer *pb) pb->dma = iova_dma_addr(&host1x->iova, alloc); err = iommu_map(host1x->domain, pb->dma, pb->phys, size, -#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 3, 0) +#if defined(NV_IOMMU_MAP_HAS_GFP_ARG) /* Linux v6.3 */ IOMMU_READ, GFP_KERNEL); #else IOMMU_READ); diff --git a/scripts/conftest/Makefile b/scripts/conftest/Makefile index e77a07ae..28b83344 100644 --- a/scripts/conftest/Makefile +++ b/scripts/conftest/Makefile @@ -88,6 +88,7 @@ endef # provided by the module-specific Kbuild files. # +NV_CONFTEST_FUNCTION_COMPILE_TESTS += class_struct_devnode_has_const_dev_arg NV_CONFTEST_FUNCTION_COMPILE_TESTS += devm_thermal_of_zone_register NV_CONFTEST_FUNCTION_COMPILE_TESTS += drm_aperture_remove_framebuffers_has_drm_driver_arg NV_CONFTEST_FUNCTION_COMPILE_TESTS += drm_driver_struct_has_irq_enabled_arg diff --git a/scripts/conftest/conftest.sh b/scripts/conftest/conftest.sh index 74afb507..a61fea28 100755 --- a/scripts/conftest/conftest.sh +++ b/scripts/conftest/conftest.sh @@ -6293,6 +6293,26 @@ compile_test() { compile_check_conftest "$CODE" "NV_CRYPTO_PRESENT" "" "symbols" ;; + class_struct_devnode_has_const_dev_arg) + # + # Determine if the 'class' structure devnode function pointer + # has const 'struct dev' argument. + # + # Commit 43a7206b0963 ("driver core: class: make class_register() + # take a const *") updated the class_register function to take a + # const class structure in Linux v6.2. + # + CODE=" + #include + #include + #include + void conftest_class_struct_devnode_has_const_dev_arg(struct class *c) { + char *(*fn)(const struct device *dev, umode_t *mode) = c->devnode; + }" + + compile_check_conftest "$CODE" "NV_CLASS_STRUCT_DEVNODE_HAS_CONST_DEV_ARG" "" "types" + ;; + devm_thermal_of_zone_register) # # Determine whether devm_thermal_of_zone_register is present.