samples: drivers: espi: Ensure sample code thread exits
Fix #32457 by decreasing iterations on failure too. Signed-off-by: Jose Alberto Meza <jose.a.meza.arellano@intel.com>
This commit is contained in:
parent
74d55c6b5e
commit
11cb2e5ec6
2 changed files with 8 additions and 6 deletions
|
@ -45,6 +45,7 @@ struct thread_context {
|
|||
};
|
||||
|
||||
static struct thread_context context;
|
||||
static bool need_temp;
|
||||
#endif
|
||||
|
||||
static struct espi_oob_packet resp_pckt;
|
||||
|
@ -164,8 +165,6 @@ void oob_rx_handler(const struct device *dev, struct espi_callback *cb,
|
|||
}
|
||||
|
||||
|
||||
bool need_temp;
|
||||
|
||||
void temperature_timer(struct k_timer *timer_id)
|
||||
{
|
||||
LOG_WRN("%s", __func__);
|
||||
|
@ -196,19 +195,23 @@ void espihub_thread(void *p1, void *p2, void *p3)
|
|||
LOG_ERR("Incorrect size response");
|
||||
}
|
||||
|
||||
context.cycles--;
|
||||
break;
|
||||
default:
|
||||
LOG_INF("Other host sender %x", sender);
|
||||
}
|
||||
|
||||
} else {
|
||||
LOG_ERR("Failure to retrieve temp %d", ret);
|
||||
}
|
||||
|
||||
/* Decrease cycles in both cases failure/success */
|
||||
context.cycles--;
|
||||
|
||||
if (need_temp) {
|
||||
request_temp(context.espi_dev);
|
||||
need_temp = false;
|
||||
}
|
||||
}
|
||||
|
||||
k_timer_stop(&temp_timer);
|
||||
}
|
||||
#endif /* CONFIG_ESPI_OOB_CHANNEL_RX_ASYNC */
|
||||
|
|
|
@ -14,9 +14,8 @@
|
|||
#include <drivers/spi.h>
|
||||
#include <logging/log_ctrl.h>
|
||||
#include <logging/log.h>
|
||||
#ifdef CONFIG_ESPI_OOB_CHANNEL
|
||||
/* OOB operations will be attempted regardless of channel enabled or not */
|
||||
#include "espi_oob_handler.h"
|
||||
#endif
|
||||
LOG_MODULE_DECLARE(espi, CONFIG_ESPI_LOG_LEVEL);
|
||||
|
||||
/* eSPI flash parameters */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue