Skip to content

Commit eac1175

Browse files
Ayush1325kartben
authored andcommitted
drivers: sensor: ti: ti-hdc20xx: Fix sensor define
- Since ti-hdc20xx is a sensor, it should use SENSOR_DEVICE_* macro for definition. - Allows it to work with sensor_shell properly. Signed-off-by: Ayush Singh <[email protected]>
1 parent baef45f commit eac1175

File tree

1 file changed

+10
-14
lines changed

1 file changed

+10
-14
lines changed

drivers/sensor/ti/ti_hdc20xx/ti_hdc20xx.c

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -242,20 +242,16 @@ static int ti_hdc20xx_init(const struct device *dev)
242242
}
243243

244244
/* Main instantiation macro */
245-
#define TI_HDC20XX_DEFINE(inst, compat) \
246-
static struct ti_hdc20xx_data ti_hdc20xx_data_##compat##inst; \
247-
static const struct ti_hdc20xx_config ti_hdc20xx_config_##compat##inst = { \
248-
.bus = I2C_DT_SPEC_GET(DT_INST(inst, compat)), \
249-
.gpio_int = GPIO_DT_SPEC_GET_OR(DT_INST(inst, compat), int_gpios, {0}), \
250-
}; \
251-
DEVICE_DT_DEFINE(DT_INST(inst, compat), \
252-
ti_hdc20xx_init, \
253-
NULL, \
254-
&ti_hdc20xx_data_##compat##inst, \
255-
&ti_hdc20xx_config_##compat##inst, \
256-
POST_KERNEL, \
257-
CONFIG_SENSOR_INIT_PRIORITY, \
258-
&ti_hdc20xx_api_funcs);
245+
#define TI_HDC20XX_DEFINE(inst, compat) \
246+
static struct ti_hdc20xx_data ti_hdc20xx_data_##compat##inst; \
247+
static const struct ti_hdc20xx_config ti_hdc20xx_config_##compat##inst = { \
248+
.bus = I2C_DT_SPEC_GET(DT_INST(inst, compat)), \
249+
.gpio_int = GPIO_DT_SPEC_GET_OR(DT_INST(inst, compat), int_gpios, {0}), \
250+
}; \
251+
SENSOR_DEVICE_DT_DEFINE(DT_INST(inst, compat), ti_hdc20xx_init, NULL, \
252+
&ti_hdc20xx_data_##compat##inst, \
253+
&ti_hdc20xx_config_##compat##inst, POST_KERNEL, \
254+
CONFIG_SENSOR_INIT_PRIORITY, &ti_hdc20xx_api_funcs);
259255

260256
/* Create the struct device for every status "okay" node in the devicetree. */
261257
#define TI_HDC20XX_FOREACH_STATUS_OKAY(compat, fn) \

0 commit comments

Comments
 (0)