Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp372489imm; Wed, 17 Oct 2018 01:20:38 -0700 (PDT) X-Google-Smtp-Source: ACcGV60ZZ9PUbbmZEyvkS8QxGnABRX+Nr0VsJldqqFhIUDrIsXT2qdj6/cqdWvCMRcnx85zvh9QU X-Received: by 2002:a17:902:7e41:: with SMTP id a1-v6mr24586335pln.149.1539764438372; Wed, 17 Oct 2018 01:20:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539764438; cv=none; d=google.com; s=arc-20160816; b=XMHc0mXs5v5xxnmGOS+egdL6SlOZICZyKV/UNVFsLi9LPffHrV8ptbatvVsc62UYjZ DE4IcSC+UcdBcqxlLZD01VPIeOGv525Z/XFEuBxj2Se8jvhjp/HohdGaia7YUt+4hVtG VsX4Sr0qS2bJMgQmQ5Xaj6O8/9AMZogtnQOmwufzW/7vpNO67QGZSGs1sS2zUlNqOueh WpN5BlHXrsLkxyIkvmqQ2P9sZTaU+RAl7K1RWPkxIGDX7lMSuZhpvOqlxiVKSm+QmtYH MadBAsoMEi9z2s2YV/PrBB6/0QaZ4hA+bULkthY04sxlWM8bKQGdYZtL0e98+c1q1djs f7jg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=ITYBumtyQSVcI5lpSjOMZ+QBiPxS/jBpGoItslSkJAU=; b=lTKhihY1lgQYj/sRH0YsKhiGyf6vO1Z9oG1IVrDmo6sFU1CS4zKf969j+sJZU2QgBV xki1A56aax4xsW9bE0MKmpCghIPmv8KE0QDxoWn04nItWoLKB3gypTeJbS9pE8dIbTck k/LysUI6AoV2KPOUKd93KFCsAkllOZmL66ii4LxdD50AAJMbQ8l+RJMrIhMtsyyB8+oy FrhpH5TUAHH2C6rgUt76KGnut3Yb3fUZSoHKmQNM4VbT8U2BF1f+uooTKzPHpWcjPvt/ vV1NHoW/m7l4/Y7NJY0c7TIBvJ0oVAJvdCRJjuyCqlI73ACAyObejwdTiwyaS0vPpaaG 0YxQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=XNknPWLR; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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. [209.132.180.67]) by mx.google.com with ESMTP id h17-v6si15295226pfi.84.2018.10.17.01.20.23; Wed, 17 Oct 2018 01:20:38 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=XNknPWLR; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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 S1727357AbeJQQOQ (ORCPT + 99 others); Wed, 17 Oct 2018 12:14:16 -0400 Received: from mail-qt1-f195.google.com ([209.85.160.195]:39494 "EHLO mail-qt1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726957AbeJQQOQ (ORCPT ); Wed, 17 Oct 2018 12:14:16 -0400 Received: by mail-qt1-f195.google.com with SMTP id e22-v6so28998190qto.6; Wed, 17 Oct 2018 01:19:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=ITYBumtyQSVcI5lpSjOMZ+QBiPxS/jBpGoItslSkJAU=; b=XNknPWLRAuHN/vT80bAKT5MdZLrm0vlFT60EkGSCkKXfUKXb+IhdKgu/FzYcGGOjB8 ar0gQi1A+IxicWvUU1dcAHl/s+OLbnvsBKD1WAohmJ+EGwgdBpOU1Q/A06x/HIDXdmd9 Wl87Qj1fhUWeplLiul8l+QAqTog6K3YxcrdVzaZlBzw+vxOhcVyrVPWdYHoOraSbIBEy zFfx3LVigPhRoLmDQ898UGAjyvwJ1GV0INgWmXrX8D98BcYAhblkAgLtn7Pw0hjHJGf7 6hJhpLkTx/hRQKJEm3gEj7sajavHb/gwqyE9OTIpkfKOUjJY3d8xz2TCmb2MvZKEZsEq 2fZA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=ITYBumtyQSVcI5lpSjOMZ+QBiPxS/jBpGoItslSkJAU=; b=R9w4o04TyFFJzlImAkRZBtIaeU3MKMQZ/8GXe2Zq5Tm5iMuIfKaT9+pda1qwImATQy 7K61RjLQmcr8e69yytGaZ9ZeP+9pTcczVOeDDp+8EAoaS6MEYKgORnHEmob2aXDl7JnX TcuDp73ACPDzVW83Jmjjb21uQAuGa4iMO3x9SiCWSHX+cdpF5HBjAyOyp0i/l0pPYbpL Ak6NnIhsRdp2vL7xYQ51fuPUrW/0QPX3Cgbe14JhlQlSkJt9ibwUp94eTg7/EjkdY9jF 7lLCDs8LjqhZXwsTs5EzepvFRr84J+4CgQXC5MkzYAd+9zKKMy+gAkDQIVVusMf3Yh3A +uQA== X-Gm-Message-State: ABuFfoih0IWqv3SYZi3h0VaO1vA841nSWHdzyqcH4OyR8YpnvqlAes21 q1x2XeF6Wdjeo47dMX33kxAGyuk6dAZN4kwJdMg= X-Received: by 2002:ac8:190e:: with SMTP id t14-v6mr22803027qtj.327.1539764383022; Wed, 17 Oct 2018 01:19:43 -0700 (PDT) MIME-Version: 1.0 References: <1539755947-27014-1-git-send-email-suganath-prabu.subramani@broadcom.com> <1539755947-27014-2-git-send-email-suganath-prabu.subramani@broadcom.com> In-Reply-To: From: Andy Shevchenko Date: Wed, 17 Oct 2018 11:19:32 +0300 Message-ID: Subject: Re: [v5 1/4] mpt3sas: Separate out mpt3sas_wait_for_ioc_to_operational To: Suganath Prabu Subramani Cc: Bjorn Helgaas , Lukas Wunner , linux-scsi , linux-pci@vger.kernel.org, Linux Kernel Mailing List , Benjamin Herrenschmidt , ruscur@russell.cc, sbobroff@linux.ibm.com, oohall@gmail.com, Sathya Prakash , Sreekanth Reddy Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Oct 17, 2018 at 11:17 AM Andy Shevchenko wrote: > > On Wed, Oct 17, 2018 at 8:59 AM Suganath Prabu > wrote: > > > > No functional changes. This section of code > > "wait for IOC to be operational" is used in many places > > across the driver, and hence moved this code in to > > a function "mpt3sas_wait_for_ioc_to_operational()" > > > + ioc_state = mpt3sas_base_get_iocstate(ioc, 1); > > + while (ioc_state != MPI2_IOC_STATE_OPERATIONAL) { > > + > > Do we need this blank line? > > > + if (wait_state_count++ == timeout) { > > + ioc_err(ioc, "%s: failed due to ioc not operational\n", > > + __func__); > > + return -EFAULT; > > + } > > + ssleep(1); > > + ioc_state = mpt3sas_base_get_iocstate(ioc, 1); > > + ioc_info(ioc, "%s: waiting for operational state(count=%d)\n", > > + __func__, wait_state_count); > > + } > > I understand this is part of existing code, but can you consider to > modify it to something like > > do { > ioc_state = mpt3sas_base_get_iocstate(ioc, 1); > if (ioc_state == MPI2_IOC_STATE_OPERATIONAL) > break; Forgot ssleep(1); here. > ioc_info(ioc, "%s: waiting for operational state(count=%d)\n", > __func__, ++wait_state_count); > while (timeout--); > if (!timeout) { > ioc_err(ioc, "%s: failed due to ioc not operational\n", __func__); > return -EFAULT; > } > Less lines, more understandable in my view. -- With Best Regards, Andy Shevchenko