Re: [PATCH 00/62] Add definition for GPIO direction

andriy.shevchenko
2019-11-05T14:28:36Z

On Tue, Nov 05, 2019 at 02:40:26PM +0100, Uwe Kleine-König wrote:
> On Tue, Nov 05, 2019 at 03:30:25PM +0200, andriy.shevchenko@linux.intel.com wrote:
> > On Tue, Nov 05, 2019 at 02:10:38PM +0100, Uwe Kleine-König wrote:
> > > On Tue, Nov 05, 2019 at 12:54:55PM +0000, Vaittinen, Matti wrote:
> > > > On Tue, 2019-11-05 at 14:20 +0200, Andy Shevchenko wrote:
> > > > > I would also like to see bloat-o-meter statistics before and after
> > > > > your patch.
> > > > > My guts tell me that the result will be not in the favour of yours
> > > > > solution.
> > > >
> > > > Can you please tell me what type of stats you hope to see? I can try
> > > > generating what you are after. The cover letter contained typical +/-
> > > > change stats from git and summary:
> > > >
> > > > 62 files changed, 228 insertions(+), 104 deletions(-)
> > >
> > > I guess he wants to see
> > >
> > > scripts/bloat-o-meter vmlinuz.old vmlinuz
> >
> > Yes, but be sure you have compiled them all and build them all in.
> > Otherwise you might get wrong result.
> >
> > > . I would expect a 0 there. I didn't look in detail, but in general I
> > > like the idea to give 0 and 1 a symbolic name.
> >
> > I'll will be fine with that if and only if maintainers are okay. For now,
> > I don't like the idea to trade bad for worse.
>
> I don't see you concern.
>
> int somefunction(...)
> {
> return 1;
> }
>
> is definitively worse than
>
> int somefunction(...)
> {
> return GPIO_LINE_DIRECTION_IN;
> }
>
> and after cpp had its go on the source the compiler sees the exact same
> thing, so I don't expect any size changes. The only change is that to
> write (or understand) the above code, you have to know that 1
> corresponds to GPIO input (or was it output?) while in the later
> function it is obvious that we're talking about an input.

In almost all cases I'm involved in the original code is different:

return !!foo();

vs.

if (foo())
return A;
return B;

--
With Best Regards,
Andy Shevchenko