Skip to content
Permalink
Browse files

dts: Make instance defines consistent

We generated a define for each instance to convey its existance of the
form:
	#define DT_<COMPAT>_<INSTANCE> 1

However we renamed all other instance defines to be of the form
DT_INST_<INSTANCE>_<FOO>.  To make things consistent we now generate a
define of the form:

	#define DT_INST_<INSTANCE>_<COMPAT> 1

We also now deprecate the DT_<COMPAT>_<INSTANCE> form and fixup all uses
to use the new form.

Fixes: #17650

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
  • Loading branch information...
galak authored and MaureenHelm committed Jul 30, 2019
1 parent 4620bbf commit 4e7863dc41830ce1bffb923705e49dcaccb63086
@@ -6,7 +6,7 @@

#include <init.h>

#if defined CONFIG_PWM && defined DT_ATMEL_SAM_PWM_0
#if defined CONFIG_PWM && defined DT_INST_0_ATMEL_SAM_PWM
/* PWM on EXT1 connector, pin 7, channel 0, inverted */
static const struct soc_gpio_pin pwm_ext1_pin7 = {
PIO_PA0A_PWM0_PWMH0, PIOA, ID_PIOA, SOC_GPIO_FUNC_A
@@ -27,7 +27,7 @@ static int sam_e70_xplained_init(struct device *dev)
{
ARG_UNUSED(dev);

#if defined CONFIG_PWM && DT_ATMEL_SAM_PWM_0
#if defined CONFIG_PWM && DT_INST_0_ATMEL_SAM_PWM
soc_gpio_configure(&pwm_ext1_pin7);
soc_gpio_configure(&pwm_ext2_pin7);
soc_gpio_configure(&pwm_ext2_pin8);
@@ -165,7 +165,7 @@ static int dtmr_cmsdk_apb_init(struct device *dev)
}

/* TIMER 0 */
#ifdef DT_ARM_CMSDK_DTIMER_0
#ifdef DT_INST_0_ARM_CMSDK_DTIMER
static void dtimer_cmsdk_apb_config_0(struct device *dev);

static const struct dtmr_cmsdk_apb_cfg dtmr_cmsdk_apb_cfg_0 = {
@@ -205,4 +205,4 @@ static void dtimer_cmsdk_apb_config_0(struct device *dev)
DEVICE_GET(dtmr_cmsdk_apb_0), 0);
irq_enable(DT_INST_0_ARM_CMSDK_DTIMER_IRQ_0);
}
#endif /* DT_ARM_CMSDK_DTIMER_0 */
#endif /* DT_INST_0_ARM_CMSDK_DTIMER */
@@ -160,7 +160,7 @@ static int tmr_cmsdk_apb_init(struct device *dev)
}

/* TIMER 0 */
#ifdef DT_ARM_CMSDK_TIMER_0
#ifdef DT_INST_0_ARM_CMSDK_TIMER
static void timer_cmsdk_apb_config_0(struct device *dev);

static const struct tmr_cmsdk_apb_cfg tmr_cmsdk_apb_cfg_0 = {
@@ -198,10 +198,10 @@ static void timer_cmsdk_apb_config_0(struct device *dev)
DEVICE_GET(tmr_cmsdk_apb_0), 0);
irq_enable(DT_INST_0_ARM_CMSDK_TIMER_IRQ_0);
}
#endif /* DT_ARM_CMSDK_TIMER_0 */
#endif /* DT_INST_0_ARM_CMSDK_TIMER */

/* TIMER 1 */
#ifdef DT_ARM_CMSDK_TIMER_1
#ifdef DT_INST_1_ARM_CMSDK_TIMER
static void timer_cmsdk_apb_config_1(struct device *dev);

static const struct tmr_cmsdk_apb_cfg tmr_cmsdk_apb_cfg_1 = {
@@ -239,4 +239,4 @@ static void timer_cmsdk_apb_config_1(struct device *dev)
DEVICE_GET(tmr_cmsdk_apb_1), 0);
irq_enable(DT_INST_1_ARM_CMSDK_TIMER_IRQ_0);
}
#endif /* DT_ARM_CMSDK_TIMER_1 */
#endif /* DT_INST_1_ARM_CMSDK_TIMER */
@@ -62,7 +62,7 @@ struct ssd16xx_data {
u8_t scan_mode;
};

