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