syslog/rpmsg: Fix warning: ‘syslog_rpmsg_write’ defined but not used

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
This commit is contained in:
Xiang Xiao 2020-04-27 12:15:11 +08:00
parent 32597a763a
commit e9773addfa
3 changed files with 30 additions and 28 deletions

View File

@ -90,7 +90,8 @@ static const struct syslog_channel_s g_default_channel =
{
syslog_rpmsg_putc,
syslog_rpmsg_putc,
syslog_default_flush
syslog_rpmsg_flush,
syslog_rpmsg_write
};
#elif defined(HAVE_LOWPUTC)
static const struct syslog_channel_s g_default_channel =

View File

@ -90,8 +90,6 @@ struct syslog_rpmsg_s
static void syslog_rpmsg_work(FAR void *priv_);
static void syslog_rpmsg_putchar(FAR struct syslog_rpmsg_s *priv, int ch,
bool last);
static int syslog_rpmsg_flush(void);
static ssize_t syslog_rpmsg_write(FAR const char *buffer, size_t buflen);
static void syslog_rpmsg_device_created(FAR struct rpmsg_device *rdev,
FAR void *priv_);
static void syslog_rpmsg_device_destroy(FAR struct rpmsg_device *rdev,
@ -220,31 +218,6 @@ static void syslog_rpmsg_putchar(FAR struct syslog_rpmsg_s *priv, int ch,
}
}
static int syslog_rpmsg_flush(void)
{
FAR struct syslog_rpmsg_s *priv = &g_syslog_rpmsg;
work_queue(HPWORK, &priv->work, syslog_rpmsg_work, priv, 0);
return OK;
}
static ssize_t syslog_rpmsg_write(FAR const char *buffer, size_t buflen)
{
FAR struct syslog_rpmsg_s *priv = &g_syslog_rpmsg;
irqstate_t flags;
size_t nwritten;
flags = enter_critical_section();
for (nwritten = 1; nwritten <= buflen; nwritten++)
{
syslog_rpmsg_putchar(priv, *buffer++, nwritten == buflen);
}
leave_critical_section(flags);
return buflen;
}
static void syslog_rpmsg_device_created(FAR struct rpmsg_device *rdev,
FAR void *priv_)
{
@ -352,6 +325,31 @@ int syslog_rpmsg_putc(int ch)
return ch;
}
int syslog_rpmsg_flush(void)
{
FAR struct syslog_rpmsg_s *priv = &g_syslog_rpmsg;
work_queue(HPWORK, &priv->work, syslog_rpmsg_work, priv, 0);
return OK;
}
ssize_t syslog_rpmsg_write(FAR const char *buffer, size_t buflen)
{
FAR struct syslog_rpmsg_s *priv = &g_syslog_rpmsg;
irqstate_t flags;
size_t nwritten;
flags = enter_critical_section();
for (nwritten = 1; nwritten <= buflen; nwritten++)
{
syslog_rpmsg_putchar(priv, *buffer++, nwritten == buflen);
}
leave_critical_section(flags);
return buflen;
}
void syslog_rpmsg_init_early(FAR const char *cpuname, FAR void *buffer,
size_t size)
{

View File

@ -59,7 +59,10 @@ extern "C"
void syslog_rpmsg_init_early(FAR const char *cpu_name, FAR void *buffer,
size_t size);
int syslog_rpmsg_init(void);
int syslog_rpmsg_putc(int ch);
int syslog_rpmsg_flush(void);
ssize_t syslog_rpmsg_write(FAR const char *buffer, size_t buflen);
#endif
#ifdef CONFIG_SYSLOG_RPMSG_SERVER