i2c: Use conftest to find if i2c_driver struct has new_probe

Use conftest method to find if i2c_driver struct has the
member as new_probe. This is dropped from Linux 6.6 with
commit 5eb1e6e459cf ("i2c: Drop legacy callback .probe_new()")

Bug 4346767

Change-Id: I10b539dfa1bb363ad6cf5fc28a9ebd0ca4e88b48
Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3028631
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
Laxman Dewangan
2023-12-05 15:35:46 +00:00
committed by mobile promotions
parent 21a661c58f
commit 537a307ffd
7 changed files with 37 additions and 15 deletions

View File

@@ -116,6 +116,7 @@ NV_CONFTEST_FUNCTION_COMPILE_TESTS += ethtool_ops_get_set_coalesce_has_coal_and_
NV_CONFTEST_FUNCTION_COMPILE_TESTS += ethtool_ops_get_set_ringparam_has_ringparam_and_extack_args
NV_CONFTEST_FUNCTION_COMPILE_TESTS += get_file_rcu_has_double_ptr_file_arg
NV_CONFTEST_FUNCTION_COMPILE_TESTS += get_user_pages
NV_CONFTEST_FUNCTION_COMPILE_TESTS += i2c_driver_struct_has_probe_new
NV_CONFTEST_FUNCTION_COMPILE_TESTS += iio_dev_opaque_has_mlock
NV_CONFTEST_FUNCTION_COMPILE_TESTS += iommu_map_has_gfp_arg
NV_CONFTEST_FUNCTION_COMPILE_TESTS += kthread_complete_and_exit

View File

@@ -5400,6 +5400,22 @@ compile_test() {
compile_check_conftest "$CODE" "NV_I2C_UNREGISTER_DEVICE_PRESENT" "" "functions"
;;
i2c_driver_struct_has_probe_new)
#
# Determine if struct i2c_driver has probe_new() present
#
# Added by commit 5eb1e6e459cf ("i2c: Drop legacy callback .probe_new()")
#
CODE="
#define _LINUX_EFI_H
#include <linux/i2c.h>
int conftest_i2c_driver_struct_has_probe_new(void) {
return offsetof(struct i2c_driver, probe_new);
}"
compile_check_conftest "$CODE" "NV_I2C_DRIVER_STRUCT_HAS_PROBE_NEW" "" "types"
;;
of_get_named_gpio)
#
# Determine if of_get_named_gpio() function is present