From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pj1-f44.google.com (mail-pj1-f44.google.com [209.85.216.44]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 26EF5168 for ; Thu, 24 Jun 2021 11:25:10 +0000 (UTC) Received: by mail-pj1-f44.google.com with SMTP id 13-20020a17090a08cdb029016eed209ca4so3284089pjn.1 for ; Thu, 24 Jun 2021 04:25:10 -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:in-reply-to; bh=AvRzk6yM4BX1NO5XMxEtdArbNT4paDVtHU1ZzBJEtC0=; b=ZucTXTtcuQRo5/mqSnG5JDGiaO/6AySlJbTTkNZd2961RYCpQdnDAV5hu58lP286uN rbA/vwA0GuvmfyP4ZcD8GOwqUc87JKfkdwxFOkH0JeyyegY96WQfxaq402f2n+9eCVOg SUSojswAsqdRzDtBnt2j+6HaEZc7FGS9tSHMPapzxbLrfgMSLxU0UluJ57wTPbwjov/a 21kmEUPlVqZTtNCGZbJeySWFfsKE9gD/fZuOZ87xAuvC2a5y/+8RcMu3u9fbaV1V4ZGK 3iNNtyqFv7TpU7Wi+g7Wo0lU1tN96jiotb375rgyKj8H1kEdkHMdZpFrc4PEUle6xTNi fVDw== 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:in-reply-to; bh=AvRzk6yM4BX1NO5XMxEtdArbNT4paDVtHU1ZzBJEtC0=; b=EPFSslmpOqTz7KWX/YihS6hieyfRW8zDD8f6Ivxu6ShhOLmQrQl+NPLevtjJnMK9l3 KBQxuN/NLO2bmiygWeRoE4UCQfWsXB8XyA2qEwQdyUmqCG8FB0WB8FLHmVyBWVc64DTn lbeLd5YPV9TGlmeRPouHZKd5qlQro41JpgXg6XYqwKLtYYiJk04QzKeruB1kD7FMnkES 8QSH/f7Q4vo4AvCmqJ6JMSbAUfTt5EneHqrlNDjhR/HbP/ldLkznp6p579i+yilDBySY GMZrMHuDxnNkw6VmGVZ4mD6Z1m5INb51muiiE7NpN7FKq34PCPpgSRzqneKX8DBoKPX0 7s0Q== X-Gm-Message-State: AOAM531M02wBhy4xVV5odYZBpnBsWdtBaJYYgO+JFj8YNEoHZnQ6dvhr BbYJRHCmCYNHQ/F8ouMFMHg= X-Google-Smtp-Source: ABdhPJz/EGT07gFEDdUsHICmy8CCAGTPDKKFllLVjQePTtBP+V7Guimcr/NEVqCw8G9dWlpLubZvVw== X-Received: by 2002:a17:903:31d3:b029:ee:bccd:e686 with SMTP id v19-20020a17090331d3b02900eebccde686mr3907255ple.1.1624533909744; Thu, 24 Jun 2021 04:25:09 -0700 (PDT) Received: from localhost ([209.132.188.80]) by smtp.gmail.com with ESMTPSA id w11sm2227719pgp.60.2021.06.24.04.25.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 24 Jun 2021 04:25:08 -0700 (PDT) From: Coiby Xu X-Google-Original-From: Coiby Xu Date: Thu, 24 Jun 2021 19:22:45 +0800 To: Dan Carpenter Cc: 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: <20210624112245.zgvkcxyu7hzrzc23@Rk> References: <20210621134902.83587-1-coiby.xu@gmail.com> <20210621134902.83587-14-coiby.xu@gmail.com> <20210622072036.GK1861@kadam> Precedence: bulk X-Mailing-List: linux-staging@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline In-Reply-To: <20210622072036.GK1861@kadam> 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. >> >> Signed-off-by: Coiby Xu >> --- >> drivers/staging/qlge/qlge_main.c | 7 ++++--- >> 1 file changed, 4 insertions(+), 3 deletions(-) >> >> diff --git a/drivers/staging/qlge/qlge_main.c b/drivers/staging/qlge/qlge_main.c >> index c5e161595b1f..2d2405be38f5 100644 >> --- 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 :) > >regards, >dan carpenter > -- Best regards, Coiby 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=-12.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS 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 99A18C49EA5 for ; Thu, 24 Jun 2021 11:25:13 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 6A1AF613BE for ; Thu, 24 Jun 2021 11:25:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232486AbhFXL1a (ORCPT ); Thu, 24 Jun 2021 07:27:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58520 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232274AbhFXL12 (ORCPT ); Thu, 24 Jun 2021 07:27:28 -0400 Received: from mail-pj1-x1029.google.com (mail-pj1-x1029.google.com [IPv6:2607:f8b0:4864:20::1029]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2F90DC061574; Thu, 24 Jun 2021 04:25:10 -0700 (PDT) Received: by mail-pj1-x1029.google.com with SMTP id b5-20020a17090a9905b029016fc06f6c5bso3262976pjp.5; Thu, 24 Jun 2021 04:25:10 -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:in-reply-to; bh=AvRzk6yM4BX1NO5XMxEtdArbNT4paDVtHU1ZzBJEtC0=; b=ZucTXTtcuQRo5/mqSnG5JDGiaO/6AySlJbTTkNZd2961RYCpQdnDAV5hu58lP286uN rbA/vwA0GuvmfyP4ZcD8GOwqUc87JKfkdwxFOkH0JeyyegY96WQfxaq402f2n+9eCVOg SUSojswAsqdRzDtBnt2j+6HaEZc7FGS9tSHMPapzxbLrfgMSLxU0UluJ57wTPbwjov/a 21kmEUPlVqZTtNCGZbJeySWFfsKE9gD/fZuOZ87xAuvC2a5y/+8RcMu3u9fbaV1V4ZGK 3iNNtyqFv7TpU7Wi+g7Wo0lU1tN96jiotb375rgyKj8H1kEdkHMdZpFrc4PEUle6xTNi fVDw== 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:in-reply-to; bh=AvRzk6yM4BX1NO5XMxEtdArbNT4paDVtHU1ZzBJEtC0=; b=cVnIJ73GJflDJM8WrOVuUrMiugVYSvMY6LMHO6K6tdAhvLwB6Ka8KythWsjlBq7TQF z9Bp0vste/BOd1y3qVDi5idjCDDfzfJZW2Wkbc2tgVwmX0fXB1r51w5oqR4rAL3smgIf uJBoZju3fy+NvaTrRCVoEUODPmWXoD+pcA9ZlBxDQml5L2jdvbZpTYHRayDHPjY8cK4R Qses62xZsoPWsDhfiHMUp6v3Rqq1s910/x6Jc8QfJ/1M5fWFqM/LT9Oqe47H7GsSWZP2 pp82P1VLQIq6IPBYWTGWckNp5PENYxGtSErdDSWrVapySNJMy40XQTxMlS0Ec+uZjUKG ageg== X-Gm-Message-State: AOAM532annqIeD59AoUIzRXuseSn/Mkc/C60hjrI4zjngJnLhSNs6RgR TMiJRmaVODUBNuq539hdHxA= X-Google-Smtp-Source: ABdhPJz/EGT07gFEDdUsHICmy8CCAGTPDKKFllLVjQePTtBP+V7Guimcr/NEVqCw8G9dWlpLubZvVw== X-Received: by 2002:a17:903:31d3:b029:ee:bccd:e686 with SMTP id v19-20020a17090331d3b02900eebccde686mr3907255ple.1.1624533909744; Thu, 24 Jun 2021 04:25:09 -0700 (PDT) Received: from localhost ([209.132.188.80]) by smtp.gmail.com with ESMTPSA id w11sm2227719pgp.60.2021.06.24.04.25.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 24 Jun 2021 04:25:08 -0700 (PDT) From: Coiby Xu X-Google-Original-From: Coiby Xu Date: Thu, 24 Jun 2021 19:22:45 +0800 To: Dan Carpenter Cc: 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: <20210624112245.zgvkcxyu7hzrzc23@Rk> References: <20210621134902.83587-1-coiby.xu@gmail.com> <20210621134902.83587-14-coiby.xu@gmail.com> <20210622072036.GK1861@kadam> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline In-Reply-To: <20210622072036.GK1861@kadam> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. >> >> Signed-off-by: Coiby Xu >> --- >> drivers/staging/qlge/qlge_main.c | 7 ++++--- >> 1 file changed, 4 insertions(+), 3 deletions(-) >> >> diff --git a/drivers/staging/qlge/qlge_main.c b/drivers/staging/qlge/qlge_main.c >> index c5e161595b1f..2d2405be38f5 100644 >> --- 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 :) > >regards, >dan carpenter > -- Best regards, Coiby