Received: by 2002:a05:6358:7058:b0:131:369:b2a3 with SMTP id 24csp275176rwp; Wed, 12 Jul 2023 13:07:51 -0700 (PDT) X-Google-Smtp-Source: APBJJlEXCjzDZoQV9YWB/7cAJQGkoXymC53C19OJG+1Cm2XHgQ9a/3qHIEvquopvfUfsYeNFS5Cp X-Received: by 2002:a17:90b:705:b0:256:1700:5ec9 with SMTP id s5-20020a17090b070500b0025617005ec9mr15240681pjz.31.1689192470905; Wed, 12 Jul 2023 13:07:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689192470; cv=none; d=google.com; s=arc-20160816; b=a5/n1afgiE/ZvpV2BuOr664wsFcZlEvFi311mt5JrrDW62GTUznWSGhT24VehZbkfv 7T6w4tdj2gv92XsftQvIaSOC9uYvK14tvtSxweMhwUX6ItW0UlIcmlDEucWkInI6/XEt MxSlzn6WugH42qfiseVLaibE6VCyDDOK9RXVq/5+0ob2nEo713Q9YtmO0LSfzdW2q0FQ UHQYFzPx4aMevMR74KdNu7P5e4epHg81Q1dZQ0N5Fcc/WJdN4EhVi1iDnT4Rf9xJpig5 M2jTDHue0fkEws7m7S2aqVWdSqd7tF6Mb80h4zouvH/1xgWooT45xScAf5ch5hsn4rKj L7Vw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=qRD+rBROHm7/Vfr/uWQ1tFokSDTiUvUT042tpZ9exW8=; fh=Zcs8tIAX8pynoj2JAQEW3oYFcYHMGOamvVcvy4eQoEw=; b=iklDoFugy4eE89GI046waHgUhDYoIdeBC7MpaxCCjotNdkXFLjLwMrW9YebWMNHDr8 xSYGz4fvn0cB+P3pqPZEbJgXbnzU/sh9aJPHAsCv3rqfKzsFZYsjsR7eXo0ngfh75+HJ LD4bqApaItb/srRbHVIDDLhNYZoBEK+JLqkO2ROiMZ44RTRXLT5kcivXT/mnqJkJozkG s/PBpShH/m4IxIpKS/oUqBR6Oaky32Rj1u7TaImSB1fPqums8rVZYlz3qMZMziho293q kORyOp+37/Yu4/kENqEMRQSb0oxNVkh2gn3gDytmPhB82wq3JeUZ++SvV3VKfDL8b9cB ZwfA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=LpE3SJuN; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id a7-20020a17090a008700b002637aa0a4dbsi10841570pja.103.2023.07.12.13.07.30; Wed, 12 Jul 2023 13:07:50 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=LpE3SJuN; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232025AbjGLTgT (ORCPT + 99 others); Wed, 12 Jul 2023 15:36:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60746 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231499AbjGLTgR (ORCPT ); Wed, 12 Jul 2023 15:36:17 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 01FED1BDC for ; Wed, 12 Jul 2023 12:36:16 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 64FB461719 for ; Wed, 12 Jul 2023 19:36:15 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5E222C433C8; Wed, 12 Jul 2023 19:36:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1689190574; bh=EogeTGIiuUFqzne3v5vm4Ifad7BZZ2pCtarM917N8FI=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=LpE3SJuNK4U7nmwc8P4oTt0ZKY7/t2LKkaEq8vEXLKYM8LnUOaJU0H7H0C+RhZ4mv ttm0IOyk6cIjvzPIMUxFThldGR4abW/8Aknzi53P2wErDaQpIoPiU5gAaWKIhHWY/2 EtMI8/8C3jH0byvt5apBXNgnl9RERwkcMMqffHgnOpZH3eskXZXWBPo66ohtW4v88M 2PwmkAW2cUDbgkk5A8EJt8OgxuC1PcQY7W8Lqio7OUlzAwtDlHIBOOTXOOCOrGO+8I 2XW6vyo6jBcouoJXLjKa44KCxp5fRJDiXH8JHDYDCjwziNuOxnJLrYvZCrRG3IscTu DEhB8WwhRBQiA== Date: Wed, 12 Jul 2023 12:36:13 -0700 From: Jakub Kicinski To: Ivan Vecera Cc: netdev@vger.kernel.org, Simon Horman , Rafal Romanowski , Leon Romanovsky , Ma Yuying , Jesse Brandeburg , Tony Nguyen , "David S. Miller" , Eric Dumazet , Paolo Abeni , intel-wired-lan@lists.osuosl.org (moderated list:INTEL ETHERNET DRIVERS), linux-kernel@vger.kernel.org (open list) Subject: Re: [PATCH v2 1/2] i40e: Add helper for VF inited state check with timeout Message-ID: <20230712123613.20a98732@kernel.org> In-Reply-To: <20230712133247.588636-1-ivecera@redhat.com> References: <20230712133247.588636-1-ivecera@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 12 Jul 2023 15:32:46 +0200 Ivan Vecera wrote: > + for (i = 0; i < 15; i++) > + if (!test_bit(I40E_VF_STATE_INIT, &vf->vf_states)) > + msleep(20); > + > + if (!test_bit(I40E_VF_STATE_INIT, &vf->vf_states)) { > + dev_err(&vf->pf->pdev->dev, > + "VF %d still in reset. Try again.\n", vf->vf_id); > + return false; I like my loop more but if you want to have the msleep() indented just add an else { return true; } branch. Take advantage of the fact this is a function, now, and you can just return.