spi: Fix build for Linux v6.13

Commit 0809a9ccac4a ("spi: remove {devm_}spi_alloc_master/slave()")
removed devm_spi_alloc_master() and this breaks building the Tegra124
and Tegra210 SPI drivers for Linux v6.13. Commit b8d3b056a78d ("spi:
introduce new helpers with using modern naming") previously added new
helpers in Linux v6.2 which should be instead. Add a test for conftest
to detect if the kernel supports the function devm_spi_alloc_host()
and if so use this function.

Bug 4991705

Change-Id: I1d639297ef7adfdcde50927360607639b45a4a60
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3261698
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
Reviewed-by: Brad Griffis <bgriffis@nvidia.com>
This commit is contained in:
Jon Hunter
2024-10-04 16:05:39 +01:00
parent a8777837dd
commit ef57537991
4 changed files with 26 additions and 0 deletions

View File

@@ -110,6 +110,7 @@ NV_CONFTEST_FUNCTION_COMPILE_TESTS += devfreq_dev_profile_has_is_cooling_device
NV_CONFTEST_FUNCTION_COMPILE_TESTS += devfreq_has_freq_table
NV_CONFTEST_FUNCTION_COMPILE_TESTS += device_add_disk_has_int_return_type
NV_CONFTEST_FUNCTION_COMPILE_TESTS += devm_pm_domain_attach_list
NV_CONFTEST_FUNCTION_COMPILE_TESTS += devm_spi_alloc_host
NV_CONFTEST_FUNCTION_COMPILE_TESTS += devm_tegra_core_dev_init_opp_table_common
NV_CONFTEST_FUNCTION_COMPILE_TESTS += devm_thermal_of_zone_register
NV_CONFTEST_FUNCTION_COMPILE_TESTS += disk_check_media_change

View File

@@ -6919,6 +6919,23 @@ compile_test() {
compile_check_conftest "$CODE" "NV_DEVM_PM_DOMAIN_ATTACH_LIST_PRESENT" "" "functions"
;;
devm_spi_alloc_host)
#
# Determine whether devm_spi_alloc_host() is present.
#
# Commit b8d3b056a78d ("spi: introduce new helpers with using modern
# naming") added devm_spi_alloc_host() in Linux v6.2.
#
CODE="
#undef CONFIG_ACPI
#include <linux/spi/spi.h>
void conftest_devm_spi_alloc_host(void) {
devm_spi_alloc_host();
}"
compile_check_conftest "$CODE" "NV_DEVM_SPI_ALLOC_HOST_PRESENT" "" "functions"
;;
devm_tegra_core_dev_init_opp_table_common)
#
# Determine whether devm_tegra_core_dev_init_opp_table_common is