lkml.org 
[lkml]   [2020]   [Nov]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 4/9] relay: allow the use of const callback structs
> +/* subbuf_start callback wrapper */
> +static int cb_subbuf_start(struct rchan_buf *buf, void *subbuf,
> + void *prev_subbuf, size_t prev_padding)

I don't think the comment adds any information over just looking at the
function and the two callers. I'd also name it relay_subbuf_start
instead of the cb_ prefix not used anywhere else in the file.


> {
> + if (buf->chan->cb->subbuf_start)
> + return buf->chan->cb->subbuf_start(buf, subbuf,
> + prev_subbuf, prev_padding);
> +
> if (relay_buf_full(buf))
> return 0;

This could also be simplified a bit more to:

if (!buf->chan->cb->subbuf_start)
return !relay_buf_full(buf);
return buf->chan->cb->subbuf_start(buf, subbuf, prev_subbuf,
prev_padding);

Otherwise this looks good to me:

Reviewed-by: Christoph Hellwig <hch@lst.de>

\
 
 \ /
  Last update: 2020-11-24 11:10    [W:0.207 / U:0.500 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site