Re: [PATCH 1/5] ASoC: sh: rz-ssi: Drop calling rz_ssi_pio_recv() recursively

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 2022-01-10 7:44 PM, Pavel Machek wrote:
Hi!

On 2022-01-10 10:47 AM, Lad Prabhakar wrote:
Instead of recursively calling rz_ssi_pio_recv() use a while loop
to read the samples from RX fifo.

Recursion and loops are means for doing something repeatedly. Could you
specify _why_ such change was made i.e. the conversion from one method
into the other? I bet the code is not being changed for the sake of
changing it, the reason is simply missing in the commit message.

I had feedback from Pavel "recursion is unwelcome in kernel due to
limited stack use." which I did agree with as a result I have come up
with this patch. Also to add this driver will later be used on Renesas
RZ/A2 SoC's which runs with limited memory.

...


Yes, loop is better.

I'd actually do while(true) and avoid using the done variable.

     if (!(!frames_left && fifo_samples >= runtime->channels))
               break;

will do the trick. Better yet, do

     if (frames_left || fifo_samples < runtime->channels)
               break;

because double negation is quite confusing and looks like typo.

You could achieve similar results by enlisting do-while loop. That's my proposal.


Regards,
Czarek



[Index of Archives]     [Linux Samsung SOC]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]

  Powered by Linux