<Amisha.Patel@xxxxxxxxxxxxx> writes: > From: Amisha Patel <amisha.patel@xxxxxxxxxxxxx> > > In some situations like, chip wake-up with powersave enabled, SPI > commands are failing temporarily. Reissuing commands after reset helps > to overcome the failure. So, add the retry limit and reset command > sequence API for read/write SPI commands. > > Signed-off-by: Amisha Patel <amisha.patel@xxxxxxxxxxxxx> [...] > +retry: > result = wilc_spi_single_read(wilc, cmd, addr, data, clockless); > if (result) { > dev_err(&spi->dev, "Failed cmd, read reg (%08x)...\n", addr); > - return result; > + > + /* retry is not applicable for clockless registers */ > + if (clockless || !retry_limit) > + return result; > + > + wilc_spi_reset_cmd_sequence(wilc, retry_limit, addr); > + retry_limit--; > + goto retry; > } A for loop is recommended over a goto loop. Also in this case I find 'retry_limit == 0' more readable than '!retry_limit', it's a counter anyway. -- https://patchwork.kernel.org/project/linux-wireless/list/ https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches