mirror of
git://nv-tegra.nvidia.com/linux-nv-oot.git
synced 2025-12-22 17:25:35 +03:00
virt: hvc_sysfs: Fix build for Linux v6.16
In Linux v6.16, the 'bin_attribute' argument to the 'read' and 'write' function pointers of the 'bin_attribute' structure was made const. Add a test to conftest to detect this and update the Tegra HVC SYSFS driver accordingly. JIRA LINQPJ14-60 Change-Id: I74b88bc0d1ed55eca1565386b38d16ff65626132 Signed-off-by: Jon Hunter <jonathanh@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3375213 (cherry picked from commit fef581cb0bac2d1468a710927771be9fa027f6e0) Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3461880 Reviewed-by: Brad Griffis <bgriffis@nvidia.com> Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com> GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com> Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
committed by
mobile promotions
parent
e48b52cbba
commit
da9c8f46c4
@@ -88,7 +88,12 @@ static int nvlog_buffer_mmap(struct file *fp, struct kobject *ko,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static ssize_t nvlog_region_size_read(struct file *fp, struct kobject *ko,
|
static ssize_t nvlog_region_size_read(struct file *fp, struct kobject *ko,
|
||||||
struct bin_attribute *attr, char *buf, loff_t pos, size_t size)
|
#if defined(NV_BIN_ATTRIBUTE_STRUCT_READWRITE_HAS_CONST_BIN_ATTRIBUTE_ARG)
|
||||||
|
const struct bin_attribute *attr,
|
||||||
|
#else
|
||||||
|
struct bin_attribute *attr,
|
||||||
|
#endif
|
||||||
|
char *buf, loff_t pos, size_t size)
|
||||||
{
|
{
|
||||||
struct nvlog_shmem_info *info = container_of(attr, struct nvlog_shmem_info, region_size_attr);
|
struct nvlog_shmem_info *info = container_of(attr, struct nvlog_shmem_info, region_size_attr);
|
||||||
|
|
||||||
@@ -97,7 +102,12 @@ static ssize_t nvlog_region_size_read(struct file *fp, struct kobject *ko,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static ssize_t nvlog_buffer_size_read(struct file *fp, struct kobject *ko,
|
static ssize_t nvlog_buffer_size_read(struct file *fp, struct kobject *ko,
|
||||||
struct bin_attribute *attr, char *buf, loff_t pos, size_t size)
|
#if defined(NV_BIN_ATTRIBUTE_STRUCT_READWRITE_HAS_CONST_BIN_ATTRIBUTE_ARG)
|
||||||
|
const struct bin_attribute *attr,
|
||||||
|
#else
|
||||||
|
struct bin_attribute *attr,
|
||||||
|
#endif
|
||||||
|
char *buf, loff_t pos, size_t size)
|
||||||
{
|
{
|
||||||
struct nvlog_shmem_info *info = container_of(attr, struct nvlog_shmem_info, buf_size_attr);
|
struct nvlog_shmem_info *info = container_of(attr, struct nvlog_shmem_info, buf_size_attr);
|
||||||
|
|
||||||
@@ -106,7 +116,12 @@ static ssize_t nvlog_buffer_size_read(struct file *fp, struct kobject *ko,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static ssize_t nvlog_buffer_count_read(struct file *fp, struct kobject *ko,
|
static ssize_t nvlog_buffer_count_read(struct file *fp, struct kobject *ko,
|
||||||
struct bin_attribute *attr, char *buf, loff_t pos, size_t size)
|
#if defined(NV_BIN_ATTRIBUTE_STRUCT_READWRITE_HAS_CONST_BIN_ATTRIBUTE_ARG)
|
||||||
|
const struct bin_attribute *attr,
|
||||||
|
#else
|
||||||
|
struct bin_attribute *attr,
|
||||||
|
#endif
|
||||||
|
char *buf, loff_t pos, size_t size)
|
||||||
{
|
{
|
||||||
struct nvlog_shmem_info *info = container_of(attr, struct nvlog_shmem_info, buf_count_attr);
|
struct nvlog_shmem_info *info = container_of(attr, struct nvlog_shmem_info, buf_count_attr);
|
||||||
|
|
||||||
@@ -296,7 +311,12 @@ static int hvc_create_sysfs(
|
|||||||
}
|
}
|
||||||
|
|
||||||
static ssize_t log_mask_read(struct file *fp, struct kobject *ko,
|
static ssize_t log_mask_read(struct file *fp, struct kobject *ko,
|
||||||
struct bin_attribute *attr, char *buf, loff_t pos, size_t size)
|
#if defined(NV_BIN_ATTRIBUTE_STRUCT_READWRITE_HAS_CONST_BIN_ATTRIBUTE_ARG)
|
||||||
|
const struct bin_attribute *attr,
|
||||||
|
#else
|
||||||
|
struct bin_attribute *attr,
|
||||||
|
#endif
|
||||||
|
char *buf, loff_t pos, size_t size)
|
||||||
{
|
{
|
||||||
uint64_t value = 0;
|
uint64_t value = 0;
|
||||||
|
|
||||||
@@ -312,7 +332,12 @@ static ssize_t log_mask_read(struct file *fp, struct kobject *ko,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static ssize_t log_mask_write(struct file *fp, struct kobject *ko,
|
static ssize_t log_mask_write(struct file *fp, struct kobject *ko,
|
||||||
struct bin_attribute *attr, char *buf, loff_t pos, size_t size)
|
#if defined(NV_BIN_ATTRIBUTE_STRUCT_READWRITE_HAS_CONST_BIN_ATTRIBUTE_ARG)
|
||||||
|
const struct bin_attribute *attr,
|
||||||
|
#else
|
||||||
|
struct bin_attribute *attr,
|
||||||
|
#endif
|
||||||
|
char *buf, loff_t pos, size_t size)
|
||||||
{
|
{
|
||||||
uint64_t type, value;
|
uint64_t type, value;
|
||||||
|
|
||||||
|
|||||||
@@ -93,6 +93,7 @@ NV_CONFTEST_FUNCTION_COMPILE_TESTS += __alloc_pages_bulk_has_no_page_list_arg
|
|||||||
NV_CONFTEST_FUNCTION_COMPILE_TESTS += __assign_str_has_no_src_arg
|
NV_CONFTEST_FUNCTION_COMPILE_TESTS += __assign_str_has_no_src_arg
|
||||||
NV_CONFTEST_FUNCTION_COMPILE_TESTS += aperture_remove_all_conflicting_devices
|
NV_CONFTEST_FUNCTION_COMPILE_TESTS += aperture_remove_all_conflicting_devices
|
||||||
NV_CONFTEST_FUNCTION_COMPILE_TESTS += bin_attribute_struct_mmap_has_const_bin_attribute_arg
|
NV_CONFTEST_FUNCTION_COMPILE_TESTS += bin_attribute_struct_mmap_has_const_bin_attribute_arg
|
||||||
|
NV_CONFTEST_FUNCTION_COMPILE_TESTS += bin_attribute_struct_readwrite_has_const_bin_attribute_arg
|
||||||
NV_CONFTEST_FUNCTION_COMPILE_TESTS += blk_execute_rq_has_no_gendisk_arg
|
NV_CONFTEST_FUNCTION_COMPILE_TESTS += blk_execute_rq_has_no_gendisk_arg
|
||||||
NV_CONFTEST_FUNCTION_COMPILE_TESTS += blk_mq_alloc_disk_for_queue
|
NV_CONFTEST_FUNCTION_COMPILE_TESTS += blk_mq_alloc_disk_for_queue
|
||||||
NV_CONFTEST_FUNCTION_COMPILE_TESTS += blk_mq_alloc_queue
|
NV_CONFTEST_FUNCTION_COMPILE_TESTS += blk_mq_alloc_queue
|
||||||
|
|||||||
@@ -6588,6 +6588,26 @@ compile_test() {
|
|||||||
"NV_BIN_ATTRIBUTE_STRUCT_MMAP_HAS_CONST_BIN_ATTRIBUTE_ARG" "" "types"
|
"NV_BIN_ATTRIBUTE_STRUCT_MMAP_HAS_CONST_BIN_ATTRIBUTE_ARG" "" "types"
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
bin_attribute_struct_readwrite_has_const_bin_attribute_arg)
|
||||||
|
#
|
||||||
|
# Determine if the 'bin_attribute' structure 'read' and 'write'
|
||||||
|
# function pointers have a const 'struct bin_attribute' argument.
|
||||||
|
#
|
||||||
|
# This change was made in Linux v6.16 by commit 97d06802d10a
|
||||||
|
# ("sysfs: constify bin_attribute argument of bin_attribute::read/write()").
|
||||||
|
#
|
||||||
|
CODE="
|
||||||
|
#include <linux/sysfs.h>
|
||||||
|
void conftest(struct bin_attribute *attr) {
|
||||||
|
ssize_t (*fn)(struct file *, struct kobject *,
|
||||||
|
const struct bin_attribute *,
|
||||||
|
char *, loff_t, size_t) = attr->read;
|
||||||
|
}"
|
||||||
|
|
||||||
|
compile_check_conftest "$CODE" \
|
||||||
|
"NV_BIN_ATTRIBUTE_STRUCT_READWRITE_HAS_CONST_BIN_ATTRIBUTE_ARG" "" "types"
|
||||||
|
;;
|
||||||
|
|
||||||
blk_execute_rq_has_no_gendisk_arg)
|
blk_execute_rq_has_no_gendisk_arg)
|
||||||
#
|
#
|
||||||
# Determine if the function blk_execute_rq() has an argument of
|
# Determine if the function blk_execute_rq() has an argument of
|
||||||
|
|||||||
Reference in New Issue
Block a user