From: Kalle Valo <kvalo@qca.qualcomm.com>
To: Michal Kazior <michal.kazior@tieto.com>
Cc: linux-wireless <linux-wireless@vger.kernel.org>,
"ath10k@lists.infradead.org" <ath10k@lists.infradead.org>
Subject: Re: [PATCH 1/8] ath10k: cleanup ath10k_pci_wait_for_target_init()
Date: Wed, 26 Mar 2014 11:28:14 +0200 [thread overview]
Message-ID: <87lhvxz4up.fsf@kamboji.qca.qualcomm.com> (raw)
In-Reply-To: <CA+BoTQns9QXCctzrMzd5=o6EyA=d0TG-eLJw3hztE1-MD7HwkQ@mail.gmail.com> (Michal Kazior's message of "Tue, 25 Mar 2014 10:32:49 +0100")
Michal Kazior <michal.kazior@tieto.com> writes:
> On 25 March 2014 10:15, Kalle Valo <kvalo@qca.qualcomm.com> wrote:
>> ath10k_pci_wait_for_target_init() did really follow the style used elsewhere in
>> ath10k. Use ath10k_pci_read/write() wrappers, simplify the while loop and
>> improve warning messages.
>>
>> Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
>> ---
>> drivers/net/wireless/ath/ath10k/pci.c | 33 ++++++++++++++++++++-------------
>> 1 file changed, 20 insertions(+), 13 deletions(-)
>>
>> diff --git a/drivers/net/wireless/ath/ath10k/pci.c b/drivers/net/wireless/ath/ath10k/pci.c
>> index 9d242d801d9d..0425c76daf3f 100644
>> --- a/drivers/net/wireless/ath/ath10k/pci.c
>> +++ b/drivers/net/wireless/ath/ath10k/pci.c
>> @@ -2385,30 +2385,37 @@ static int ath10k_pci_deinit_irq(struct ath10k *ar)
>> static int ath10k_pci_wait_for_target_init(struct ath10k *ar)
>> {
>> struct ath10k_pci *ar_pci = ath10k_pci_priv(ar);
>> - int wait_limit = 300; /* 3 sec */
>> + const int wait = 3000; /* ms */
>
> We probably should have a #define for this.
Yeah, I'll change that.
>> - while (wait_limit-- &&
>> - !(ioread32(ar_pci->mem + FW_INDICATOR_ADDRESS) &
>> - FW_IND_INITIALIZED)) {
>> + timeout = jiffies + msecs_to_jiffies(wait);
>> +
>> + do {
>> + val = ath10k_pci_read32(ar, FW_INDICATOR_ADDRESS);
>> + if (val == FW_IND_INITIALIZED)
>> + break;
>> +
>
> It might be worth to add:
>
> if (val == 0xFFFFFFFF)
> return -EIO;
What does receiving 0xFFFFFFFF mean here? PCI bus kaput?
Do we really want to stop trying after receiving that? What harm would
it cause to keep on trying? We would return an error anyway after the
timeout, right?
>> + } while (time_before(jiffies, timeout));
>>
>> - if (wait_limit < 0) {
>> - ath10k_err("target stalled\n");
>> - ret = -EIO;
>> + if (val != FW_IND_INITIALIZED) {
>> + ath10k_err("failed to receive initialized event from target after %d ms: %d\n",
>> + wait, val);
>
> `val` is u32 so it shouldn't be %d. %08x makes most sense I guess.
I'll change it.
Thanks for the review!
--
Kalle Valo
next prev parent reply other threads:[~2014-03-26 9:28 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-03-25 9:14 [PATCH 0/8] ath10k: small cleanups to pci.c Kalle Valo
2014-03-25 9:15 ` [PATCH 1/8] ath10k: cleanup ath10k_pci_wait_for_target_init() Kalle Valo
2014-03-25 9:32 ` Michal Kazior
2014-03-26 9:28 ` Kalle Valo [this message]
2014-03-26 9:52 ` Michal Kazior
2014-03-26 11:10 ` Kalle Valo
2014-03-25 9:15 ` [PATCH 2/8] ath10k: add module parameter to disable cold reset Kalle Valo
2014-03-25 9:15 ` [PATCH 3/8] ath10k: fix name of target_ps module parameter Kalle Valo
2014-03-25 9:15 ` [PATCH 4/8] ath10k: advertise only firmware API 2 files Kalle Valo
2014-03-25 9:15 ` [PATCH 5/8] ath10k: delete ar_pci->fw_indicator_address Kalle Valo
2014-03-25 9:15 ` [PATCH 6/8] ath10k: improve pci debug messages Kalle Valo
2014-03-25 9:15 ` [PATCH 7/8] ath10k: add module parameter values to the pci info print Kalle Valo
2014-03-25 9:15 ` [PATCH 8/8] ath10k: print chip id during boot Kalle Valo
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=87lhvxz4up.fsf@kamboji.qca.qualcomm.com \
--to=kvalo@qca.qualcomm.com \
--cc=ath10k@lists.infradead.org \
--cc=linux-wireless@vger.kernel.org \
--cc=michal.kazior@tieto.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox