From: Hayes Wang <hayeswang@realtek.com>
To: Douglas Anderson <dianders@chromium.org>,
Jakub Kicinski <kuba@kernel.org>,
"David S . Miller" <davem@davemloft.net>
Cc: "Laura Nao" <laura.nao@collabora.com>,
"Edward Hill" <ecgh@chromium.org>,
"Alan Stern" <stern@rowland.harvard.edu>,
"Grant Grundler" <grundler@chromium.org>,
"linux-usb@vger.kernel.org" <linux-usb@vger.kernel.org>,
"Simon Horman" <horms@kernel.org>, "Bjørn Mork" <bjorn@mork.no>,
"Eric Dumazet" <edumazet@google.com>,
"Paolo Abeni" <pabeni@redhat.com>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"netdev@vger.kernel.org" <netdev@vger.kernel.org>
Subject: RE: [PATCH net v2 2/5] r8152: Add RTL8152_INACCESSIBLE checks to more loops
Date: Wed, 29 Nov 2023 12:47:31 +0000 [thread overview]
Message-ID: <d6f843b90b7146059332c82159ba79ff@realtek.com> (raw)
In-Reply-To: <20231128133811.net.v2.2.I79c8a6c8cafd89979af5407d77a6eda589833dca@changeid>
Douglas Anderson <dianders@chromium.org>
> Sent: Wednesday, November 29, 2023 5:38 AM
[...]
> @@ -3000,6 +3000,8 @@ static void rtl8152_nic_reset(struct r8152 *tp)
> ocp_write_byte(tp, MCU_TYPE_PLA, PLA_CR, CR_RST);
>
> for (i = 0; i < 1000; i++) {
> + if (test_bit(RTL8152_INACCESSIBLE, &tp->flags))
> + return;
> if (!(ocp_read_byte(tp, MCU_TYPE_PLA, PLA_CR) & CR_RST))
> break;
> usleep_range(100, 400);
> @@ -3329,6 +3331,8 @@ static void rtl_disable(struct r8152 *tp)
> rxdy_gated_en(tp, true);
>
> for (i = 0; i < 1000; i++) {
> + if (test_bit(RTL8152_INACCESSIBLE, &tp->flags))
> + return;
I think you have to replace return with break.
Otherwise, rtl_stop_rx() wouldn't be called.
And, you may free the memory which is using, when rtl8152_close () is called.
> ocp_data = ocp_read_byte(tp, MCU_TYPE_PLA, PLA_OOB_CTRL);
> if ((ocp_data & FIFO_EMPTY) == FIFO_EMPTY)
> break;
> @@ -3336,6 +3340,8 @@ static void rtl_disable(struct r8152 *tp)
> }
>
> for (i = 0; i < 1000; i++) {
> + if (test_bit(RTL8152_INACCESSIBLE, &tp->flags))
> + return;
Same as above.
> if (ocp_read_word(tp, MCU_TYPE_PLA, PLA_TCR0) & TCR0_TX_EMPTY)
> break;
> usleep_range(1000, 2000);
> @@ -5499,6 +5505,8 @@ static void wait_oob_link_list_ready(struct r8152 *tp)
> int i;
>
> for (i = 0; i < 1000; i++) {
> + if (test_bit(RTL8152_INACCESSIBLE, &tp->flags))
> + return;
> ocp_data = ocp_read_byte(tp, MCU_TYPE_PLA, PLA_OOB_CTRL);
> if (ocp_data & LINK_LIST_READY)
> break;
> --
Best Regards,
Hayes
next prev parent reply other threads:[~2023-11-29 12:48 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-28 21:38 [PATCH net v2 1/5] r8152: Hold the rtnl_lock for all of reset Douglas Anderson
2023-11-28 21:38 ` [PATCH net v2 2/5] r8152: Add RTL8152_INACCESSIBLE checks to more loops Douglas Anderson
2023-11-29 12:47 ` Hayes Wang [this message]
2023-11-29 21:26 ` Doug Anderson
2023-11-28 21:38 ` [PATCH net v2 3/5] r8152: Add RTL8152_INACCESSIBLE to r8156b_wait_loading_flash() Douglas Anderson
2023-11-28 21:38 ` [PATCH net v2 4/5] r8152: Add RTL8152_INACCESSIBLE to r8153_pre_firmware_1() Douglas Anderson
2023-11-28 21:38 ` [PATCH net v2 5/5] r8152: Add RTL8152_INACCESSIBLE to r8153_aldps_en() Douglas Anderson
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=d6f843b90b7146059332c82159ba79ff@realtek.com \
--to=hayeswang@realtek.com \
--cc=bjorn@mork.no \
--cc=davem@davemloft.net \
--cc=dianders@chromium.org \
--cc=ecgh@chromium.org \
--cc=edumazet@google.com \
--cc=grundler@chromium.org \
--cc=horms@kernel.org \
--cc=kuba@kernel.org \
--cc=laura.nao@collabora.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=stern@rowland.harvard.edu \
/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