* [PATCH] qlge: refactor qlge_change_rx_buffers() in qlge_main.c
@ 2021-12-28 12:17 Adam Kandur
2021-12-28 13:05 ` Greg KH
0 siblings, 1 reply; 5+ messages in thread
From: Adam Kandur @ 2021-12-28 12:17 UTC (permalink / raw)
To: linux-staging
Greetings. As I understand, qlge_change_rx_buffers() waits 4 times for
an outstanding reset to complete. And if it cannot, reports about
timeout. I assume this can be written using for loop instead of while,
wich looks nicer for me.
Signed-off-by: Adam Kandur <sys.arch.adam@gmail.com>
---
drivers/staging/qlge/qlge_main.c | 15 ++++++---------
1 file changed, 6 insertions(+), 9 deletions(-)
diff --git a/drivers/staging/qlge/qlge_main.c b/drivers/staging/qlge/qlge_main.c
index 9873bb2a9ee4..f36e43a85038 100644
--- a/drivers/staging/qlge/qlge_main.c
+++ b/drivers/staging/qlge/qlge_main.c
@@ -4012,19 +4012,16 @@ static int qlge_change_rx_buffers(struct
qlge_adapter *qdev)
/* Wait for an outstanding reset to complete. */
if (!test_bit(QL_ADAPTER_UP, &qdev->flags)) {
- int i = 4;
-
- while (--i && !test_bit(QL_ADAPTER_UP, &qdev->flags)) {
+ for (int i = 4; !test_bit(QL_ADAPTER_UP, &qdev->flags); i--) {
+ if (!i) {
+ netif_err(qdev, ifup, qdev->ndev,
+ "Timed out waiting for adapter UP\n");
+ return -ETIMEDOUT;
+ }
netif_err(qdev, ifup, qdev->ndev,
"Waiting for adapter UP...\n");
ssleep(1);
}
-
- if (!i) {
- netif_err(qdev, ifup, qdev->ndev,
- "Timed out waiting for adapter UP\n");
- return -ETIMEDOUT;
- }
}
status = qlge_adapter_down(qdev);
--
2.34.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] qlge: refactor qlge_change_rx_buffers() in qlge_main.c
2021-12-28 12:17 [PATCH] qlge: refactor qlge_change_rx_buffers() in qlge_main.c Adam Kandur
@ 2021-12-28 13:05 ` Greg KH
0 siblings, 0 replies; 5+ messages in thread
From: Greg KH @ 2021-12-28 13:05 UTC (permalink / raw)
To: Adam Kandur; +Cc: linux-staging
On Tue, Dec 28, 2021 at 03:17:59PM +0300, Adam Kandur wrote:
> Greetings. As I understand, qlge_change_rx_buffers() waits 4 times for
> an outstanding reset to complete. And if it cannot, reports about
> timeout. I assume this can be written using for loop instead of while,
> wich looks nicer for me.
>
> Signed-off-by: Adam Kandur <sys.arch.adam@gmail.com>
> ---
> drivers/staging/qlge/qlge_main.c | 15 ++++++---------
> 1 file changed, 6 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/staging/qlge/qlge_main.c b/drivers/staging/qlge/qlge_main.c
> index 9873bb2a9ee4..f36e43a85038 100644
> --- a/drivers/staging/qlge/qlge_main.c
> +++ b/drivers/staging/qlge/qlge_main.c
> @@ -4012,19 +4012,16 @@ static int qlge_change_rx_buffers(struct
> qlge_adapter *qdev)
>
> /* Wait for an outstanding reset to complete. */
> if (!test_bit(QL_ADAPTER_UP, &qdev->flags)) {
> - int i = 4;
> -
> - while (--i && !test_bit(QL_ADAPTER_UP, &qdev->flags)) {
> + for (int i = 4; !test_bit(QL_ADAPTER_UP, &qdev->flags); i--) {
> + if (!i) {
> + netif_err(qdev, ifup, qdev->ndev,
> + "Timed out waiting for adapter UP\n");
> + return -ETIMEDOUT;
> + }
> netif_err(qdev, ifup, qdev->ndev,
> "Waiting for adapter UP...\n");
> ssleep(1);
> }
> -
> - if (!i) {
> - netif_err(qdev, ifup, qdev->ndev,
> - "Timed out waiting for adapter UP\n");
> - return -ETIMEDOUT;
> - }
> }
>
> status = qlge_adapter_down(qdev);
> --
> 2.34.0
>
Hi,
This is the friendly patch-bot of Greg Kroah-Hartman. You have sent him
a patch that has triggered this response. He used to manually respond
to these common problems, but in order to save his sanity (he kept
writing the same thing over and over, yet to different people), I was
created. Hopefully you will not take offence and will fix the problem
in your patch and resubmit it so that it can be accepted into the Linux
kernel tree.
You are receiving this message because of the following common error(s)
as indicated below:
- Your patch is malformed (tabs converted to spaces, linewrapped, etc.)
and can not be applied. Please read the file,
Documentation/email-clients.txt in order to fix this.
- This looks like a new version of a previously submitted patch, but you
did not list below the --- line any changes from the previous version.
Please read the section entitled "The canonical patch format" in the
kernel file, Documentation/SubmittingPatches for what needs to be done
here to properly describe this.
If you wish to discuss this problem further, or you have questions about
how to resolve this issue, please feel free to respond to this email and
Greg will reply once he has dug out from the pending patches received
from other developers.
thanks,
greg k-h's patch email bot
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH] qlge: refactor qlge_change_rx_buffers() in qlge_main.c
@ 2021-12-28 13:57 Adam Kandur
2021-12-28 14:45 ` Pavel Skripkin
2022-01-06 8:35 ` Dan Carpenter
0 siblings, 2 replies; 5+ messages in thread
From: Adam Kandur @ 2021-12-28 13:57 UTC (permalink / raw)
To: linux-staging; +Cc: Adam Kandur
Greetings. As I understand, qlge_change_rx_buffers() waits 4 times for
an outstanding reset to complete. And if it cannot, reports about
timeout. I assume this can be written using for loop instead of while,
wich looks nicer for me. Hope my guess was right.
Signed-off-by: Adam Kandur <sys.arch.adam@gmail.com>
---
drivers/staging/qlge/qlge_main.c | 15 ++++++---------
1 file changed, 6 insertions(+), 9 deletions(-)
diff --git a/drivers/staging/qlge/qlge_main.c b/drivers/staging/qlge/qlge_main.c
index 9873bb2a9ee4..f36e43a85038 100644
--- a/drivers/staging/qlge/qlge_main.c
+++ b/drivers/staging/qlge/qlge_main.c
@@ -4012,19 +4012,16 @@ static int qlge_change_rx_buffers(struct qlge_adapter *qdev)
/* Wait for an outstanding reset to complete. */
if (!test_bit(QL_ADAPTER_UP, &qdev->flags)) {
- int i = 4;
-
- while (--i && !test_bit(QL_ADAPTER_UP, &qdev->flags)) {
+ for (int i = 4; !test_bit(QL_ADAPTER_UP, &qdev->flags); i--) {
+ if (!i) {
+ netif_err(qdev, ifup, qdev->ndev,
+ "Timed out waiting for adapter UP\n");
+ return -ETIMEDOUT;
+ }
netif_err(qdev, ifup, qdev->ndev,
"Waiting for adapter UP...\n");
ssleep(1);
}
-
- if (!i) {
- netif_err(qdev, ifup, qdev->ndev,
- "Timed out waiting for adapter UP\n");
- return -ETIMEDOUT;
- }
}
status = qlge_adapter_down(qdev);
--
2.34.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] qlge: refactor qlge_change_rx_buffers() in qlge_main.c
2021-12-28 13:57 Adam Kandur
@ 2021-12-28 14:45 ` Pavel Skripkin
2022-01-06 8:35 ` Dan Carpenter
1 sibling, 0 replies; 5+ messages in thread
From: Pavel Skripkin @ 2021-12-28 14:45 UTC (permalink / raw)
To: Adam Kandur, linux-staging
Hi, Adam!
Looks like you have missed all maintainers in your CC list :) Please,
use ./script/get_mainainer.pl to get list of people who are responsible
for reviewing your code
On 12/28/21 16:57, Adam Kandur wrote:
> Greetings. As I understand, qlge_change_rx_buffers() waits 4 times for
> an outstanding reset to complete. And if it cannot, reports about
> timeout. I assume this can be written using for loop instead of while,
> wich looks nicer for me. Hope my guess was right.
>
Commit message should only explain why you do this change. You can leave
your unrelated thoughts/questions below ---, since this part won't be
visible in gitlog
> Signed-off-by: Adam Kandur <sys.arch.adam@gmail.com>
> ---
<--- here
> drivers/staging/qlge/qlge_main.c | 15 ++++++---------
> 1 file changed, 6 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/staging/qlge/qlge_main.c b/drivers/staging/qlge/qlge_main.c
> index 9873bb2a9ee4..f36e43a85038 100644
> --- a/drivers/staging/qlge/qlge_main.c
> +++ b/drivers/staging/qlge/qlge_main.c
> @@ -4012,19 +4012,16 @@ static int qlge_change_rx_buffers(struct qlge_adapter *qdev)
>
> /* Wait for an outstanding reset to complete. */
> if (!test_bit(QL_ADAPTER_UP, &qdev->flags)) {
Aren't there 5 checks actually? It seems unlikely that this bit will be
set after 3-4 instructions
> - int i = 4;
> -
> - while (--i && !test_bit(QL_ADAPTER_UP, &qdev->flags)) {
> + for (int i = 4; !test_bit(QL_ADAPTER_UP, &qdev->flags); i--) {
Have you compiled this patch? Compiler should have warn you about mixed
declaration and code.
With regards,
Pavel Skripkin
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] qlge: refactor qlge_change_rx_buffers() in qlge_main.c
2021-12-28 13:57 Adam Kandur
2021-12-28 14:45 ` Pavel Skripkin
@ 2022-01-06 8:35 ` Dan Carpenter
1 sibling, 0 replies; 5+ messages in thread
From: Dan Carpenter @ 2022-01-06 8:35 UTC (permalink / raw)
To: Adam Kandur; +Cc: linux-staging
On Tue, Dec 28, 2021 at 04:57:56PM +0300, Adam Kandur wrote:
> I assume this can be written using for loop instead of while,
> wich looks nicer for me.
The original code was better than your code.
Also we have a published style guidelines. We don't really encourage
people to start enforcing their own weird style preferences which are
not in the style guidelines. Once you are a maintainer then no one can
stop you from having opinions but until then it's best to stick to the
style guideline.
regards,
dan carpenter
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2022-01-06 8:36 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-12-28 12:17 [PATCH] qlge: refactor qlge_change_rx_buffers() in qlge_main.c Adam Kandur
2021-12-28 13:05 ` Greg KH
-- strict thread matches above, loose matches on Subject: below --
2021-12-28 13:57 Adam Kandur
2021-12-28 14:45 ` Pavel Skripkin
2022-01-06 8:35 ` Dan Carpenter
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).