Skip to content

Commit edfd048

Browse files
andre-stefanovjilaypandya
authored andcommitted
drivers: stepper: Fixed TMC22xx compile errors
Remove unnecessary `data` parameter from `STEP_DIR_STEPPER_STRUCT_CHECK` macro, simplifying its usage. Adjust `tmc22xx_data` struct and initialization to reflect the change, removing redundant `.common` field. Signed-off-by: Andre Stefanov <[email protected]>
1 parent 745af42 commit edfd048

File tree

2 files changed

+3
-8
lines changed

2 files changed

+3
-8
lines changed

drivers/stepper/adi_tmc/tmc22xx.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,10 @@ struct tmc22xx_config {
1919
};
2020

2121
struct tmc22xx_data {
22-
struct step_dir_stepper_common_data common;
2322
enum stepper_micro_step_resolution resolution;
2423
};
2524

26-
STEP_DIR_STEPPER_STRUCT_CHECK(struct tmc22xx_config, struct tmc22xx_data);
25+
STEP_DIR_STEPPER_STRUCT_CHECK(struct tmc22xx_config);
2726

2827
static int tmc22xx_stepper_enable(const struct device *dev)
2928
{
@@ -176,7 +175,6 @@ static DEVICE_API(stepper, tmc22xx_stepper_api) = {
176175
(.msx_pins = tmc22xx_stepper_msx_pins_##inst)) \
177176
}; \
178177
static struct tmc22xx_data tmc22xx_data_##inst = { \
179-
.common = STEP_DIR_STEPPER_DT_INST_COMMON_DATA_INIT(inst), \
180178
.resolution = DT_INST_PROP(inst, micro_step_res), \
181179
}; \
182180
DEVICE_DT_INST_DEFINE(inst, tmc22xx_stepper_init, NULL, &tmc22xx_data_##inst, \

drivers/stepper/step_dir/step_dir_stepper_common.h

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -56,13 +56,10 @@ struct step_dir_stepper_common_config {
5656
* @brief Validate the offset of the common data structures.
5757
*
5858
* @param config Name of the config structure.
59-
* @param data Name of the data structure.
6059
*/
61-
#define STEP_DIR_STEPPER_STRUCT_CHECK(config, data) \
60+
#define STEP_DIR_STEPPER_STRUCT_CHECK(config) \
6261
BUILD_ASSERT(offsetof(config, common) == 0, \
63-
"struct step_dir_stepper_common_config must be placed first"); \
64-
BUILD_ASSERT(offsetof(data, common) == 0, \
65-
"struct step_dir_stepper_common_data must be placed first");
62+
"struct step_dir_stepper_common_config must be placed first");
6663

6764
/**
6865
* @brief Common function to initialize a step direction stepper device at init time.

0 commit comments

Comments
 (0)