From: Kalle Valo <kvalo@kernel.org>
To: <Amisha.Patel@microchip.com>
Cc: <linux-wireless@vger.kernel.org>, <Ajay.Kathat@microchip.com>,
<Claudiu.Beznea@microchip.com>
Subject: Re: [PATCH v2] wifi: wilc1000: add SPI commands retry mechanism
Date: Wed, 21 Jun 2023 12:32:36 +0300 [thread overview]
Message-ID: <87zg4tdutn.fsf@kernel.org> (raw)
In-Reply-To: <20230614203215.9652-1-amisha.patel@microchip.com> (Amisha Patel's message of "Wed, 14 Jun 2023 20:32:46 +0000")
<Amisha.Patel@microchip.com> writes:
> From: Amisha Patel <amisha.patel@microchip.com>
>
> 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@microchip.com>
[...]
> +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
prev parent reply other threads:[~2023-06-21 9:35 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-14 20:32 [PATCH v2] wifi: wilc1000: add SPI commands retry mechanism Amisha.Patel
2023-06-21 9:32 ` Kalle Valo [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87zg4tdutn.fsf@kernel.org \
--to=kvalo@kernel.org \
--cc=Ajay.Kathat@microchip.com \
--cc=Amisha.Patel@microchip.com \
--cc=Claudiu.Beznea@microchip.com \
--cc=linux-wireless@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.