iodev: Move primary core check into iodev, always use in_iodev logic

Signed-off-by: Hector Martin <marcan@marcan.st>
This commit is contained in:
Hector Martin 2021-04-17 16:27:38 +09:00
parent 303118fd93
commit 565753980a
2 changed files with 5 additions and 12 deletions

View file

@ -211,8 +211,6 @@ ssize_t fb_console_write(const char *bfr, size_t len)
{
ssize_t wrote = 0;
if (!is_primary_core())
return 0;
if (!console.initialized)
return 0;

View file

@ -59,19 +59,16 @@ ssize_t iodev_write(iodev_id_t id, const void *buf, size_t length)
return iodevs[id]->ops->write(iodevs[id]->opaque, buf, length);
}
#ifdef DEBUG_IODEV
bool in_iodev = false;
#endif
int in_iodev = 0;
void iodev_console_write(const void *buf, size_t length)
{
#ifdef DEBUG_IODEV
if (in_iodev) {
if (in_iodev || !is_primary_core()) {
iodev_write(IODEV_UART, "*", 1);
iodev_write(IODEV_UART, buf, length);
return;
}
in_iodev = true;
#endif
in_iodev++;
dprintf(" iodev_console_write() wp=%d\n", con_wp);
for (iodev_id_t id = 0; id < IODEV_MAX; id++) {
@ -137,7 +134,5 @@ void iodev_console_write(const void *buf, size_t length)
length -= block;
}
#ifdef DEBUG_IODEV
in_iodev = false;
#endif
in_iodev--;
}