diff --git a/drivers/net/can/mttcan/native/m_ttcan_linux.c b/drivers/net/can/mttcan/native/m_ttcan_linux.c index 7e73a58d..68a6f12b 100644 --- a/drivers/net/can/mttcan/native/m_ttcan_linux.c +++ b/drivers/net/can/mttcan/native/m_ttcan_linux.c @@ -988,7 +988,11 @@ static int mttcan_do_set_bittiming(struct net_device *dev) int err = 0; struct mttcan_priv *priv = netdev_priv(dev); const struct can_bittiming *bt = &priv->can.bittiming; +#if defined(NV_CAN_PRIV_STRUCT_HAS_STRUCT_DATA_BITTIMING_PARAMS) /* Linux v6.16 */ + const struct can_bittiming *dbt = &priv->can.fd.data_bittiming; +#else const struct can_bittiming *dbt = &priv->can.data_bittiming; +#endif memcpy(&priv->ttcan->bt_config.nominal, bt, sizeof(struct can_bittiming)); @@ -1197,7 +1201,11 @@ static struct net_device *alloc_mttcan_dev(void) priv->dev = dev; priv->can.bittiming_const = &mttcan_normal_bittiming_const; +#if defined(NV_CAN_PRIV_STRUCT_HAS_STRUCT_DATA_BITTIMING_PARAMS) /* Linux v6.16 */ + priv->can.fd.data_bittiming_const = &mttcan_data_bittiming_const; +#else priv->can.data_bittiming_const = &mttcan_data_bittiming_const; +#endif priv->can.do_set_bittiming = mttcan_do_set_bittiming; priv->can.do_set_mode = mttcan_set_mode; priv->can.do_get_berr_counter = mttcan_get_berr_counter; diff --git a/scripts/conftest/Makefile b/scripts/conftest/Makefile index fd5b2171..22bee9ae 100644 --- a/scripts/conftest/Makefile +++ b/scripts/conftest/Makefile @@ -106,6 +106,7 @@ NV_CONFTEST_FUNCTION_COMPILE_TESTS += blk_mq_f_should_merge 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_uevent_has_const_dev_arg +NV_CONFTEST_FUNCTION_COMPILE_TESTS += can_priv_struct_has_struct_data_bittiming_params NV_CONFTEST_FUNCTION_COMPILE_TESTS += class_attribute_struct_has_const_struct_class_attribute NV_CONFTEST_FUNCTION_COMPILE_TESTS += class_create_has_no_owner_arg NV_CONFTEST_FUNCTION_COMPILE_TESTS += class_struct_devnode_has_const_dev_arg diff --git a/scripts/conftest/conftest.sh b/scripts/conftest/conftest.sh index 74077901..e4e13fd3 100755 --- a/scripts/conftest/conftest.sh +++ b/scripts/conftest/conftest.sh @@ -6832,6 +6832,24 @@ compile_test() { compile_check_conftest "$CODE" "NV_BUS_TYPE_STRUCT_UEVENT_HAS_CONST_DEV_ARG" "" "types" ;; + can_priv_struct_has_struct_data_bittiming_params) + # + # Determine if the 'can_priv' structure has a member of type + # 'structure data_bittiming_params'. + # + # In Linux v6.16, commit b803c4a4f788 ("can: dev: add struct + # data_bittiming_params to group FD parameters") added the + # 'data_bittiming_params' structure to the 'can_priv' structure. + # + CODE=" + #include + int conftest_can_priv_struct_has_struct_data_bittiming_params(void) { + return offsetof(struct can_priv, fd); + }" + + compile_check_conftest "$CODE" "NV_CAN_PRIV_STRUCT_HAS_STRUCT_DATA_BITTIMING_PARAMS" "" "types" + ;; + class_attribute_struct_has_const_struct_class_attribute) # # Determine if struct class_attribute function has const type "struct class_attribute"