diff --git a/drivers/spi/spi-tegra124-slave.c b/drivers/spi/spi-tegra124-slave.c index 24852588..2590e882 100644 --- a/drivers/spi/spi-tegra124-slave.c +++ b/drivers/spi/spi-tegra124-slave.c @@ -2017,7 +2017,11 @@ static int tegra_spi_probe(struct platform_device *pdev) pdata->rx_trig_words != 4 && pdata->rx_trig_words != 8) pdata->rx_trig_words = 0; +#if defined(NV_DEVM_SPI_ALLOC_HOST_PRESENT) /* Linux v6.2 */ + controller = devm_spi_alloc_host(&pdev->dev, sizeof(*tspi)); +#else controller = devm_spi_alloc_master(&pdev->dev, sizeof(*tspi)); +#endif if (!controller) { dev_err(&pdev->dev, "controller allocation failed\n"); return -ENOMEM; diff --git a/drivers/spi/spi-tegra210-quad.c b/drivers/spi/spi-tegra210-quad.c index ff047a14..605a9e28 100644 --- a/drivers/spi/spi-tegra210-quad.c +++ b/drivers/spi/spi-tegra210-quad.c @@ -1660,7 +1660,11 @@ static int tegra_qspi_probe(struct platform_device *pdev) int bus_num; u32 as_delay; +#if defined(NV_DEVM_SPI_ALLOC_HOST_PRESENT) /* Linux v6.2 */ + controller = devm_spi_alloc_host(&pdev->dev, sizeof(*tqspi)); +#else controller = devm_spi_alloc_master(&pdev->dev, sizeof(*tqspi)); +#endif if (!controller) return -ENOMEM; diff --git a/scripts/conftest/Makefile b/scripts/conftest/Makefile index f96fb53c..973fc670 100644 --- a/scripts/conftest/Makefile +++ b/scripts/conftest/Makefile @@ -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 diff --git a/scripts/conftest/conftest.sh b/scripts/conftest/conftest.sh index 7be573f4..71205f96 100755 --- a/scripts/conftest/conftest.sh +++ b/scripts/conftest/conftest.sh @@ -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 + 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