From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtprelay.hostedemail.com (smtprelay0068.hostedemail.com [216.40.44.68]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9F08170 for ; Thu, 1 Jul 2021 04:35:36 +0000 (UTC) Received: from omf19.hostedemail.com (clb03-v110.bra.tucows.net [216.40.38.60]) by smtprelay07.hostedemail.com (Postfix) with ESMTP id 5B578181EE40C; Thu, 1 Jul 2021 04:35:35 +0000 (UTC) Received: from [HIDDEN] (Authenticated sender: joe@perches.com) by omf19.hostedemail.com (Postfix) with ESMTPA id D603320D770; Thu, 1 Jul 2021 04:35:33 +0000 (UTC) Message-ID: Subject: Re: [RFC 13/19] staging: qlge: rewrite do while loop as for loop in qlge_sem_spinlock From: Joe Perches To: Coiby Xu Cc: Dan Carpenter , linux-staging@lists.linux.dev, netdev@vger.kernel.org, Benjamin Poirier , Shung-Hsi Yu , Manish Chopra , "supporter:QLOGIC QLGE 10Gb ETHERNET DRIVER" , Greg Kroah-Hartman , open list Date: Wed, 30 Jun 2021 21:35:31 -0700 In-Reply-To: <20210630233338.2l34shhrm3bdd4gx@Rk> References: <20210621134902.83587-1-coiby.xu@gmail.com> <20210621134902.83587-14-coiby.xu@gmail.com> <20210622072036.GK1861@kadam> <20210624112245.zgvkcxyu7hzrzc23@Rk> <20210630233338.2l34shhrm3bdd4gx@Rk> Content-Type: text/plain; charset="ISO-8859-1" User-Agent: Evolution 3.40.0-1 Precedence: bulk X-Mailing-List: linux-staging@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-1.37 X-Rspamd-Server: rspamout05 X-Rspamd-Queue-Id: D603320D770 X-Stat-Signature: 7rmdc1nrquttg9xgaoqxcsmo73w5qmoc X-Session-Marker: 6A6F6540706572636865732E636F6D X-Session-ID: U2FsdGVkX19n/GBQXP7gIkMOXhN3RXKOLxsT9DwiqiU= X-HE-Tag: 1625114133-240606 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. From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 21E06C11F69 for ; Thu, 1 Jul 2021 04:35:42 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 0A1A76147D for ; Thu, 1 Jul 2021 04:35:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233710AbhGAEiH (ORCPT ); Thu, 1 Jul 2021 00:38:07 -0400 Received: from smtprelay0066.hostedemail.com ([216.40.44.66]:55928 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S229577AbhGAEiF (ORCPT ); Thu, 1 Jul 2021 00:38:05 -0400 Received: from omf19.hostedemail.com (clb03-v110.bra.tucows.net [216.40.38.60]) by smtprelay07.hostedemail.com (Postfix) with ESMTP id 5B578181EE40C; Thu, 1 Jul 2021 04:35:35 +0000 (UTC) Received: from [HIDDEN] (Authenticated sender: joe@perches.com) by omf19.hostedemail.com (Postfix) with ESMTPA id D603320D770; Thu, 1 Jul 2021 04:35:33 +0000 (UTC) Message-ID: Subject: Re: [RFC 13/19] staging: qlge: rewrite do while loop as for loop in qlge_sem_spinlock From: Joe Perches To: Coiby Xu Cc: Dan Carpenter , linux-staging@lists.linux.dev, netdev@vger.kernel.org, Benjamin Poirier , Shung-Hsi Yu , Manish Chopra , "supporter:QLOGIC QLGE 10Gb ETHERNET DRIVER" , Greg Kroah-Hartman , open list Date: Wed, 30 Jun 2021 21:35:31 -0700 In-Reply-To: <20210630233338.2l34shhrm3bdd4gx@Rk> References: <20210621134902.83587-1-coiby.xu@gmail.com> <20210621134902.83587-14-coiby.xu@gmail.com> <20210622072036.GK1861@kadam> <20210624112245.zgvkcxyu7hzrzc23@Rk> <20210630233338.2l34shhrm3bdd4gx@Rk> Content-Type: text/plain; charset="ISO-8859-1" User-Agent: Evolution 3.40.0-1 MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Rspamd-Server: rspamout05 X-Rspamd-Queue-Id: D603320D770 X-Stat-Signature: 7rmdc1nrquttg9xgaoqxcsmo73w5qmoc X-Session-Marker: 6A6F6540706572636865732E636F6D X-Session-ID: U2FsdGVkX19n/GBQXP7gIkMOXhN3RXKOLxsT9DwiqiU= X-HE-Tag: 1625114133-240606 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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.