lkml.org 
[lkml]   [2020]   [Mar]   [2]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    SubjectRe: misc nits Re: [PATCH 1/2] printk: add lockless buffer
    From
    Date
    On Mon, 2020-03-02 at 11:38 +0100, John Ogness wrote:
    > On 2020-02-21, Petr Mladek <pmladek@suse.com> wrote:
    > > > diff --git a/kernel/printk/printk_ringbuffer.c b/kernel/printk/printk_ringbuffer.c
    []
    > > > +static struct prb_data_block *to_block(struct prb_data_ring *data_ring,
    > > > + unsigned long begin_lpos)
    > > > +{
    > > > + char *data = &data_ring->data[DATA_INDEX(data_ring, begin_lpos)];
    > > > +
    > > > + return (struct prb_data_block *)data;
    > >
    > > Nit: Please, use "blk" instead of "data". I was slightly confused
    > > because "data" is also one member of struct prb_data_block.
    >
    > OK.

    trivia:

    Perhaps use void * instead of char * and a direct return
    and avoid the naming altogether.

    static struct prb_data_block *to_block(struct prb_data_ring *data_ring,
    unsigned long begin_lpos)
    {
    return (void *)&data_ring->data[DATA_INDEX(data_ring, begin_lpos)];
    }

    \
     
     \ /
      Last update: 2020-03-02 13:19    [W:2.568 / U:0.096 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site