#if defined(DT_GD_GDE0213B1_0)
#if defined(DT_INST_0_GD_GDE0213B1)
static u8_t ssd16xx_lut_initial[] = {
0x22, 0x55, 0xAA, 0x55, 0xAA, 0x55, 0xAA, 0x11,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
@@ -76,7 +76,7 @@ static u8_t ssd16xx_lut_default[] = {
0x0F, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00
};
#elif defined(DT_GD_GDE029A1_0)
#elif defined(DT_INST_0_GD_GDE029A1)
static u8_t ssd16xx_lut_initial[] = {
0x50, 0xAA, 0x55, 0xAA, 0x11, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
@@ -90,7 +90,7 @@ static u8_t ssd16xx_lut_default[] = {
0x00, 0x00, 0x00, 0x00, 0x13, 0x14, 0x44, 0x12,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00
};
#elif defined(DT_HINK_E0154A05_0)
#elif defined(DT_INST_0_HINK_E0154A05)
static u8_t ssd16xx_lut_initial[] = {
0x02, 0x02, 0x01, 0x11, 0x12, 0x12, 0x22, 0x22,
0x66, 0x69, 0x69, 0x59, 0x58, 0x99, 0x99, 0x88,
@@ -165,99 +165,99 @@ static const struct gpio_driver_api gpio_ht16k33_api = {

/* Support up to eight HT16K33 devices, each with three keyscan devices */

#ifdef DT_HOLTEK_HT16K33_KEYSCAN_0
#ifdef DT_INST_0_HOLTEK_HT16K33_KEYSCAN
GPIO_HT16K33_DEVICE(0);
#endif

#ifdef DT_HOLTEK_HT16K33_KEYSCAN_1
#ifdef DT_INST_1_HOLTEK_HT16K33_KEYSCAN
GPIO_HT16K33_DEVICE(1);
#endif

#ifdef DT_HOLTEK_HT16K33_KEYSCAN_2
#ifdef DT_INST_2_HOLTEK_HT16K33_KEYSCAN
GPIO_HT16K33_DEVICE(2);
#endif

#ifdef DT_HOLTEK_HT16K33_KEYSCAN_3
#ifdef DT_INST_3_HOLTEK_HT16K33_KEYSCAN
GPIO_HT16K33_DEVICE(3);
#endif

#ifdef DT_HOLTEK_HT16K33_KEYSCAN_4
#ifdef DT_INST_4_HOLTEK_HT16K33_KEYSCAN
GPIO_HT16K33_DEVICE(4);
#endif

#ifdef DT_HOLTEK_HT16K33_KEYSCAN_5
#ifdef DT_INST_5_HOLTEK_HT16K33_KEYSCAN
GPIO_HT16K33_DEVICE(5);
#endif

#ifdef DT_HOLTEK_HT16K33_KEYSCAN_6
#ifdef DT_INST_6_HOLTEK_HT16K33_KEYSCAN
GPIO_HT16K33_DEVICE(6);
#endif

#ifdef DT_HOLTEK_HT16K33_KEYSCAN_7
#ifdef DT_INST_7_HOLTEK_HT16K33_KEYSCAN
GPIO_HT16K33_DEVICE(7);
#endif

#ifdef DT_HOLTEK_HT16K33_KEYSCAN_8
#ifdef DT_INST_8_HOLTEK_HT16K33_KEYSCAN
GPIO_HT16K33_DEVICE(8);
#endif

#ifdef DT_HOLTEK_HT16K33_KEYSCAN_9
#ifdef DT_INST_9_HOLTEK_HT16K33_KEYSCAN
GPIO_HT16K33_DEVICE(9);
#endif

#ifdef DT_HOLTEK_HT16K33_KEYSCAN_10
#ifdef DT_INST_10_HOLTEK_HT16K33_KEYSCAN
GPIO_HT16K33_DEVICE(10);
#endif

#ifdef DT_HOLTEK_HT16K33_KEYSCAN_11
#ifdef DT_INST_11_HOLTEK_HT16K33_KEYSCAN
GPIO_HT16K33_DEVICE(11);
#endif

#ifdef DT_HOLTEK_HT16K33_KEYSCAN_12
#ifdef DT_INST_12_HOLTEK_HT16K33_KEYSCAN
GPIO_HT16K33_DEVICE(12);
#endif

#ifdef DT_HOLTEK_HT16K33_KEYSCAN_13
#ifdef DT_INST_13_HOLTEK_HT16K33_KEYSCAN
GPIO_HT16K33_DEVICE(13);
#endif

#ifdef DT_HOLTEK_HT16K33_KEYSCAN_14
#ifdef DT_INST_14_HOLTEK_HT16K33_KEYSCAN
GPIO_HT16K33_DEVICE(14);
#endif

#ifdef DT_HOLTEK_HT16K33_KEYSCAN_15
#ifdef DT_INST_15_HOLTEK_HT16K33_KEYSCAN
GPIO_HT16K33_DEVICE(15);
#endif

#ifdef DT_HOLTEK_HT16K33_KEYSCAN_16
#ifdef DT_INST_16_HOLTEK_HT16K33_KEYSCAN
GPIO_HT16K33_DEVICE(16);
#endif

#ifdef DT_HOLTEK_HT16K33_KEYSCAN_17
#ifdef DT_INST_17_HOLTEK_HT16K33_KEYSCAN
GPIO_HT16K33_DEVICE(17);
#endif

#ifdef DT_HOLTEK_HT16K33_KEYSCAN_18
#ifdef DT_INST_18_HOLTEK_HT16K33_KEYSCAN
GPIO_HT16K33_DEVICE(18);
#endif

#ifdef DT_HOLTEK_HT16K33_KEYSCAN_19
#ifdef DT_INST_19_HOLTEK_HT16K33_KEYSCAN
GPIO_HT16K33_DEVICE(19);
#endif

#ifdef DT_HOLTEK_HT16K33_KEYSCAN_20
#ifdef DT_INST_20_HOLTEK_HT16K33_KEYSCAN
GPIO_HT16K33_DEVICE(20);
#endif

#ifdef DT_HOLTEK_HT16K33_KEYSCAN_21
#ifdef DT_INST_21_HOLTEK_HT16K33_KEYSCAN
GPIO_HT16K33_DEVICE(21);
#endif

#ifdef DT_HOLTEK_HT16K33_KEYSCAN_22
#ifdef DT_INST_22_HOLTEK_HT16K33_KEYSCAN
GPIO_HT16K33_DEVICE(22);
#endif

#ifdef DT_HOLTEK_HT16K33_KEYSCAN_23
#ifdef DT_INST_23_HOLTEK_HT16K33_KEYSCAN
GPIO_HT16K33_DEVICE(23);
#endif

@@ -183,7 +183,7 @@ static const struct i2c_driver_api i2c_gecko_driver_api = {
.transfer = i2c_gecko_transfer,
};

#ifdef DT_SILABS_GECKO_I2C_0
#ifdef DT_INST_0_SILABS_GECKO_I2C

#define PIN_I2C_0_SDA {DT_INST_0_SILABS_GECKO_I2C_LOCATION_SDA_1, \
DT_INST_0_SILABS_GECKO_I2C_LOCATION_SDA_2, gpioModeWiredAnd, 1}
@@ -215,9 +215,9 @@ DEVICE_AND_API_INIT(i2c_gecko_0, DT_INST_0_SILABS_GECKO_I2C_LABEL,
&i2c_gecko_init, &i2c_gecko_data_0, &i2c_gecko_config_0,
POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEVICE,
&i2c_gecko_driver_api);
#endif /* DT_SILABS_GECKO_I2C_0 */
#endif /* DT_INST_0_SILABS_GECKO_I2C */

#ifdef DT_SILABS_GECKO_I2C_1
#ifdef DT_INST_1_SILABS_GECKO_I2C

#define PIN_I2C_1_SDA {DT_INST_1_SILABS_GECKO_I2C_LOCATION_SDA_1, \
DT_INST_1_SILABS_GECKO_I2C_LOCATION_SDA_2, gpioModeWiredAnd, 1}
@@ -249,4 +249,4 @@ DEVICE_AND_API_INIT(i2c_gecko_1, DT_INST_1_SILABS_GECKO_I2C_LABEL,
&i2c_gecko_init, &i2c_gecko_data_1, &i2c_gecko_config_1,
POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEVICE,
&i2c_gecko_driver_api);
#endif /* DT_SILABS_GECKO_I2C_1 */
#endif /* DT_INST_1_SILABS_GECKO_I2C */
@@ -120,18 +120,18 @@ DEVICE_AND_API_INIT(i2c_sbcon_##_num, DT_INST_##_num##_ARM_VERSATILE_I2C_LABEL,
&i2c_sbcon_dev_cfg_##_num, \
PRE_KERNEL_2, CONFIG_I2C_INIT_PRIORITY, &api)

#ifdef DT_ARM_VERSATILE_I2C_0
#ifdef DT_INST_0_ARM_VERSATILE_I2C
DEFINE_I2C_SBCON(0);
#endif

#ifdef DT_ARM_VERSATILE_I2C_1
#ifdef DT_INST_1_ARM_VERSATILE_I2C
DEFINE_I2C_SBCON(1);
#endif

#ifdef DT_ARM_VERSATILE_I2C_2
#ifdef DT_INST_2_ARM_VERSATILE_I2C
DEFINE_I2C_SBCON(2);
#endif

#ifdef DT_ARM_VERSATILE_I2C_3
#ifdef DT_INST_3_ARM_VERSATILE_I2C
DEFINE_I2C_SBCON(3);
#endif
@@ -203,7 +203,7 @@ static int i2c_eeprom_slave_init(struct device *dev)
return 0;
}

#ifdef DT_ATMEL_AT24_0
#ifdef DT_INST_0_ATMEL_AT24

static struct i2c_eeprom_slave_data i2c_eeprom_slave_0_dev_data;

@@ -222,9 +222,9 @@ DEVICE_AND_API_INIT(i2c_eeprom_slave_0, DT_INST_0_ATMEL_AT24_LABEL,
POST_KERNEL, CONFIG_I2C_SLAVE_INIT_PRIORITY,
&api_funcs);

#endif /* DT_ATMEL_AT24_0 */
#endif /* DT_INST_0_ATMEL_AT24 */

#ifdef DT_ATMEL_AT24_1
#ifdef DT_INST_1_ATMEL_AT24

static struct i2c_eeprom_slave_data i2c_eeprom_slave_1_dev_data;

@@ -243,4 +243,4 @@ DEVICE_AND_API_INIT(i2c_eeprom_slave_1, DT_INST_1_ATMEL_AT24_LABEL,
POST_KERNEL, CONFIG_I2C_SLAVE_INIT_PRIORITY,
&api_funcs);

#endif /* DT_ATMEL_AT24_1 */
#endif /* DT_INST_1_ATMEL_AT24 */
@@ -502,63 +502,63 @@ DEVICE_AND_API_INIT(ht16k33_##id, DT_INST_##id##_HOLTEK_HT16K33_LABEL, \

/* Support up to eight HT16K33 devices */

#ifdef DT_HOLTEK_HT16K33_0
#ifdef DT_INST_0_HOLTEK_HT16K33
#ifdef DT_INST_0_HOLTEK_HT16K33_IRQ_GPIOS_CONTROLLER
HT16K33_DEVICE_WITH_IRQ(0);
#else
HT16K33_DEVICE(0);
#endif
#endif

#ifdef DT_HOLTEK_HT16K33_1
#ifdef DT_INST_1_HOLTEK_HT16K33
#ifdef DT_INST_1_HOLTEK_HT16K33_IRQ_GPIOS_CONTROLLER
HT16K33_DEVICE_WITH_IRQ(1);
#else
HT16K33_DEVICE(1);
#endif
#endif

#ifdef DT_HOLTEK_HT16K33_2
#ifdef DT_INST_2_HOLTEK_HT16K33
#ifdef DT_INST_2_HOLTEK_HT16K33_IRQ_GPIOS_CONTROLLER
HT16K33_DEVICE_WITH_IRQ(2);
#else
HT16K33_DEVICE(2);
#endif
#endif

#ifdef DT_HOLTEK_HT16K33_3
#ifdef DT_INST_3_HOLTEK_HT16K33
#ifdef DT_INST_3_HOLTEK_HT16K33_IRQ_GPIOS_CONTROLLER
HT16K33_DEVICE_WITH_IRQ(3);
#else
HT16K33_DEVICE(3);
#endif
#endif

#ifdef DT_HOLTEK_HT16K33_4
#ifdef DT_INST_4_HOLTEK_HT16K33
#ifdef DT_INST_4_HOLTEK_HT16K33_IRQ_GPIOS_CONTROLLER
HT16K33_DEVICE_WITH_IRQ(4);
#else
HT16K33_DEVICE(4);
#endif
#endif

#ifdef DT_HOLTEK_HT16K33_5
#ifdef DT_INST_5_HOLTEK_HT16K33
#ifdef DT_INST_5_HOLTEK_HT16K33_IRQ_GPIOS_CONTROLLER
HT16K33_DEVICE_WITH_IRQ(5);
#else
HT16K33_DEVICE(5);
#endif
#endif

#ifdef DT_HOLTEK_HT16K33_6
#ifdef DT_INST_6_HOLTEK_HT16K33
#ifdef DT_INST_6_HOLTEK_HT16K33_IRQ_GPIOS_CONTROLLER
HT16K33_DEVICE_WITH_IRQ(6);
#else
HT16K33_DEVICE(6);
#endif
#endif

#ifdef DT_HOLTEK_HT16K33_7
#ifdef DT_INST_7_HOLTEK_HT16K33
#ifdef DT_INST_7_HOLTEK_HT16K33_IRQ_GPIOS_CONTROLLER
HT16K33_DEVICE_WITH_IRQ(7);
#else
@@ -9,7 +9,7 @@
#include <errno.h>
#include <string.h>

#ifdef DT_COLORWAY_LPD8806_0
#ifdef DT_INST_0_COLORWAY_LPD8806
#define DT_INST_0_COLORWAY_LPD880X DT_INST_0_COLORWAY_LPD8806
#define DT_INST_0_COLORWAY_LPD880X_BASE_ADDRESS DT_INST_0_COLORWAY_LPD8806_BASE_ADDRESS
#define DT_INST_0_COLORWAY_LPD880X_BUS_NAME DT_INST_0_COLORWAY_LPD8806_BUS_NAME
@@ -90,7 +90,7 @@ static const struct pwm_driver_api sam_pwm_driver_api = {
.get_cycles_per_sec = sam_pwm_get_cycles_per_sec,
};

#ifdef DT_ATMEL_SAM_PWM_0
#ifdef DT_INST_0_ATMEL_SAM_PWM
static const struct sam_pwm_config sam_pwm_config_0 = {
.regs = (Pwm *)DT_INST_0_ATMEL_SAM_PWM_BASE_ADDRESS,
.id = DT_INST_0_ATMEL_SAM_PWM_PERIPHERAL_ID,
@@ -102,9 +102,9 @@ DEVICE_AND_API_INIT(sam_pwm_0, DT_INST_0_ATMEL_SAM_PWM_LABEL, &sam_pwm_init,
NULL, &sam_pwm_config_0,
POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEVICE,
&sam_pwm_driver_api);
#endif /* DT_ATMEL_SAM_PWM_0 */
#endif /* DT_INST_0_ATMEL_SAM_PWM */

#ifdef DT_ATMEL_SAM_PWM_1
#ifdef DT_INST_1_ATMEL_SAM_PWM
static const struct sam_pwm_config sam_pwm_config_1 = {
.regs = (Pwm *)DT_INST_1_ATMEL_SAM_PWM_BASE_ADDRESS,
.id = DT_INST_1_ATMEL_SAM_PWM_PERIPHERAL_ID,
@@ -116,4 +116,4 @@ DEVICE_AND_API_INIT(sam_pwm_1, DT_INST_1_ATMEL_SAM_PWM_LABEL, &sam_pwm_init,
NULL, &sam_pwm_config_1,
POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEVICE,
&sam_pwm_driver_api);
#endif /* DT_ATMEL_SAM_PWM_1 */
#endif /* DT_INST_1_ATMEL_SAM_PWM */

0 comments on commit 4e7863d

Please sign in to comment.
You can’t perform that action at this time.