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
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
Jon Hunter
2024-07-12 18:08:31 +01:00
committed by mobile promotions
parent 19c93284bd
commit fc171fe539
5 changed files with 39 additions and 7 deletions

View File

@@ -1,11 +1,11 @@
/* SPDX-License-Identifier: GPL-2.0-only */
/*
* Copyright (c) 2022, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
*/
/* SPDX-FileCopyrightText: Copyright (c) 2020-2024 NVIDIA CORPORATION & AFFILIATES. All Rights Reserved. */
#ifndef _LINUX_TEGRA_IVC_BUS_H
#define _LINUX_TEGRA_IVC_BUS_H
#include <nvidia/conftest.h>
#include <soc/tegra/ivc-priv.h>
#include <linux/types.h>
#include <linux/tegra-hsp-combo.h>
@@ -32,8 +32,11 @@ struct tegra_ivc_driver {
} ops;
};
static inline struct tegra_ivc_driver *to_tegra_ivc_driver(
struct device_driver *drv)
#if defined(NV_BUS_TYPE_STRUCT_MATCH_HAS_CONST_DRV_ARG)
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)
return NULL;