drivers: gpio: use gpio_is_ready_dt in TLE9104
Use gpio_is_ready_dt in the driver for the TLE9104 before actually using the GPIO. Signed-off-by: Benedikt Schmidt <benedikt.schmidt@embedded-solutions.at>
This commit is contained in:
parent
f26da17723
commit
23ed31383e
1 changed files with 9 additions and 4 deletions
|
|
@ -415,8 +415,8 @@ static int tle9104_init(const struct device *dev)
|
||||||
|
|
||||||
register_cfg |= TLE9104_CFG_OUT1DD_BIT << i;
|
register_cfg |= TLE9104_CFG_OUT1DD_BIT << i;
|
||||||
|
|
||||||
if (!device_is_ready(current->port)) {
|
if (!gpio_is_ready_dt(current)) {
|
||||||
LOG_ERR("control GPIO %s is not ready", current->port->name);
|
LOG_ERR("%s: control GPIO is not ready", dev->name);
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -428,8 +428,8 @@ static int tle9104_init(const struct device *dev)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (config->gpio_enable.port != NULL) {
|
if (config->gpio_enable.port != NULL) {
|
||||||
if (!device_is_ready(config->gpio_enable.port)) {
|
if (!gpio_is_ready_dt(&config->gpio_enable)) {
|
||||||
LOG_ERR("enable GPIO %s is not ready", config->gpio_enable.port->name);
|
LOG_ERR("%s: enable GPIO is not ready", dev->name);
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -441,6 +441,11 @@ static int tle9104_init(const struct device *dev)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (config->gpio_reset.port != NULL) {
|
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);
|
result = gpio_pin_configure_dt(&config->gpio_reset, GPIO_OUTPUT_ACTIVE);
|
||||||
if (result != 0) {
|
if (result != 0) {
|
||||||
LOG_ERR("failed to initialize GPIO for reset");
|
LOG_ERR("failed to initialize GPIO for reset");
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue