lkml.org 
[lkml]   [2021]   [Sep]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH] lib/vsprintf: add __putchar()
On Fri, Sep 3, 2021 at 7:02 PM Yury Norov <yury.norov@gmail.com> wrote:
> On Fri, Sep 03, 2021 at 10:56:07AM -0400, Steven Rostedt wrote:
> > On Sun, 29 Aug 2021 16:36:13 +0300
> > Andy Shevchenko <andriy.shevchenko@linux.intel.com> wrote:
> > > On Fri, Aug 27, 2021 at 10:11:55AM -0700, Yury Norov wrote:

...

> > > > There are 26 occurrences of the code snippet like this in the file :
> > > > if (buf < end)
> > > > *buf = separator;
> > > > ++buf;
> > > >
> > > > This patch adds a helper function __putchar() to replace opencoding.
> > > > It adds a lot to readability, and also saves 43 bytes of text on x86.
> > >
> > > Last time I tried similar it failed the compilation.
> > >
> > > Anyway, while you remove a lot of code I'm not sure it makes the code better
> > > to read and understand. Also, we use the same idiom outside of this file.
> > >
> > > I would ask Rasmus' opinion on this.
> > >
> >
> > I actually like the clean up, although I haven't reviewed the entire patch.
>
> Thanks.
>
> > If it is used outside this file, perhaps it should be in a header instead
> > and those other locations should be updated accordingly.
>
> I used 'grep "buf < end"' to find spots for cleanup.

You need a "smart" grep, i.e. coccinelle for that.

> And except for
> lib/vsprintf.c, there is a few random drivers inappropriate for this
> cleanup. Andy, can you please share details?

https://elixir.bootlin.com/linux/latest/source/lib/string_helpers.c#L307

--
With Best Regards,
Andy Shevchenko

\
 
 \ /
  Last update: 2021-09-03 21:49    [W:0.049 / U:0.940 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site