rpmsg/rpmsg_port: judge notify_rx_free and notify_tx_ready before calling

Some lower layers do not need implement these two operations, so judge
them before calling.

Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
This commit is contained in:
Bowen Wang 2024-06-04 22:14:45 +08:00 committed by Xiang Xiao
parent d27a9c516f
commit a662c7aab3
1 changed files with 8 additions and 2 deletions

View File

@ -281,7 +281,10 @@ static int rpmsg_port_send_offchannel_nocopy(FAR struct rpmsg_device *rdev,
sizeof(struct rpmsg_hdr) + len;
rpmsg_port_queue_add_buffer(&port->txq, hdr);
port->ops->notify_tx_ready(port);
if (port->ops->notify_tx_ready)
{
port->ops->notify_tx_ready(port);
}
return len;
}
@ -340,7 +343,10 @@ static void rpmsg_port_release_rx_buffer(FAR struct rpmsg_device *rdev,
if ((reserved & RPMSG_BUF_HELD_MASK) == (1 << RPMSG_BUF_HELD_SHIFT))
{
rpmsg_port_queue_return_buffer(&port->rxq, hdr);
port->ops->notify_rx_free(port);
if (port->ops->notify_rx_free)
{
port->ops->notify_rx_free(port);
}
}
}