diff options
author | Tom Rini <trini@konsulko.com> | 2023-10-24 19:12:21 -0400 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2023-10-24 19:12:21 -0400 |
commit | fb428b61819444b9337075f49c72f326f5d12085 (patch) | |
tree | 59ad3b6c3df52508641f485591d5af5029b02d9a /drivers/serial/serial-uclass.c | |
parent | 5cab3515f8c9796015739c1750b8933291c816be (diff) | |
parent | 35dc728a3cd14338b5fa0b6f231aa555077c98a1 (diff) |
Merge branch '2023-10-24-assorted-general-fixes-and-updates'
- Remove common.h in a number of places and make checkpatch.pl complain
about its use in all cases, allow the mbr command to handle 4 primary
partitions, fix an issue with the pstore command, fix a problem with
cli parsing of escape sequences, remove and ignore more files, allow
for the serial port to be flushed with every print (for debugging),
and add SCMI power domain support.
Diffstat (limited to 'drivers/serial/serial-uclass.c')
-rw-r--r-- | drivers/serial/serial-uclass.c | 28 |
1 files changed, 16 insertions, 12 deletions
diff --git a/drivers/serial/serial-uclass.c b/drivers/serial/serial-uclass.c index 4a2da7a331..df6a387284 100644 --- a/drivers/serial/serial-uclass.c +++ b/drivers/serial/serial-uclass.c @@ -182,6 +182,16 @@ int serial_initialize(void) return serial_init(); } +static void _serial_flush(struct udevice *dev) +{ + struct dm_serial_ops *ops = serial_get_ops(dev); + + if (!ops->pending) + return; + while (ops->pending(dev, false) > 0) + ; +} + static void _serial_putc(struct udevice *dev, char ch) { struct dm_serial_ops *ops = serial_get_ops(dev); @@ -193,6 +203,9 @@ static void _serial_putc(struct udevice *dev, char ch) do { err = ops->putc(dev, ch); } while (err == -EAGAIN); + + if (IS_ENABLED(CONFIG_CONSOLE_FLUSH_ON_NEWLINE) && ch == '\n') + _serial_flush(dev); } static int __serial_puts(struct udevice *dev, const char *str, size_t len) @@ -231,22 +244,13 @@ static void _serial_puts(struct udevice *dev, const char *str) if (*newline && __serial_puts(dev, "\r\n", 2)) return; + if (IS_ENABLED(CONFIG_CONSOLE_FLUSH_ON_NEWLINE) && *newline) + _serial_flush(dev); + str += len + !!*newline; } while (*str); } -#ifdef CONFIG_CONSOLE_FLUSH_SUPPORT -static void _serial_flush(struct udevice *dev) -{ - struct dm_serial_ops *ops = serial_get_ops(dev); - - if (!ops->pending) - return; - while (ops->pending(dev, false) > 0) - ; -} -#endif - static int __serial_getc(struct udevice *dev) { struct dm_serial_ops *ops = serial_get_ops(dev); |