Re: [PATCH 03/13] spi: cadence-qspi: Fix style and improve readability
From: Miquel Raynal
Date: Wed Jan 14 2026 - 11:07:37 EST
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