Re: [PATCH] staging: most: dim2: force fcnt=3 on Renesas GEN3

From: Greg Kroah-Hartman
Date: Mon Sep 27 2021 - 11:51:01 EST


On Mon, Sep 27, 2021 at 06:40:13PM +0300, Nikita Yushchenko wrote:
> > > + dev_fcnt = pdata && pdata->fcnt ? pdata->fcnt : fcnt;
> >
> > Please use a real if () statement here and do not bury real logic in a
> > crazy line like this one, as that is all but impossible to maintain over
> > time.
>
> The same source file already uses the same form of conditional expressions several lines above:
>
> > ret = pdata && pdata->enable ? pdata->enable(pdev) : 0;

It's not good there either.

There is a reason this code is still in drivers/staging/ and that is one
of them. Let's not duplicate bad code for no real reason please.

> > dev->disable_platform = pdata ? pdata->disable : NULL;
>
> Shall I use real if statement for my expression while keeping those as-is? This looks ... strange.
> Or shall I convert all conditional expressions to if statements?

Do not add additional ? : statements in this patch. I would be glad to
take an add-on patch after this that fixes up the other uses in the
driver, but that should be separate as that is a separate issue here.

thanks,

greg k-h