Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp142802pxv; Wed, 30 Jun 2021 17:14:31 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzcnFrfqmKgUq4dApjPO7LaZu62J78XKur28W9EsEePd7Gfg20JVa/5XHX8hgO23E5yB9MY X-Received: by 2002:a92:c0ca:: with SMTP id t10mr30034157ilf.241.1625098471605; Wed, 30 Jun 2021 17:14:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1625098471; cv=none; d=google.com; s=arc-20160816; b=Cyp/5DVKHW0xJs6eq3fYqPjdPCbx4RwnVsFfzVvYxrE9Io8zgNGagb2TJHmIui6pkV +NH4YbbDTARi/BGmLiDUDjvikCkcSb/lMNthuzFz9M6PQGQ+iWilRk8CFdhWWj6Ops3m 6l5w8dK0Zw8OtirB5Zm4MZxCLvFzF69dJFJIjgaz2bQTVyMFwdMVwLA2bQp1LHsnvgXG 0MJxA8JfJC3MPESY7xRq6akhZU3UtJpnHppqSw/cPvhJJF2J3W23oAnTdTcth2UjHUp6 Kt9oVRZUW0ePvy9OXP7LOkBjuVM2oB+kYHu1uriAR8GjAUWfe8CEjl37KCgR7iRcJDiO oYNw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:date:from:dkim-signature; bh=votCsR8QuC+BJJYuIxcHQ0x9+KTlBJzpPzzO+5vNEZg=; b=oveUg0Y2WYPwKDpPi1RaGOSUBvmZt96CC52zg/rAJqvcCwS4t2ajPT9fwHk9U8StCS ZK/GDae2ZYhSHfsUdtXH19h+5ef8qtY+BoUByfAKYDPLsVtDcVALKy7qwKQBfGc6a+eV 56cHMJPYkCemHSSRTuI8jaDZkVAQI1F+Js1Ka8NHhZEFIibxp2KkIW1oXXxHpbr0KlQn QXbi/u2da/UfP0ypfLZbj6dixTEi8857SmwXIHp3CSj5yLf9rT7x+g2YeyvmO5EEmS43 cCrgEoYWYzENQCWvYGk9g0uGV1gTA8jSV5nbAzUQ0z3w+AbOJ+Nuu89PoPC2+LAGQeqP BCyQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=kfeG4KUC; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id p8si29379178ilh.98.2021.06.30.17.14.17; Wed, 30 Jun 2021 17:14:31 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=kfeG4KUC; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237454AbhF3XiF (ORCPT + 99 others); Wed, 30 Jun 2021 19:38:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34786 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236647AbhF3XiE (ORCPT ); Wed, 30 Jun 2021 19:38:04 -0400 Received: from mail-pj1-x102a.google.com (mail-pj1-x102a.google.com [IPv6:2607:f8b0:4864:20::102a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7A890C061756; Wed, 30 Jun 2021 16:35:32 -0700 (PDT) Received: by mail-pj1-x102a.google.com with SMTP id x21-20020a17090aa395b029016e25313bfcso2647878pjp.2; Wed, 30 Jun 2021 16:35:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:date:to:cc:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to; bh=votCsR8QuC+BJJYuIxcHQ0x9+KTlBJzpPzzO+5vNEZg=; b=kfeG4KUCtbuMI2RLmqJGZDydOwhKjll5sSqDv3t1Ce6JcNf9RLaOIuKVtkOnCB2Y2c yu3rc2f5OdkS9JTpEqH3ugYrL08zUg1ror7qjfOx0GGSIS528YW+G9sBmRnk+GI322cH hjSDM7pv+6fLN9vG7LOTSm6ML0PEPig0qL9deap2vU9xycDcCOC0eZpiZmrcpM5BLgn+ A3SAxIMc5rEmnVQWTAR/sl3XoQIE6mThQumrqycQ5KH7RiOQmcg+ECuuvImSLxwQ8noz hMjx+40qlk6kKJeXvsylwDc83ltplzEF2CIuklhodVwDKzUrLlQhg+xizoUg4qDxJgP8 zLJA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:date:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to; bh=votCsR8QuC+BJJYuIxcHQ0x9+KTlBJzpPzzO+5vNEZg=; b=pjxJMcpVRGYIaJ5ThK5NhyeKh3MsW1hlh0w3CelJrn8dwlvhukFKDsNLdvRwxqHIgX /5lMCMOM74yW0//FL0RkpH9Jgz7UHtea/6joY8CIRSTI0n2g84SlpkCoBvj+rAeLu48o 2HCDyQKGq85dbG1kBkZiCurQ1QxUMqBu/5FCfbYzP+ThizTygpDKzGSsxlxQrwCYFduz eMU7cOeyrCihngyZfjVSyqCUNFqcR5zn0O3kLj9ERpThdsC+hGYdNfDxdL6hg1CilJWS th0iBIgV76wCVzIgjY1kCmxR6Uho596pLO2TrBbU/Qr/oHJjNnIfBYFqk9g8tbzSu+mC 7Adg== X-Gm-Message-State: AOAM531BfRDGZ5cRcaz7Pjd1KeuFTA/YmX4qRhf8ObD3QVmJgd6RMte0 f4IZI/qX4mjTfs5LCA4bEVE= X-Received: by 2002:a17:90a:fa97:: with SMTP id cu23mr1645386pjb.126.1625096131882; Wed, 30 Jun 2021 16:35:31 -0700 (PDT) Received: from localhost ([160.16.113.140]) by smtp.gmail.com with ESMTPSA id i13sm8202807pgm.26.2021.06.30.16.35.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 30 Jun 2021 16:35:31 -0700 (PDT) From: Coiby Xu X-Google-Original-From: Coiby Xu Date: Thu, 1 Jul 2021 07:33:38 +0800 To: Joe Perches 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 Subject: Re: [RFC 13/19] staging: qlge: rewrite do while loop as for loop in qlge_sem_spinlock Message-ID: <20210630233338.2l34shhrm3bdd4gx@Rk> References: <20210621134902.83587-1-coiby.xu@gmail.com> <20210621134902.83587-14-coiby.xu@gmail.com> <20210622072036.GK1861@kadam> <20210624112245.zgvkcxyu7hzrzc23@Rk> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1; format=flowed Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 >[] >> > > @@ -140,12 +140,13 @@ static int qlge_sem_trylock(struct qlge_adapter *qdev, u32 sem_mask) >> > > ?int qlge_sem_spinlock(struct qlge_adapter *qdev, u32 sem_mask) >> > > ?{ >> > > ? unsigned int wait_count = 30; >> > > + int count; >> > > >> > > - do { >> > > + for (count = 0; count < wait_count; count++) { >> > > ? if (!qlge_sem_trylock(qdev, sem_mask)) >> > > ? return 0; >> > > - udelay(100); >> > > - } while (--wait_count); >> > > + udelay(UDELAY_DELAY); >> > >> > This is an interesting way to silence the checkpatch udelay warning. ;) >> >> I didn't know this could silence the warning :) > >It also seems odd to have unsigned int wait_count and int count. > >Maybe just use 30 in the loop without using wait_count at all. Thanks for the suggestion. I will apply it to v1. > >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? > > -- Best regards, Coiby