Commit 97122718 authored by Trent Piepho's avatar Trent Piepho Committed by Anas Nashif
Browse files

drivers/sensor: si7006: Switch to undef DT_DRV_COMPAT



This style is used in sensor drivers.  It's more complicated than the
other way, which is used in different drivers that are not sensor
drivers.

Signed-off-by: default avatarTrent Piepho <tpiepho@gmail.com>
parent 0f219e1e
Loading
Loading
Loading
Loading
+16 −10
Original line number Diff line number Diff line
@@ -197,17 +197,23 @@ static int si7006_init(const struct device *dev)
	return 0;
}

#define SI7006_DEFINE(inst, temp_cmd)							\
	static struct si7006_data si7006_data_##inst;					\
#define SI7006_DEFINE(inst, name, temp_cmd)						\
	static struct si7006_data si7006_data_##name##_##inst;				\
											\
	static const struct si7006_config si7006_config_##inst = {			\
		.i2c = I2C_DT_SPEC_GET(inst),						\
	static const struct si7006_config si7006_config_##name##_##inst = {		\
		.i2c = I2C_DT_SPEC_INST_GET(inst),					\
		.read_temp_cmd = temp_cmd,						\
	};										\
											\
	SENSOR_DEVICE_DT_DEFINE(inst, si7006_init, NULL,				\
				&si7006_data_##inst, &si7006_config_##inst,		\
				POST_KERNEL, CONFIG_SENSOR_INIT_PRIORITY, &si7006_api); \

DT_FOREACH_STATUS_OKAY_VARGS(silabs_si7006, SI7006_DEFINE, SI7006_READ_OLD_TEMP);
DT_FOREACH_STATUS_OKAY_VARGS(sensirion_sht21, SI7006_DEFINE, SI7006_MEAS_TEMP_MASTER_MODE);
	SENSOR_DEVICE_DT_INST_DEFINE(inst, si7006_init, NULL,				\
				     &si7006_data_##name##_##inst,			\
				     &si7006_config_##name##_##inst,			\
				     POST_KERNEL, CONFIG_SENSOR_INIT_PRIORITY,		\
				     &si7006_api);

#define DT_DRV_COMPAT silabs_si7006
DT_INST_FOREACH_STATUS_OKAY_VARGS(SI7006_DEFINE, DT_DRV_COMPAT, SI7006_READ_OLD_TEMP);

#undef DT_DRV_COMPAT
#define DT_DRV_COMPAT sensirion_sht21
DT_INST_FOREACH_STATUS_OKAY_VARGS(SI7006_DEFINE, DT_DRV_COMPAT, SI7006_MEAS_TEMP_MASTER_MODE);