This is an automated email from the ASF dual-hosted git repository. xiaoxiang781216 pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/nuttx.git
commit cc63cb425cbb49447f9fada1c1ac9e2e3c8c96d1 Author: chenzihan1 <[email protected]> AuthorDate: Fri Dec 12 15:58:52 2025 +0800 drivers/syslog/syslog_rpmsg: remove the flush operation syslog_rpmsg_flush() printed the unsent part of the buffer through up_nputs() and then switched the channel for good: every later message was printed the same way and no longer scheduled for transfer to the remote core. Remove it, and with it the flush index, so that messages always stay in the buffer for the remote core. The rpmsg channel no longer prints its buffer to the local console when syslog is flushed (for example on panic). Signed-off-by: chenzihan1 <[email protected]> Signed-off-by: Bowen Wang <[email protected]> --- drivers/syslog/syslog_channel.c | 2 +- drivers/syslog/syslog_rpmsg.c | 52 +------------------------------------ include/nuttx/syslog/syslog_rpmsg.h | 1 - 3 files changed, 2 insertions(+), 53 deletions(-) diff --git a/drivers/syslog/syslog_channel.c b/drivers/syslog/syslog_channel.c index e25b0e2d5c0..b6642b45113 100644 --- a/drivers/syslog/syslog_channel.c +++ b/drivers/syslog/syslog_channel.c @@ -106,7 +106,7 @@ static const struct syslog_channel_ops_s g_rpmsg_channel_ops = { syslog_rpmsg_putc, syslog_rpmsg_putc, - syslog_rpmsg_flush, + NULL, syslog_rpmsg_write, syslog_rpmsg_write }; diff --git a/drivers/syslog/syslog_rpmsg.c b/drivers/syslog/syslog_rpmsg.c index 3bab3ce6af4..aa8f6c06a7c 100644 --- a/drivers/syslog/syslog_rpmsg.c +++ b/drivers/syslog/syslog_rpmsg.c @@ -59,7 +59,6 @@ #define SYSLOG_RPMSG_SPACE(p) ((p)->size - 1 - SYSLOG_RPMSG_COUNT(p)) #define SYSLOG_RPMSG_HEADOFF(p) ((p)->head & ((p)->size -1)) #define SYSLOG_RPMSG_TAILOFF(p) ((p)->tail & ((p)->size -1)) -#define SYSLOG_RPMSG_FLUSHOFF(p) ((p)->flush & ((p)->size -1)) /**************************************************************************** * Private Types @@ -69,7 +68,6 @@ struct syslog_rpmsg_s { volatile size_t head; /* The head index (where data is added) */ volatile size_t tail; /* The tail index (where data is removed) */ - volatile size_t flush; /* The tail index of flush (where data is removed) */ size_t size; /* Size of the RAM buffer */ FAR char *buffer; /* Circular RAM buffer */ struct work_s work; /* Used for deferred callback work */ @@ -225,7 +223,7 @@ static void syslog_rpmsg_addbuf(FAR struct syslog_rpmsg_s *priv, { bool ret = false; - if (!priv->flush && !up_interrupt_context() && !sched_idletask()) + if (!up_interrupt_context() && !sched_idletask()) { /* Unlock before entering syslog_rpmsg_transfer, * it is already locked internally @@ -263,16 +261,6 @@ static void syslog_rpmsg_addbuf(FAR struct syslog_rpmsg_s *priv, priv->tail++; } - if (priv->flush) - { - priv->flush += len; - spin_unlock_irqrestore(&priv->lock, flags); -#if defined(CONFIG_ARCH_LOWPUTC) && !defined(CONFIG_SYSLOG_DEFAULT) - up_nputs(buffer, len); -#endif - return; - } - if (!priv->suspend && is_rpmsg_ept_ready(&priv->ept)) { clock_t delay = SYSLOG_RPMSG_WORK_DELAY; @@ -402,44 +390,6 @@ int syslog_rpmsg_putc(FAR syslog_channel_t *channel, int ch) return ch; } -int syslog_rpmsg_flush(FAR syslog_channel_t *channel) -{ - FAR struct syslog_rpmsg_s *priv = &g_syslog_rpmsg; - irqstate_t flags; - size_t remaining; - size_t len; - size_t off; - - flags = spin_lock_irqsave(&priv->lock); - - if (priv->head > priv->flush && - priv->head - priv->flush > priv->size) - { - priv->flush = priv->tail; - } - - UNUSED(remaining); - len = priv->head - priv->flush; - off = SYSLOG_RPMSG_FLUSHOFF(priv); - remaining = priv->size - off; - priv->flush += len; - spin_unlock_irqrestore(&priv->lock, flags); - -#if defined(CONFIG_ARCH_LOWPUTC) && !defined(CONFIG_SYSLOG_DEFAULT) - if (len > 0 && len > remaining) - { - up_nputs(&priv->buffer[off], remaining); - up_nputs(priv->buffer, len - remaining); - } - else if (len > 0) - { - up_nputs(&priv->buffer[off], len); - } -#endif - - return OK; -} - ssize_t syslog_rpmsg_write(FAR syslog_channel_t *channel, FAR const char *buffer, size_t buflen) { diff --git a/include/nuttx/syslog/syslog_rpmsg.h b/include/nuttx/syslog/syslog_rpmsg.h index 758a3b5bf38..3eeb187ab53 100644 --- a/include/nuttx/syslog/syslog_rpmsg.h +++ b/include/nuttx/syslog/syslog_rpmsg.h @@ -44,7 +44,6 @@ void syslog_rpmsg_init_early(FAR void *buffer, size_t size); int syslog_rpmsg_init(void); int syslog_rpmsg_putc(FAR syslog_channel_t *channel, int ch); -int syslog_rpmsg_flush(FAR syslog_channel_t *channel); ssize_t syslog_rpmsg_write(FAR syslog_channel_t *channel, FAR const char *buffer, size_t buflen); #endif
