mirror of
git://nv-tegra.nvidia.com/linux-nv-oot.git
synced 2025-12-22 17:25:35 +03:00
drivers: Fix bus->match for Linux v6.11
In Linux v6.11, the 'bus_type' structure match() callback was updated to
make its 'drv' argument constant. Add a conftest test to detect this and
update the relevant drivers according to fix building them for Linux
v6.11.
Bug 4749580
Change-Id: I895d97241a7357074bb34b8e7a5bdfa2e31d5ca5
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3183068
(cherry picked from commit fc171fe539)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3185781
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
committed by
mobile promotions
parent
42263f1dfe
commit
d19626ceee
@@ -335,7 +335,11 @@ static int host1x_del_client(struct host1x *host1x,
|
|||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if defined(NV_BUS_TYPE_STRUCT_MATCH_HAS_CONST_DRV_ARG)
|
||||||
|
static int host1x_device_match(struct device *dev, const struct device_driver *drv)
|
||||||
|
#else
|
||||||
static int host1x_device_match(struct device *dev, struct device_driver *drv)
|
static int host1x_device_match(struct device *dev, struct device_driver *drv)
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
return strcmp(dev_name(dev), drv->name) == 0;
|
return strcmp(dev_name(dev), drv->name) == 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
// SPDX-License-Identifier: GPL-2.0
|
// SPDX-License-Identifier: GPL-2.0-only
|
||||||
// Copyright (c) 2022-2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
|
// SPDX-FileCopyrightText: Copyright (c) 2022-2024 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
|
||||||
|
|
||||||
#include <nvidia/conftest.h>
|
#include <nvidia/conftest.h>
|
||||||
|
|
||||||
@@ -295,7 +295,11 @@ static void tegra_ivc_bus_release(struct device *dev)
|
|||||||
kfree(bus);
|
kfree(bus);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if defined(NV_BUS_TYPE_STRUCT_MATCH_HAS_CONST_DRV_ARG)
|
||||||
|
static int tegra_ivc_bus_match(struct device *dev, const struct device_driver *drv)
|
||||||
|
#else
|
||||||
static int tegra_ivc_bus_match(struct device *dev, struct device_driver *drv)
|
static int tegra_ivc_bus_match(struct device *dev, struct device_driver *drv)
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
struct tegra_ivc_driver *ivcdrv = to_tegra_ivc_driver(drv);
|
struct tegra_ivc_driver *ivcdrv = to_tegra_ivc_driver(drv);
|
||||||
|
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
/* SPDX-License-Identifier: GPL-2.0-only */
|
/* SPDX-License-Identifier: GPL-2.0-only */
|
||||||
/*
|
/* SPDX-FileCopyrightText: Copyright (c) 2020-2024 NVIDIA CORPORATION & AFFILIATES. All Rights Reserved. */
|
||||||
* Copyright (c) 2022, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef _LINUX_TEGRA_IVC_BUS_H
|
#ifndef _LINUX_TEGRA_IVC_BUS_H
|
||||||
#define _LINUX_TEGRA_IVC_BUS_H
|
#define _LINUX_TEGRA_IVC_BUS_H
|
||||||
|
|
||||||
|
#include <nvidia/conftest.h>
|
||||||
|
|
||||||
#include <soc/tegra/ivc-priv.h>
|
#include <soc/tegra/ivc-priv.h>
|
||||||
#include <linux/types.h>
|
#include <linux/types.h>
|
||||||
#include <linux/tegra-hsp-combo.h>
|
#include <linux/tegra-hsp-combo.h>
|
||||||
@@ -32,8 +32,11 @@ struct tegra_ivc_driver {
|
|||||||
} ops;
|
} ops;
|
||||||
};
|
};
|
||||||
|
|
||||||
static inline struct tegra_ivc_driver *to_tegra_ivc_driver(
|
#if defined(NV_BUS_TYPE_STRUCT_MATCH_HAS_CONST_DRV_ARG)
|
||||||
struct device_driver *drv)
|
static inline struct tegra_ivc_driver *to_tegra_ivc_driver(const struct device_driver *drv)
|
||||||
|
#else
|
||||||
|
static inline struct tegra_ivc_driver *to_tegra_ivc_driver(struct device_driver *drv)
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
if (drv == NULL)
|
if (drv == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|||||||
@@ -97,6 +97,7 @@ NV_CONFTEST_FUNCTION_COMPILE_TESTS += blk_mq_destroy_queue
|
|||||||
NV_CONFTEST_FUNCTION_COMPILE_TESTS += blk_queue_max_hw_sectors
|
NV_CONFTEST_FUNCTION_COMPILE_TESTS += blk_queue_max_hw_sectors
|
||||||
NV_CONFTEST_FUNCTION_COMPILE_TESTS += block_device_operations_open_has_gendisk_arg
|
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 += block_device_operations_release_has_no_mode_arg
|
||||||
|
NV_CONFTEST_FUNCTION_COMPILE_TESTS += bus_type_struct_match_has_const_drv_arg
|
||||||
NV_CONFTEST_FUNCTION_COMPILE_TESTS += bus_type_struct_remove_has_int_return_type
|
NV_CONFTEST_FUNCTION_COMPILE_TESTS += bus_type_struct_remove_has_int_return_type
|
||||||
NV_CONFTEST_FUNCTION_COMPILE_TESTS += bus_type_struct_uevent_has_const_dev_arg
|
NV_CONFTEST_FUNCTION_COMPILE_TESTS += bus_type_struct_uevent_has_const_dev_arg
|
||||||
NV_CONFTEST_FUNCTION_COMPILE_TESTS += class_attribute_struct_has_const_struct_class_attribute
|
NV_CONFTEST_FUNCTION_COMPILE_TESTS += class_attribute_struct_has_const_struct_class_attribute
|
||||||
|
|||||||
@@ -6630,6 +6630,26 @@ compile_test() {
|
|||||||
"NV_BLOCK_DEVICE_OPERATIONS_RELEASE_HAS_NO_MODE_ARG" "" "types"
|
"NV_BLOCK_DEVICE_OPERATIONS_RELEASE_HAS_NO_MODE_ARG" "" "types"
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
bus_type_struct_match_has_const_drv_arg)
|
||||||
|
#
|
||||||
|
# Determine if the 'match' callback from the 'bus_type' structure
|
||||||
|
# has a const 'struct device_driver' argument.
|
||||||
|
#
|
||||||
|
# Commit d69d80484598 ("driver core: have match() callback in struct
|
||||||
|
# bus_type take a const *") updated the match() function for the
|
||||||
|
# 'bus_type' structure to take a constant 'drv' argument.
|
||||||
|
#
|
||||||
|
CODE="
|
||||||
|
#include <linux/device/bus.h>
|
||||||
|
int conftest_bus_type_struct_match_has_const_drv_arg(struct device *dev,
|
||||||
|
const struct device_driver *drv,
|
||||||
|
struct bus_type *bus) {
|
||||||
|
return bus->match(dev, drv);
|
||||||
|
}"
|
||||||
|
|
||||||
|
compile_check_conftest "$CODE" "NV_BUS_TYPE_STRUCT_MATCH_HAS_CONST_DRV_ARG" "" "types"
|
||||||
|
;;
|
||||||
|
|
||||||
bus_type_struct_remove_has_int_return_type)
|
bus_type_struct_remove_has_int_return_type)
|
||||||
#
|
#
|
||||||
# Determine if the 'remove' callback from the 'bus_type' structure
|
# Determine if the 'remove' callback from the 'bus_type' structure
|
||||||
|
|||||||
Reference in New Issue
Block a user