Skip to content

Commit

Permalink
drivers: gpio: use new ngpios macros for cases embedded in macros
Browse files Browse the repository at this point in the history
Fixup cases of GPIO_PORT_PIN_MASK_FROM_NGPIOS(DT_INST_PROP(n, ngpios))
to use GPIO_PORT_PIN_MASK_FROM_DT_INST(n) instead.

Signed-off-by: Kumar Gala <[email protected]>
  • Loading branch information
galak committed Apr 6, 2020
1 parent 9f7cab0 commit 4e553f3
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 13 deletions.
5 changes: 1 addition & 4 deletions drivers/gpio/gpio_cmsdk_ahb.c
Original file line number Diff line number Diff line change
Expand Up @@ -269,15 +269,12 @@ static int gpio_cmsdk_ahb_init(struct device *dev)
return 0;
}

#define PORT_PIN_MASK(n) \
GPIO_PORT_PIN_MASK_FROM_NGPIOS(DT_INST_PROP(n, ngpios))

#define CMSDK_AHB_GPIO_DEVICE(n) \
static void gpio_cmsdk_port_##n##_config_func(struct device *dev); \
\
static const struct gpio_cmsdk_ahb_cfg gpio_cmsdk_port_##n##_config = { \
.common = { \
.port_pin_mask = PORT_PIN_MASK(n), \
.port_pin_mask = GPIO_PORT_PIN_MASK_FROM_DT_INST(n), \
}, \
.port = ((volatile struct gpio_cmsdk_ahb *)DT_INST_REG_ADDR(n)),\
.gpio_config_func = gpio_cmsdk_port_##n##_config_func, \
Expand Down
2 changes: 1 addition & 1 deletion drivers/gpio/gpio_esp32.c
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,7 @@ static struct gpio_esp32_data gpio_1_data = { /* 32..39 */

#define GPIO_DEVICE_INIT(_id) \
static struct gpio_driver_config gpio_##_id##_cfg = { \
.port_pin_mask = GPIO_PORT_PIN_MASK_FROM_NGPIOS(DT_INST_PROP(_id, ngpios)),\
.port_pin_mask = GPIO_PORT_PIN_MASK_FROM_DT_INST(_id), \
}; \
DEVICE_AND_API_INIT(gpio_esp32_##_id, \
DT_INST_LABEL(_id), \
Expand Down
2 changes: 1 addition & 1 deletion drivers/gpio/gpio_imx.c
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ static const struct gpio_driver_api imx_gpio_driver_api = {
static const struct imx_gpio_config imx_gpio_##n##_config = { \
.common = { \
.port_pin_mask = \
GPIO_PORT_PIN_MASK_FROM_NGPIOS(DT_INST_PROP(n, ngpios)), \
GPIO_PORT_PIN_MASK_FROM_DT_INST(n), \
}, \
.base = (GPIO_Type *)DT_INST_REG_ADDR(n), \
}; \
Expand Down
3 changes: 1 addition & 2 deletions drivers/gpio/gpio_lmp90xxx.c
Original file line number Diff line number Diff line change
Expand Up @@ -170,8 +170,7 @@ BUILD_ASSERT(CONFIG_GPIO_LMP90XXX_INIT_PRIORITY >
static const struct gpio_lmp90xxx_config gpio_lmp90xxx_##id##_cfg = {\
.common = { \
.port_pin_mask = \
GPIO_PORT_PIN_MASK_FROM_NGPIOS( \
DT_INST_PROP(id, ngpios)) \
GPIO_PORT_PIN_MASK_FROM_DT_INST(id) \
}, \
.parent_dev_name = DT_INST_BUS_LABEL(id), \
}; \
Expand Down
2 changes: 1 addition & 1 deletion drivers/gpio/gpio_pca95xx.c
Original file line number Diff line number Diff line change
Expand Up @@ -491,7 +491,7 @@ static int gpio_pca95xx_init(struct device *dev)
#define GPIO_PCA95XX_DEVICE_INSTANCE(inst) \
static const struct gpio_pca95xx_config gpio_pca95xx_##inst##_cfg = { \
.common = { \
.port_pin_mask = GPIO_PORT_PIN_MASK_FROM_NGPIOS(DT_INST_PROP(inst, ngpios)), \
.port_pin_mask = GPIO_PORT_PIN_MASK_FROM_DT_INST(inst), \
}, \
.i2c_master_dev_name = DT_INST_BUS_LABEL(inst), \
.i2c_slave_addr = DT_INST_REG_ADDR(inst), \
Expand Down
5 changes: 1 addition & 4 deletions drivers/gpio/gpio_stellaris.c
Original file line number Diff line number Diff line change
Expand Up @@ -255,17 +255,14 @@ static const struct gpio_driver_api gpio_stellaris_driver_api = {
.disable_callback = gpio_stellaris_disable_callback,
};

#define PORT_PIN_MASK(n) \
GPIO_PORT_PIN_MASK_FROM_NGPIOS(DT_INST_PROP(n, ngpios))

#define STELLARIS_GPIO_DEVICE(n) \
static void port_## n ##_stellaris_config_func(struct device *dev); \
\
static struct gpio_stellaris_runtime port_## n ##_stellaris_runtime; \
\
static const struct gpio_stellaris_config gpio_stellaris_port_## n ##_config = {\
.common = { \
.port_pin_mask = PORT_PIN_MASK(n), \
.port_pin_mask = GPIO_PORT_PIN_MASK_FROM_DT_INST(n), \
}, \
.base = DT_INST_REG_ADDR(n), \
.port_map = BIT_MASK(DT_INST_PROP(n, ngpios)), \
Expand Down

0 comments on commit 4e553f3

Please sign in to comment.