[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <bea11e83-2c26-57b5-1a42-8ce852dc26ba@ti.com>
Date: Wed, 14 Jul 2021 18:24:28 +0530
From: "Nandan, Apurva" <a-nandan@...com>
To: Mark Brown <broonie@...nel.org>
CC: <linux-spi@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
Pratyush Yadav <p.yadav@...com>,
Vignesh Raghavendra <vigneshr@...com>
Subject: Re: [EXTERNAL] Re: [PATCH 2/2] spi: cadence-quadspi: Fix check
condition for DTR ops
On 14-Jul-21 12:09 AM, Mark Brown wrote:
> On Tue, Jul 13, 2021 at 12:57:42PM +0000, Apurva Nandan wrote:
>
>> + f_pdata->dtr = op->cmd.dtr &&
>> + (op->addr.dtr || !op->addr.nbytes) &&
>> + (op->data.dtr || !op->data.nbytes);
>
> I'm not sure anyone reading this code is going to figure out what it's
> doing without thinking about it, the combination of writing the bytes
> check with a !, putting it after the check for .dtr and not having any
> comments is a bit obscure. Something like
>
> (op->addr.nbytes && op.addr.dtr)
>
> might be a bit clearer, or a comment explicitly spelling it out.
>
Okay, I will add a comment explaining it, as other logic (with &&) won't
deliver the behavior we expect.
The logic it implements is: for an op to be dtr, if any phase has
non-zero bytes, it must have dtr field set as true. So, it does p
implies q: p->q = (!p || q) i.e. if phase has non-zero bytes (p) then
check its dtr field (q). If all phases are empty, then follow what
op.cmd.dtr says.
Regards,
Apurva Nandan
Powered by blists - more mailing lists