mirror of
git://nv-tegra.nvidia.com/linux-nv-oot.git
synced 2025-12-22 09:11:26 +03:00
nvidia-oot: vsc: fix compilation error with k6.5
fix compilation error while building vsc driver with k6.5 Bug 4221847 Bug 4311184 Change-Id: Ie015a25d8e6d50ecb2c908d9d505fa15d4daad1e Signed-off-by: Manish Bhardwaj <mbhardwaj@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2990176 Tested-by: Jonathan Hunter <jonathanh@nvidia.com> Reviewed-by: Jonathan Hunter <jonathanh@nvidia.com> Reviewed-by: Laxman Dewangan <ldewangan@nvidia.com>
This commit is contained in:
committed by
mobile promotions
parent
4b3511a749
commit
a0eaae1775
@@ -3,6 +3,8 @@
|
||||
* Copyright (c) 2022-2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
|
||||
*/
|
||||
|
||||
#include <nvidia/conftest.h>
|
||||
|
||||
#include <linux/version.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/moduleparam.h>
|
||||
@@ -131,7 +133,9 @@ int vblk_submit_ioctl_req(struct block_device *bdev,
|
||||
goto free_ioctl_req;
|
||||
}
|
||||
|
||||
#if defined(NV_REQUEST_STRUCT_HAS_COMPLETION_DATA_ARG) /* Removed in Linux v6.5 */
|
||||
rq->completion_data = (void *)ioctl_req;
|
||||
#endif
|
||||
|
||||
#if KERNEL_VERSION(5, 17, 0) <= LINUX_VERSION_CODE
|
||||
blk_execute_rq(rq, 0);
|
||||
|
||||
@@ -3,6 +3,8 @@
|
||||
* Copyright (c) 2022-2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
|
||||
*/
|
||||
|
||||
#include <nvidia/conftest.h>
|
||||
|
||||
#include <linux/version.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/moduleparam.h>
|
||||
@@ -643,7 +645,11 @@ static bool submit_bio_req(struct vblk_dev *vblkdev)
|
||||
} else {
|
||||
if (vblkdev->config.blk_config.req_ops_supported & VS_BLK_IOCTL_OP_F
|
||||
&& !vblk_prep_ioctl_req(vblkdev,
|
||||
#if defined(NV_REQUEST_STRUCT_HAS_COMPLETION_DATA_ARG) /* Removed in Linux v6.5 */
|
||||
(struct vblk_ioctl_req *)bio_req->completion_data,
|
||||
#else
|
||||
NULL,
|
||||
#endif
|
||||
vsc_req)) {
|
||||
vblkdev->inflight_ioctl_reqs++;
|
||||
} else if (!(vblkdev->config.blk_config.req_ops_supported & VS_BLK_IOCTL_OP_F)) {
|
||||
@@ -736,13 +742,23 @@ static blk_status_t vblk_request(struct blk_mq_hw_ctx *hctx,
|
||||
}
|
||||
|
||||
/* Open and release */
|
||||
#if defined(NV_BLOCK_DEVICE_OPERATIONS_OPEN_HAS_GENDISK_ARG) /* Linux v6.5 */
|
||||
static int vblk_open(struct gendisk *disk, fmode_t mode)
|
||||
{
|
||||
struct vblk_dev *vblkdev = disk->private_data;
|
||||
#else
|
||||
static int vblk_open(struct block_device *device, fmode_t mode)
|
||||
{
|
||||
struct vblk_dev *vblkdev = device->bd_disk->private_data;
|
||||
#endif
|
||||
|
||||
spin_lock(&vblkdev->lock);
|
||||
if (!vblkdev->users) {
|
||||
#if defined(NV_DISK_CHECK_MEDIA_CHANGE_PRESENT) /* Linux v6.5 */
|
||||
disk_check_media_change(disk);
|
||||
#else
|
||||
bdev_check_media_change(device);
|
||||
#endif
|
||||
}
|
||||
vblkdev->users++;
|
||||
|
||||
@@ -750,7 +766,11 @@ static int vblk_open(struct block_device *device, fmode_t mode)
|
||||
return 0;
|
||||
}
|
||||
|
||||
#if defined(NV_BLOCK_DEVICE_OPERATIONS_RELEASE_HAS_NO_MODE_ARG) /* Linux v6.5 */
|
||||
static void vblk_release(struct gendisk *disk)
|
||||
#else
|
||||
static void vblk_release(struct gendisk *disk, fmode_t mode)
|
||||
#endif
|
||||
{
|
||||
struct vblk_dev *vblkdev = disk->private_data;
|
||||
|
||||
@@ -777,7 +797,14 @@ static const struct block_device_operations vblk_ops = {
|
||||
.open = vblk_open,
|
||||
.release = vblk_release,
|
||||
.getgeo = vblk_getgeo,
|
||||
#if defined(NV_REQUEST_STRUCT_HAS_COMPLETION_DATA_ARG) /* Removed in Linux v6.5 */
|
||||
/*
|
||||
* FIXME: ioctl is not supported for Linux v6.5 where the
|
||||
* 'completion_data' member has been removed from the
|
||||
* 'request' structure.
|
||||
*/
|
||||
.ioctl = vblk_ioctl
|
||||
#endif
|
||||
};
|
||||
|
||||
static ssize_t
|
||||
|
||||
@@ -88,11 +88,14 @@ endef
|
||||
# provided by the module-specific Kbuild files.
|
||||
#
|
||||
|
||||
NV_CONFTEST_FUNCTION_COMPILE_TESTS += block_device_operations_open_has_gendisk_arg
|
||||
NV_CONFTEST_FUNCTION_COMPILE_TESTS += block_device_operations_release_has_no_mode_arg
|
||||
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
|
||||
NV_CONFTEST_FUNCTION_COMPILE_TESTS += disk_check_media_change
|
||||
NV_CONFTEST_FUNCTION_COMPILE_TESTS += drm_aperture_remove_framebuffers
|
||||
NV_CONFTEST_FUNCTION_COMPILE_TESTS += drm_driver_struct_has_irq_enabled_arg
|
||||
NV_CONFTEST_FUNCTION_COMPILE_TESTS += drm_fb_helper_alloc_info
|
||||
@@ -118,7 +121,7 @@ NV_CONFTEST_FUNCTION_COMPILE_TESTS += tegra_ivc_struct_has_iosys_map
|
||||
NV_CONFTEST_GENERIC_COMPILE_TESTS ?=
|
||||
NV_CONFTEST_MACRO_COMPILE_TESTS ?=
|
||||
NV_CONFTEST_SYMBOL_COMPILE_TESTS ?=
|
||||
NV_CONFTEST_TYPE_COMPILE_TESTS ?=
|
||||
NV_CONFTEST_TYPE_COMPILE_TESTS += request_struct_has_completion_data_arg
|
||||
|
||||
$(eval $(call NV_GENERATE_COMPILE_TEST_HEADER,functions,$(NV_CONFTEST_FUNCTION_COMPILE_TESTS)))
|
||||
$(eval $(call NV_GENERATE_COMPILE_TEST_HEADER,generic,$(NV_CONFTEST_GENERIC_COMPILE_TESTS)))
|
||||
|
||||
@@ -6329,6 +6329,48 @@ compile_test() {
|
||||
compile_check_conftest "$CODE" "NV_CRYPTO_PRESENT" "" "symbols"
|
||||
;;
|
||||
|
||||
block_device_operations_open_has_gendisk_arg)
|
||||
#
|
||||
# Determine if the 'open' function pointer from the
|
||||
# 'block_device_operations' structure has 'gendisk' type argument.
|
||||
#
|
||||
# In Linux v6.5, commit d32e2bf83791 ("block: pass a gendisk to ->open")
|
||||
# updated the arguments for the open function pointer.
|
||||
#
|
||||
CODE="
|
||||
#include <linux/blkdev.h>
|
||||
int conftest_block_device_operations_open_has_gendisk_arg(
|
||||
struct block_device_operations *ops,
|
||||
struct gendisk *disk,
|
||||
fmode_t mode) {
|
||||
return ops->open(disk, mode);
|
||||
}"
|
||||
|
||||
compile_check_conftest "$CODE" \
|
||||
"NV_BLOCK_DEVICE_OPERATIONS_OPEN_HAS_GENDISK_ARG" "" "types"
|
||||
;;
|
||||
|
||||
block_device_operations_release_has_no_mode_arg)
|
||||
#
|
||||
# Determine if the 'release' function pointer from the
|
||||
# 'block_device_operations' structure has an argument 'mode'.
|
||||
#
|
||||
# In Linux v6.5, commit ae220766d87c ("block: remove the unused mode
|
||||
# argument to ->release") updated the arguments for the 'release'
|
||||
# function pointer.
|
||||
#
|
||||
CODE="
|
||||
#include <linux/blkdev.h>
|
||||
void conftest_block_device_operations_release_has_no_mode_arg(
|
||||
struct block_device_operations *ops,
|
||||
struct gendisk *disk) {
|
||||
ops->release(disk);
|
||||
}"
|
||||
|
||||
compile_check_conftest "$CODE" \
|
||||
"NV_BLOCK_DEVICE_OPERATIONS_RELEASE_HAS_NO_MODE_ARG" "" "types"
|
||||
;;
|
||||
|
||||
bus_type_struct_remove_has_int_return_type)
|
||||
#
|
||||
# Determine if the 'remove' callback from the 'bus_type' structure
|
||||
@@ -6419,6 +6461,22 @@ compile_test() {
|
||||
compile_check_conftest "$CODE" "NV_DEVM_THERMAL_OF_ZONE_REGISTER_PRESENT" "" "functions"
|
||||
;;
|
||||
|
||||
disk_check_media_change)
|
||||
#
|
||||
# Determine if the function 'disk_check_media_change' is present.
|
||||
#
|
||||
# In Linux v6.5, commit 444aa2c58cb3 ("block: pass a gendisk on
|
||||
# bdev_check_media_change") renamed the function bdev_check_media_change()
|
||||
# to disk_check_media_change() and changed the parameters.
|
||||
CODE="
|
||||
#include <linux/blkdev.h>
|
||||
void conftest_disk_check_media_change(void) {
|
||||
disk_check_media_change();
|
||||
}"
|
||||
|
||||
compile_check_conftest "$CODE" "NV_DISK_CHECK_MEDIA_CHANGE_PRESENT" "" "functions"
|
||||
;;
|
||||
|
||||
drm_aperture_remove_framebuffers)
|
||||
#
|
||||
# Determine if the function 'drm_aperture_remove_framebuffers'
|
||||
@@ -6734,6 +6792,23 @@ compile_test() {
|
||||
compile_check_conftest "$CODE" "NV_REGISTER_SHRINKER_HAS_FMT_ARG" "" "types"
|
||||
;;
|
||||
|
||||
request_struct_has_completion_data_arg)
|
||||
#
|
||||
# Determine if the 'struct request' has the 'completion_data' member.
|
||||
#
|
||||
# In Linux v6.5, commit dc8cbb65dc17 ("block: remove dead struc
|
||||
# request->completion_data field") removes the 'completion_data' member
|
||||
# from the 'struct request'.
|
||||
#
|
||||
CODE="
|
||||
#include <linux/blk-mq.h>
|
||||
int conftest_request_struct_has_completion_data_arg(void) {
|
||||
return offsetof(struct request, completion_data);
|
||||
}"
|
||||
|
||||
compile_check_conftest "$CODE" "NV_REQUEST_STRUCT_HAS_COMPLETION_DATA_ARG" "" "types"
|
||||
;;
|
||||
|
||||
snd_soc_dai_link_struct_has_c2c_params_arg)
|
||||
#
|
||||
# Determine if 'struct snd_soc_dai_link' has the 'c2c_params' member.
|
||||
|
||||
Reference in New Issue
Block a user