diff --git a/drivers/gpio/gpio_tle9104.c b/drivers/gpio/gpio_tle9104.c index b2066b9ab46..47a899e1615 100644 --- a/drivers/gpio/gpio_tle9104.c +++ b/drivers/gpio/gpio_tle9104.c @@ -415,8 +415,8 @@ static int tle9104_init(const struct device *dev) register_cfg |= TLE9104_CFG_OUT1DD_BIT << i; - if (!device_is_ready(current->port)) { - LOG_ERR("control GPIO %s is not ready", current->port->name); + if (!gpio_is_ready_dt(current)) { + LOG_ERR("%s: control GPIO is not ready", dev->name); return -ENODEV; } @@ -428,8 +428,8 @@ static int tle9104_init(const struct device *dev) } if (config->gpio_enable.port != NULL) { - if (!device_is_ready(config->gpio_enable.port)) { - LOG_ERR("enable GPIO %s is not ready", config->gpio_enable.port->name); + if (!gpio_is_ready_dt(&config->gpio_enable)) { + LOG_ERR("%s: enable GPIO is not ready", dev->name); return -ENODEV; } @@ -441,6 +441,11 @@ static int tle9104_init(const struct device *dev) } if (config->gpio_reset.port != NULL) { + if (!gpio_is_ready_dt(&config->gpio_reset)) { + LOG_ERR("%s: reset GPIO is not yet ready", dev->name); + return -ENODEV; + } + result = gpio_pin_configure_dt(&config->gpio_reset, GPIO_OUTPUT_ACTIVE); if (result != 0) { LOG_ERR("failed to initialize GPIO for reset");