[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <87wm1kuqik.fsf@bootlin.com>
Date: Wed, 14 Jan 2026 17:07:31 +0100
From: Miquel Raynal <miquel.raynal@...tlin.com>
To: Pratyush Yadav <pratyush@...nel.org>
Cc: Mark Brown <broonie@...nel.org>, Rob Herring <robh@...nel.org>,
Krzysztof Kozlowski <krzk+dt@...nel.org>, Conor Dooley
<conor+dt@...nel.org>, Geert Uytterhoeven <geert+renesas@...der.be>,
Magnus Damm <magnus.damm@...il.com>, Vaishnav Achath
<vaishnav.a@...com>, Thomas Petazzoni <thomas.petazzoni@...tlin.com>,
Hervé Codina <herve.codina@...tlin.com>, Wolfram Sang
<wsa+renesas@...g-engineering.com>, Vignesh Raghavendra
<vigneshr@...com>, Santhosh Kumar K <s-k6@...com>, Pascal Eberhard
<pascal.eberhard@...com>, linux-spi@...r.kernel.org,
devicetree@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-renesas-soc@...r.kernel.org
Subject: Re: [PATCH 03/13] spi: cadence-qspi: Fix style and improve readability
Hi Pratyush,
>> + } else {
>> + if (!cqspi->slow_sram)
>> + irq_status &= CQSPI_IRQ_MASK_RD | CQSPI_IRQ_MASK_WR;
>> + else
>> + irq_status &= CQSPI_REG_IRQ_WATERMARK | CQSPI_IRQ_MASK_WR;
>> }
>>
>> - else if (!cqspi->slow_sram)
>> - irq_status &= CQSPI_IRQ_MASK_RD | CQSPI_IRQ_MASK_WR;
>> - else
>> - irq_status &= CQSPI_REG_IRQ_WATERMARK | CQSPI_IRQ_MASK_WR;
>> -
>
> I suppose you can further simplify the if-else chain to:
>
>
> if (cqspi->use_dma_read && ddata && ddata->get_dma_status) {
> irq_status = ddata->get_dma_status(cqspi);
> else if (cqspi->slow_sram)
> irq_status &= CQSPI_REG_IRQ_WATERMARK | CQSPI_IRQ_MASK_WR;
> else
> irq_status &= CQSPI_IRQ_MASK_RD | CQSPI_IRQ_MASK_WR;
>
> if (irq_status)
> complete(&cqspi->transfer_complete);
>
> return IRQ_HANDLED;
>
> Note that I swapped the latter two if statements to get rid of the
> unnecessary negation of slow_sram. I suppose the overloading of
> irq_status isn't the nicest thing, but I still find this easier to
> read.
I'm fine with this approach too, I'll take it!
Thanks for the proposal.
Miquèl
Powered by blists - more mailing lists