[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20210702235629.k2k2q7b2lxzw4kzd@Rk>
Date: Sat, 3 Jul 2021 07:56:29 +0800
From: Coiby Xu <coiby.xu@...il.com>
To: Joe Perches <joe@...ches.com>
Cc: Dan Carpenter <dan.carpenter@...cle.com>,
linux-staging@...ts.linux.dev, netdev@...r.kernel.org,
Benjamin Poirier <benjamin.poirier@...il.com>,
Shung-Hsi Yu <shung-hsi.yu@...e.com>,
Manish Chopra <manishc@...vell.com>,
"supporter:QLOGIC QLGE 10Gb ETHERNET DRIVER"
<GR-Linux-NIC-Dev@...vell.com>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
open list <linux-kernel@...r.kernel.org>
Subject: Re: [RFC 13/19] staging: qlge: rewrite do while loop as for loop in
qlge_sem_spinlock
On Wed, Jun 30, 2021 at 09:35:31PM -0700, Joe Perches wrote:
>On Thu, 2021-07-01 at 07:33 +0800, Coiby Xu wrote:
>> On Wed, Jun 30, 2021 at 03:58:06AM -0700, Joe Perches wrote:
>> > On Thu, 2021-06-24 at 19:22 +0800, Coiby Xu wrote:
>> > > On Tue, Jun 22, 2021 at 10:20:36AM +0300, Dan Carpenter wrote:
>> > > > On Mon, Jun 21, 2021 at 09:48:56PM +0800, Coiby Xu wrote:
>> > > > > Since wait_count=30 > 0, the for loop is equivalent to do while
>> > > > > loop. This commit also replaces 100 with UDELAY_DELAY.
>> > []
>> > > > > diff --git a/drivers/staging/qlge/qlge_main.c b/drivers/staging/qlge/qlge_main.c
>> > []
>> > I also think using UDELAY_DELAY is silly and essentially misleading
>> > as it's also used as an argument value for mdelay
>> >
>> > $ git grep -w UDELAY_DELAY
>> > drivers/staging/qlge/qlge.h:#define UDELAY_DELAY 100
>> > drivers/staging/qlge/qlge_main.c: udelay(UDELAY_DELAY);
>> > drivers/staging/qlge/qlge_main.c: udelay(UDELAY_DELAY);
>> > drivers/staging/qlge/qlge_mpi.c: mdelay(UDELAY_DELAY);
>> > drivers/staging/qlge/qlge_mpi.c: mdelay(UDELAY_DELAY);
>> > drivers/staging/qlge/qlge_mpi.c: mdelay(UDELAY_DELAY); /* 100ms */
>>
>> Thanks for spotting this issue! How about "#define MDELAY_DELAY 100" for
>> mdelay?
>
>I think the define is pointless and it'd be more readable
>to just use 100 in all the cases.
>
>IMO: There really aren't enough cases to justify using defines.
I thought magic number should be avoided if possible. This case is new
to me. Thanks for the explanation!
>
>
--
Best regards,
Coiby
Powered by blists - more mailing lists