Re: [PATCH 00/49] DRM driver for Hikey 970

From: Mauro Carvalho Chehab
Date: Mon Aug 24 2020 - 12:06:18 EST


Em Fri, 21 Aug 2020 17:56:50 +0200
Sam Ravnborg <sam@xxxxxxxxxxxx> escreveu:

> Hi Mauro.
>
> On Fri, Aug 21, 2020 at 04:41:58PM +0200, Mauro Carvalho Chehab wrote:
> > Another quick question:
> >
> > Em Wed, 19 Aug 2020 19:35:58 +0200
> > Sam Ravnborg <sam@xxxxxxxxxxxx> escreveu:
> >
> > > > +#define DSS_REDUCE(x) ((x) > 0 ? ((x) - 1) : (x))
> > > Use generic macros for this?
> >
> > Do you know a generic macro similar to this? Or do you mean adding
> > it to include/kernel.h?
>
> It looked like something there should be a macro for.
> But I do not know one.
>
> And no, do not try to go the kernel.h route on this.
> At least not until you see more than one user.

Yeah, adding this to kernel.h just for a single usage is overkill. I would
be expecting that a non-underflow decrement logic is something that
would be used on other places at the Kernel, but identifying this
pattern would require some time. Maybe Kernel janitors could write some
coccinelle script to replace similar patterns like that into some
macro in the future.

Thanks,
Mauro