From: Kalle Valo <kvalo@codeaurora.org>
To: <yhchuang@realtek.com>
Cc: <linux-wireless@vger.kernel.org>, <johannes@sipsolutions.net>,
<pkshih@realtek.com>, <tehuang@realtek.com>,
<Larry.Finger@lwfinger.net>, <sgruszka@redhat.com>,
<briannorris@chromium.org>, <gregkh@linuxfoundation.org>
Subject: Re: [PATCH v9 05/14] rtw88: mac files
Date: Tue, 30 Apr 2019 14:48:43 +0300 [thread overview]
Message-ID: <87v9yvpvc4.fsf@kamboji.qca.qualcomm.com> (raw)
In-Reply-To: <1555653004-1795-6-git-send-email-yhchuang@realtek.com> (yhchuang@realtek.com's message of "Fri, 19 Apr 2019 13:49:55 +0800")
<yhchuang@realtek.com> writes:
> From: Yan-Hsuan Chuang <yhchuang@realtek.com>
>
> mac files for Realtek 802.11ac wireless network chips
>
> Reviewed-by: Stanislaw Gruszka <sgruszka@redhat.com>
> Signed-off-by: Yan-Hsuan Chuang <yhchuang@realtek.com>
[...]
> +static int rtw_pwr_cmd_polling(struct rtw_dev *rtwdev,
> + struct rtw_pwr_seq_cmd *cmd)
> +{
> + u8 value;
> + u8 flag = 0;
> + u32 offset;
> + u32 cnt = RTW_PWR_POLLING_CNT;
> +
> + if (cmd->base == RTW_PWR_ADDR_SDIO)
> + offset = cmd->offset | SDIO_LOCAL_OFFSET;
> + else
> + offset = cmd->offset;
> +
> + do {
> + cnt--;
> + value = rtw_read8(rtwdev, offset);
> + value &= cmd->mask;
> + if (value == (cmd->value & cmd->mask))
> + return 0;
> + if (cnt == 0) {
> + if (rtw_hci_type(rtwdev) == RTW_HCI_TYPE_PCIE &&
> + flag == 0) {
> + value = rtw_read8(rtwdev, REG_SYS_PW_CTRL);
> + value |= BIT(3);
> + rtw_write8(rtwdev, REG_SYS_PW_CTRL, value);
> + value &= ~BIT(3);
> + rtw_write8(rtwdev, REG_SYS_PW_CTRL, value);
> + cnt = RTW_PWR_POLLING_CNT;
> + flag = 1;
> + } else {
> + return -EBUSY;
> + }
> + } else {
> + udelay(50);
> + }
> + } while (1);
Never ending loops in kernel are dangerous. I would add some kind of
fail safe to "while (1)", for example max number of loops or some time
based limit.
--
Kalle Valo
next prev parent reply other threads:[~2019-04-30 11:56 UTC|newest]
Thread overview: 40+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-04-19 5:49 [PATCH v9 00/14] rtw88: mac80211 driver for Realtek 802.11ac wireless network chips yhchuang
2019-04-19 5:49 ` [PATCH v9 01/14] rtw88: main files yhchuang
2019-04-30 10:30 ` Kalle Valo
2019-04-30 10:32 ` Kalle Valo
2019-04-30 11:45 ` Kalle Valo
2019-04-30 12:16 ` Kalle Valo
2019-04-19 5:49 ` [PATCH v9 02/14] rtw88: core files yhchuang
2019-04-19 5:49 ` [PATCH v9 03/14] rtw88: hci files yhchuang
2019-04-19 5:49 ` [PATCH v9 04/14] rtw88: trx files yhchuang
2019-04-30 12:45 ` Kalle Valo
2019-05-01 18:18 ` Larry Finger
2019-05-01 18:30 ` Kalle Valo
2019-05-01 20:09 ` Larry Finger
2019-05-02 18:23 ` Brian Norris
2019-04-19 5:49 ` [PATCH v9 05/14] rtw88: mac files yhchuang
2019-04-30 11:48 ` Kalle Valo [this message]
2019-04-19 5:49 ` [PATCH v9 06/14] rtw88: fw and efuse files yhchuang
2019-04-19 5:49 ` [PATCH v9 07/14] rtw88: phy files yhchuang
2019-04-19 5:49 ` [PATCH v9 08/14] rtw88: debug files yhchuang
2019-04-19 5:49 ` [PATCH v9 09/14] rtw88: chip files yhchuang
2019-04-30 10:26 ` Kalle Valo
2019-04-30 12:00 ` Kalle Valo
2019-04-30 12:06 ` Kalle Valo
2019-04-19 5:50 ` [PATCH v9 10/14] rtw88: 8822B init table yhchuang
2019-04-19 5:50 ` [PATCH v9 11/14] rtw88: 8822C " yhchuang
2019-04-19 5:50 ` [PATCH v9 12/14] rtw88: Kconfig & Makefile yhchuang
2019-04-30 11:53 ` Kalle Valo
2019-04-19 5:50 ` [PATCH v9 13/14] rtw88: add MAINTAINERS entry yhchuang
[not found] ` <1555653004-1795-15-git-send-email-yhchuang@realtek.com>
2019-04-26 12:09 ` [PATCH v9 14/14] staging: rtlwifi: remove staging rtlwifi driver Kalle Valo
2019-04-26 12:19 ` Tony Chuang
2019-04-27 6:36 ` gregkh
2019-04-30 12:40 ` [PATCH v9 00/14] rtw88: mac80211 driver for Realtek 802.11ac wireless network chips Kalle Valo
2019-04-30 15:58 ` Stanislaw Gruszka
2019-04-30 16:47 ` Kalle Valo
2019-04-30 17:42 ` Greg KH
2019-05-01 7:09 ` Kalle Valo
2019-05-01 8:19 ` Greg KH
2019-05-01 8:42 ` Greg KH
2019-05-02 2:05 ` Tony Chuang
2021-06-18 12:08 ` rtw88: SDIO Support Rudi Heitbaum
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=87v9yvpvc4.fsf@kamboji.qca.qualcomm.com \
--to=kvalo@codeaurora.org \
--cc=Larry.Finger@lwfinger.net \
--cc=briannorris@chromium.org \
--cc=gregkh@linuxfoundation.org \
--cc=johannes@sipsolutions.net \
--cc=linux-wireless@vger.kernel.org \
--cc=pkshih@realtek.com \
--cc=sgruszka@redhat.com \
--cc=tehuang@realtek.com \
--cc=yhchuang@realtek.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;
as well as URLs for NNTP newsgroup(s).