Re: [PATCH v2 3/4] i2c: imx: Simplify stopped state tracking

From: Uwe Kleine-König
Date: Fri Aug 10 2018 - 08:25:35 EST


Hello Esben,

On Fri, Aug 10, 2018 at 11:25:34AM +0200, Esben Haabendal wrote:
> Uwe Kleine-König <u.kleine-koenig@xxxxxxxxxxxxxx> writes:
> > Currently you have:
> >
> > if (for_busy && (temp & I2SR_IBB)) {
> > i2c_imx->stopped = 0;
> > break;
> > }
> >
> > if (!for_busy && !(temp & I2SR_IBB)) {
> > i2c_imx->stopped = 1;
> > break;
> > }
> >
> > The semantic of this is the same (apart from always updating .stopped)
> > but is imho easier:
> >
> > i2c_imx->stopped = !(temp & I2SR_IBB);
> >
> > if (for_busy != i2c_imx->stopped)
> > break;
>
> Yes, that should work also.
> Shorter, but IMHO a bit more convoluted to read.
> Let me know if I should send a new version with this change.

unless someone else chimes in I'd say keep it as is. I'd prefer my
variant, but I accept that this is something subjective.

Best regards
Uwe

--
Pengutronix e.K. | Uwe Kleine-König |
Industrial Linux Solutions | http://www.pengutronix.de/ |