Received: by 10.223.185.116 with SMTP id b49csp2264418wrg; Thu, 22 Feb 2018 10:45:09 -0800 (PST) X-Google-Smtp-Source: AH8x2253lLzt4CtXZrmSf10lsuLo6ML+GqvozozrIsWVmp7c42H8rAm5JOTFmvfX9FSqL1vC2qWU X-Received: by 10.99.127.29 with SMTP id a29mr6315764pgd.451.1519325109542; Thu, 22 Feb 2018 10:45:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519325109; cv=none; d=google.com; s=arc-20160816; b=nv8K5s0niAxtwRabWNE4rUahnxRMd4N1Wx8L14bF5jH9qGpPADEZNEDTzT/Gm1UO0b R5FOoiX9GLofHiLHpcj3aZvT8yaORjx8scV4RCa7UCpPMBe07fp0mGITqBWUcLUJblMV ubmp3oLH3YmuQ30wIon8uGI5X8rlxFfu/ANyy02fRDe60dQob152V2BP3swrOhvT26MU MXab/Yqi0y7hwPf3TZoaxmtLqAiopFQD7F29GWAnB749QA0k0JHsSo3AXwUTm+mX/F8a k/ePGvzKDYQpme6BY8qBBu48MVdAXqk+gKiTb/EqJoLiiOjHYN275AiUSIlviikcUZSS kA9g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature:arc-authentication-results; bh=+zDccxVWV7M5VoCORzdVDFGDu8PnIzHUAB6Jf3nqSXg=; b=mapGc7S2EbGYuqHg2vCvMIbPCeT+SXMROvz6fYVfKkjw80HGOnD9ptoYPfeZO+eDXK nYdA/1DOt0D8wmKdPQ2JtA9pziNPMOhmP9wmf2Wg7iSl8HKrLTKTfyywW3FwPPLKkpZA mcwCWAXrpMyQj3mUjhnHNJqvqeRKkON8xYltthR1L4Vrcx8kQYnpyCKCEYwZqG/ZJPuH YSQWl58Xii6JYXBP1d+spGmc0RtkiHjyxnuuKoJQLwKE7vErtrf9siv7RReCWZRfHs/L adXjkcRQWE8GN0trXHfrGVvX6i22YIywL6m9zY3VRXqCk+PCm3tH5n22kJTVx6T8Wzh7 /rGw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=aK2oZgGV; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c18si357985pgv.519.2018.02.22.10.44.54; Thu, 22 Feb 2018 10:45:09 -0800 (PST) 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=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=aK2oZgGV; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751274AbeBVSnv (ORCPT + 99 others); Thu, 22 Feb 2018 13:43:51 -0500 Received: from bombadil.infradead.org ([198.137.202.133]:53180 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750752AbeBVSnu (ORCPT ); Thu, 22 Feb 2018 13:43:50 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=In-Reply-To:Content-Type:MIME-Version :References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=+zDccxVWV7M5VoCORzdVDFGDu8PnIzHUAB6Jf3nqSXg=; b=aK2oZgGVco14OEd7DoHBHCA5e G0Up6BbHDiy5bquRlOlwKCOzc0cww/BsCar51YiYLyScZ+B+YV7SVNcuwTqZXYJoXBbxI0ulJXbv5 EJCuxidKHXyWbzp5MwQWugZ5UcWuNhzWbRWG2+3dDW5SCnDJ6Xek+MVQhOiXmuLTckV1uv4c4Sbmj jKvWF6945vCbroSd2YCKFWPEa9R5ffKyKtdq97GWZTlHWkAWNuqQg8agAnJHdoYDZilT1+Z0eeRPM dYz3SFVoXw/ttzLrFAHcvOnJM2x8FVrAAs//v0EEkuP5pFxzjlLGhLMjI5R6gHHFTRAWQI5Twr2ZW QoC2Il8bg==; Received: from hch by bombadil.infradead.org with local (Exim 4.89 #1 (Red Hat Linux)) id 1eovqO-0005tS-AD; Thu, 22 Feb 2018 18:43:48 +0000 Date: Thu, 22 Feb 2018 10:43:48 -0800 From: Christoph Hellwig To: Oza Pawandeep Cc: Bjorn Helgaas , Philippe Ombredanne , Thomas Gleixner , Greg Kroah-Hartman , Kate Stewart , linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, Dongdong Liu , Keith Busch , Wei Zhang , Sinan Kaya , Timur Tabi Subject: Re: [PATCH v10 6/7] PCI: Unify wait for link active into generic pci Message-ID: <20180222184348.GE6267@infradead.org> References: <1519315332-26852-1-git-send-email-poza@codeaurora.org> <1519315332-26852-7-git-send-email-poza@codeaurora.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1519315332-26852-7-git-send-email-poza@codeaurora.org> User-Agent: Mutt/1.9.2 (2017-12-15) X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > > +/** > + * pci__wait_for_link - Wait for link till its active/inactive typo - just wants a single underscore. > + pcie_capability_read_word(pdev, PCI_EXP_LNKSTA, &lnk_status); > + ret = !!(lnk_status & PCI_EXP_LNKSTA_DLLLA); no need for the !! when assigning to a boolean. > + > + while ((ret != active) && (timeout > 0)) { No need for either pair of inner braces. > + msleep(10); > + timeout -= 10; > + pcie_capability_read_word(pdev, PCI_EXP_LNKSTA, &lnk_status); > + ret = !!(lnk_status & PCI_EXP_LNKSTA_DLLLA); Same as above. > + } > + > + if (ret == active) > + return true; Seems like the structure is a bit odd. Why not: for (;;) { pcie_capability_read_word(pdev, PCI_EXP_LNKSTA, &lnk_status); if ((lnk_status & PCI_EXP_LNKSTA_DLLLA) == active) return true; if (timeout <= 0) break; timeout -= 10; }