command: Don't pass max_size to command_encodef()

The command_encodef() can read the max_size parameter directly from
the 'struct command_encoder' passed into it.  Also, there is no need
to check that a message will fit in a buffer if the buffer is declared
to be MESSAGE_MAX in size.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
Kevin O'Connor
2017-08-13 16:48:27 -04:00
parent f3da473285
commit f8bd8b97be
7 changed files with 24 additions and 29 deletions

View File

@@ -135,14 +135,13 @@ void
console_sendf(const struct command_encoder *ce, va_list args)
{
// Verify space for message
uint32_t max_size = ce->max_size;
uint32_t send_push_pos = SHARED_MEM->send_push_pos;
struct shared_response_buffer *s = &SHARED_MEM->send_data[send_push_pos];
if (max_size > sizeof(s->data) || readl(&s->count))
if (readl(&s->count))
return;
// Generate message
uint32_t msglen = command_encodef(s->data, max_size, ce, args);
uint32_t msglen = command_encodef(s->data, ce, args);
// Signal PRU0 to transmit message
writel(&s->count, msglen);